domain: report min start timestamp of TiDB server#12133
domain: report min start timestamp of TiDB server#12133sre-bot merged 8 commits intopingcap:masterfrom
Conversation
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #12133 +/- ##
=========================================
Coverage 81.428% 81.428%
=========================================
Files 454 454
Lines 100000 100000
=========================================
Hits 81428 81428
Misses 12805 12805
Partials 5767 5767 |
| } | ||
| return util.PutKVToEtcd(ctx, is.etcdCli, keyOpDefaultRetryCnt, is.minStartTSPath, | ||
| strconv.FormatUint(is.minStartTS, 10), | ||
| clientv3.WithLease(is.session.Lease())) |
There was a problem hiding this comment.
Does all TiDB servers updates the same key in etcd? If so, how do TiDB servers know whether there's another TiDB server who has a smaller minStartTs?
| } | ||
| pl := is.manager.ShowProcessList() | ||
| var minStartTS uint64 = math.MaxUint64 | ||
| for _, info := range pl { |
There was a problem hiding this comment.
Report max uint64 to PD.
|
If a tidb-server is killed -9, how long will the minStartTS be kept in PD? |
1 min. It used the same TTL as server info, Line 221 in fbc6a84 |
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
|
PTAL @coocood |
|
LGTM |
| etcdCli *clientv3.Client | ||
| info *ServerInfo | ||
| serverInfoPath string | ||
| minStartTS uint64 |
There was a problem hiding this comment.
It seems that we don't need this field.
There was a problem hiding this comment.
It will be used by the next PR.
|
/run-all-tests |
|
@jackysp merge failed. |
|
/merge |
|
/run-all-tests |
What problem does this PR solve?
The server current min start timestamp could be reported to PD, it may be used to calculate a more reasonable safe point for GC.
What is changed and how it works?
Report min start timestamp to PD.
Check List
Tests
ETCDCTL_API=3 ./etcdctl --endpoints="http://172.16.5.34:2380" get / --prefixgets the key/tidb/server/minstartts/xxxCode changes