-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
DumpAllProcessor和DumpProcessor 并发执行导致的数据不一致(a-b-a)问题
Describe the bug
- At the beginning, configure group: test, dataid: test, content: a
- During the execution of dumpallprocessor, the old version data a is queried from DB; Then start dump; Content: a
- At this time, the configuration change triggered from the console will change a to B (at this time, DB, memory and disk have been changed); Content: B
- The dump of step 1 starts to execute, changing B to a; Content: a
- At this time, the configuration goes through a - > b - > A; The final configuration is a
Due to the above logic of parallel execution, the data A-B-A on the single machine; And data inconsistency between cluster nodes
0、开始时候,配置group: test,dataId: test,content: a
1、DumpAllProcessor 执行时候从db查询到了旧版本的数据a;此时content:a
2、此时从控制台触发的配置变更将a改为了b(此时db、内存、磁盘都已变更);此时content:b
3、步骤一的dump开始执行,将b改为了a;此时content:a
4、此时配置经历了 a->b->a;最终配置是a
由于上面这种并行执行的逻辑,导致了单机上的数据a-b-a;以及集群节点间的数据不一致
Expected behavior
The last thing you want to query about this configuration is b
希望最后查询到此配置的内容是 b
Acutally behavior
The content of this configuration is a
查询到此配置的内容是a
How to Reproduce
Steps to reproduce the behavior:
-
Modify the logic of dumpallprocessor to make this case easier to reproduce. After querying the data from DB, sleep for a period of time, and then execute the next step
-
Modify the configuration to a new value and query to get a new value
-
Wait for dumpallprocessor to finish executing, and query the old value
-
修改下DumpAllProcessor的逻辑使得此case更容易复现,从db查询到数据后sleep一段时间,sleep时候执行下一步骤
-
修改配置为新值,查询可以得到新值
-
等待DumpAllProcessor执行完毕,查询得到旧值
Desktop (please complete the following information):
- OS: [e.g. Centos]
- Version [nacos-server 2.0.4]
- Module [e.g. config]