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

Update global checkpoint when increasing primary term on replica #25422

Conversation

ywelsch
Copy link
Contributor

@ywelsch ywelsch commented Jun 27, 2017

When a replica shard increases its primary term under the mandate of a new primary, it should also update its global checkpoint; this gives us the guarantee that its global checkpoint is at least as high as the new primary and gives a starting point for the primary/replica resync.

Relates to #25355, #10708

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

I left a question and one comment.

@@ -2072,6 +2084,13 @@ public void onResponse(final Releasable releasable) {
primaryTerm);
onPermitAcquired.onFailure(new IllegalStateException(message));
} else {
try {
updateGlobalCheckpointOnReplica(globalCheckpoint);
Copy link
Member

Choose a reason for hiding this comment

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

Is it worth skipping this update if the update on term increase was successful?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found it easier to just do the "double"-update than introducing a boolean. Do you have a preference?

@@ -354,7 +354,7 @@ public String toString() {
private void ensureRefCount() {
if (refCount() <= 0) {
throw new ElasticsearchException("RecoveryStatus is used but it's refcount is 0. Probably a mismatch between incRef/decRef " +
"calls");
"calls");
Copy link
Member

Choose a reason for hiding this comment

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

All changes in this file look cosmetic, can they be reverted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

LGTM.

@elastic elastic deleted a comment from dengm129 Jun 28, 2017
@ywelsch ywelsch merged commit 8ae61c0 into elastic:master Jun 28, 2017
@ywelsch
Copy link
Contributor Author

ywelsch commented Jun 28, 2017

Thanks @jasontedor

jasontedor added a commit to ywelsch/elasticsearch that referenced this pull request Jun 28, 2017
* master:
  Do not swallow exception when relocating
  Docs: Fix typo for request cache (elastic#25444)
  Remove implicit 32-bit support
  [DOCS] reworded to prevent code span rendering glitch (elastic#25442)
  Disallow multiple concurrent recovery attempts for same target shard (elastic#25428)
  Update global checkpoint when increasing primary term on replica (elastic#25422)
  Add backwards compatibility indices for 5.4.3
  Add version 5.4.3 after release
  Update MSI installer images (elastic#25414)
  Add missing newline at end of SetsTests.java
  Rename handoff primary context transport handler
  correct expected thrown exception in mappingMetaData to ElasticsearchParseException (elastic#25410)
  test: Make many percolator integration tests real integration tests
  [DOCS] Update docs to use shared attribute file (elastic#25403)
  Add Javadocs and tests for set difference methods
  Tests: Add parsing test for AggregationsTests (elastic#25396)
  test: get upgrade status for all indices
  Mute SignificantTermsAggregatorTests#testSignificance()
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Jun 28, 2017
…cal-checkpoint

* enhance/single-updateshardstate-method:
  Some cleanup
  Do not swallow exception when relocating
  Docs: Fix typo for request cache (elastic#25444)
  Remove implicit 32-bit support
  [DOCS] reworded to prevent code span rendering glitch (elastic#25442)
  Disallow multiple concurrent recovery attempts for same target shard (elastic#25428)
  Update global checkpoint when increasing primary term on replica (elastic#25422)
  Add backwards compatibility indices for 5.4.3
  Add version 5.4.3 after release
  Update MSI installer images (elastic#25414)
  Add missing newline at end of SetsTests.java
  fix test
  Rename handoff primary context transport handler
  Provide single IndexShard method to update state on incoming cluster state
@clintongormley clintongormley added :Distributed/Engine Anything around managing Lucene and the Translog in an open shard. and removed :Sequence IDs labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Engine Anything around managing Lucene and the Translog in an open shard. >enhancement v6.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants