The Concept of Observer in TiKV/TiFlash

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

Original topic: tikv/tiflash 中 observer 的概念

| username: ShawnYan

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Encountered Issues]

Could the experts in the forum please explain the concept of observer in tikv/tiflash? Under what circumstances is it introduced?
There is little documentation on this, only mentioned in a few articles.

[Reproduction Path] What operations were performed that led to the issue
[Issue Phenomenon and Impact]

[Attachments]

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: 张雨齐0720 | Original post link

Take a look at this article?

| username: ShawnYan | Original post link

Sure, here is one of the articles, and here’s another one:

| username: h5n1 | Original post link

Observer at first glance, I thought it was ob
An Observer for CDC. It observes raftstore internal events, such as: 1. Raft role change events, 2. Apply command events. Subscribe to a region, the observer

| username: TiDBer_CEVsub | Original post link

The thing is good, but it’s a bit complicated.

| username: 张雨齐0720 | Original post link

The same, thought it was OB.

| username: AnotherCalvinNeo | Original post link

Observer can be simply understood as a hook, which can be found in components/raftstore/src/coprocessor. It is different from another coprocessor that performs pushdown, so it is generally called an observer.