-
Notifications
You must be signed in to change notification settings - Fork 727
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
server: store cannot turn into tombstone due to limited resources #1227
Conversation
Previously this code would bury multiple stores, but now it will only bury one. |
@gregwebs You're absolutely right. I didn't notice that before. |
server/cluster.go
Outdated
if c.storeIsEmpty(store.GetId()) { | ||
err := c.BuryStore(store.GetId(), false) | ||
offlineStore := store.Store | ||
if c.storeIsEmpty(offlineStore.GetId()) { |
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.
storeIsEmpty
need to dump all regions. Can we improve it?
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.
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.
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.
Got it.
server/cluster.go
Outdated
if !store.IsLowSpace(cluster.GetLowSpaceRatio()) { | ||
allStoresFull = false | ||
} | ||
upStoreCount++ |
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.
will count the Tombstone
store as up store?
server/cluster.go
Outdated
} | ||
} | ||
|
||
if offlineStores == nil { |
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.
It is a good habit to use len(offlineStores) == 0
instead, compare slice to nil could lead to unexpected result in some cases.
/rebuild |
9eeecba
to
7398c8d
Compare
server/cluster.go
Outdated
err := c.BuryStore(store.GetId(), false) | ||
offlineStore := store.Store | ||
// If the store is empty, it can be buried. | ||
if cluster.isPrepared() && cluster.getStoreRegionCount(offlineStore.GetId()) == 0 { |
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.
Do we really need to check isPrepared()
here? I've noticed that after #1225 all regions will be put to RegionsInfo
on startup (regardless of whether the leader is nil)
dde37fd
to
1d1fe34
Compare
What problem does this PR solve?
This PR closes #1221.
What is changed and how it works?
When setting a store to
Offline
, it won't turn intoTombstone
, if there are no extra space or nodes to accommodate the extra replicas. This PR will show warning message to let user know about it.Check List
Tests