-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
api: support to query whether pd has loaded region #8749
base: master
Are you sure you want to change the base?
Changes from 7 commits
c20a4f9
db574ec
64f12cc
0c50bef
9c9e931
bc7428b
df4ac32
d0d6875
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ package api | |
import ( | ||
"net/http" | ||
|
||
"github.com/tikv/pd/pkg/storage" | ||
"github.com/tikv/pd/pkg/versioninfo" | ||
"github.com/tikv/pd/server" | ||
"github.com/unrolled/render" | ||
|
@@ -44,6 +45,7 @@ func (h *statusHandler) GetPDStatus(w http.ResponseWriter, _ *http.Request) { | |
GitHash: versioninfo.PDGitHash, | ||
Version: versioninfo.PDReleaseVersion, | ||
StartTimestamp: h.svr.StartTimestamp(), | ||
RegionLoaded: storage.AreRegionsLoaded(h.svr.GetStorage()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we have a more general field here like "Ready" which we can extend in the future if we find more conditions under which PD can't serve? Does PDStatus API exposed by all components of disaggregated PD? Any chance we introduce a new API /ready which we can use across all TiDB components in the future? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi Tema, thanks for your advice There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally you want to decouple data plane (pd) from control plane (tidb-operator, tiUp), so that if you make changes to one, you don't have to upgrade other and it can start leveraging any improvements right away. That is why usually the common convention is to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PTAL @csuzhangxc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with Tema, for TiDB Operator, it's better to use a general API (like For this RegionLoaded case, in fact, TiDB Operator just wants to know when it can restart the next instance safely. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @niubell can we land this one and open a separate task for a more general /ready endpoint? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
h.rd.JSON(w, http.StatusOK, version) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use bool?