How does the sum(column) aggregate function ensure non-duplicate results in a multi-replica scenario with TiFlash?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: sum(column)聚合函数,在多副本场景下,tiflash如何做到结果不重复的?

| username: atidat

As shown in the figure above, tbl has 5 regions, and the number of replicas is set to 3. It is known that the region identity on the TiFlash node is Learner. So, when performing the sum() aggregate function, how is the correctness of the result ensured (e.g., region-1 will not be calculated twice)?

| username: 我是咖啡哥 | Original post link

This is a good question. I guess we need to look at the source code.

| username: 近墨者zyl | Original post link

Can the region of TiFlash be a leader?