@@ -16,7 +16,9 @@ package api
1616
1717import (
1818 "net/http"
19+ "strconv"
1920
21+ "github.com/gorilla/mux"
2022 "github.com/tikv/pd/pkg/typeutil"
2123 "github.com/tikv/pd/server"
2224 "github.com/unrolled/render"
@@ -41,6 +43,30 @@ type minResolvedTS struct {
4143 PersistInterval typeutil.Duration `json:"persist_interval,omitempty"`
4244}
4345
46+ // @Tags min_store_resolved_ts
47+ // @Summary Get store-level min resolved ts.
48+ // @Produce json
49+ // @Success 200 {array} minResolvedTS
50+ // @Failure 400 {string} string "The input is invalid."
51+ // @Failure 500 {string} string "PD server failed to proceed the request."
52+ // @Router /min-resolved-ts/{store_id} [get]
53+ func (h * minResolvedTSHandler ) GetStoreMinResolvedTS (w http.ResponseWriter , r * http.Request ) {
54+ c := h .svr .GetRaftCluster ()
55+ idStr := mux .Vars (r )["store_id" ]
56+ storeID , err := strconv .ParseUint (idStr , 10 , 64 )
57+ if err != nil {
58+ h .rd .JSON (w , http .StatusBadRequest , err .Error ())
59+ return
60+ }
61+ value := c .GetStoreMinResolvedTS (storeID )
62+ persistInterval := c .GetPDServerConfig ().MinResolvedTSPersistenceInterval
63+ h .rd .JSON (w , http .StatusOK , minResolvedTS {
64+ MinResolvedTS : value ,
65+ PersistInterval : persistInterval ,
66+ IsRealTime : persistInterval .Duration != 0 ,
67+ })
68+ }
69+
4470// @Tags min_resolved_ts
4571// @Summary Get cluster-level min resolved ts.
4672// @Produce json
0 commit comments