Skip to content
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

Merged
merged 8 commits into from
Sep 6, 2018

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Aug 30, 2018

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 into Tombstone, 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

  • Manual test (add detailed scripts or steps below)

@gregwebs
Copy link
Contributor

Previously this code would bury multiple stores, but now it will only bury one.

@rleungx
Copy link
Member Author

rleungx commented Aug 30, 2018

@gregwebs You're absolutely right. I didn't notice that before.

if c.storeIsEmpty(store.GetId()) {
err := c.BuryStore(store.GetId(), false)
offlineStore := store.Store
if c.storeIsEmpty(offlineStore.GetId()) {
Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rleungx @nolouch Any updates about this comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@disksing We have discussed about this and will use isPrepared here once #1225 is merged.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

if !store.IsLowSpace(cluster.GetLowSpaceRatio()) {
allStoresFull = false
}
upStoreCount++
Copy link
Contributor

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?

}
}

if offlineStores == nil {
Copy link
Contributor

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.

@rleungx
Copy link
Member Author

rleungx commented Sep 3, 2018

/rebuild

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 {
Copy link
Contributor

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)

@rleungx
Copy link
Member Author

rleungx commented Sep 6, 2018

PTAL. @disksing @nolouch

@rleungx rleungx merged commit 40062f8 into tikv:master Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show warning message when store cannot tombstone due to limited resource
4 participants