Skip to content

Record Force Merges in Live Commit Data #52694

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

Merged

Conversation

original-brownbear
Copy link
Contributor

Prerequisite of #52182. Record force merges in the live commit data
so two shard states with the same sequence number that differ only in whether
or not they have been force merged can be distinguished when creating snapshots.

Prerequesite of elastic#52182. Record force merges in the live commit data
so two shard states with the same sequence number that differ only in whether
or not they have been force merged can be distinguished when creating snapshots.
@original-brownbear original-brownbear added >non-issue :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. v8.0.0 v7.7.0 labels Feb 24, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (:Distributed/Engine)

@original-brownbear original-brownbear changed the title Record Force Merges in live commit data Record Force Merges in Live Commit Data Feb 24, 2020
@@ -53,20 +55,36 @@
private boolean onlyExpungeDeletes = Defaults.ONLY_EXPUNGE_DELETES;
private boolean flush = Defaults.FLUSH;

private static final Version FORCE_MERGE_UUID_VERSION = Version.V_8_0_0;

public static final String FORCE_MERGE_UUID_NA_VALUE = "_na_";
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 figured it's a nice thing to just used _na_ instead of null to keep the serialization BwC simple.

@original-brownbear
Copy link
Contributor Author

Thanks @dnhatn for pointing out the fact that we need to tie the uuid to the force merge request. I implemented that now including an integration test that proves that it works.

Let know what you think :)

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

LGTM with some smaller comments. Thanks Armin.

@original-brownbear
Copy link
Contributor Author

Thanks @dnhatn ! all addressed I think :)

@original-brownbear
Copy link
Contributor Author

@ywelsch are you good with this one as well? :)

Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

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

I've left one comment about null vs NA, o.w. looking good

commitData.put(Translog.TRANSLOG_UUID_KEY, translog.getTranslogUUID());
commitData.put(SequenceNumbers.LOCAL_CHECKPOINT_KEY, Long.toString(localCheckpoint));
commitData.put(SequenceNumbers.MAX_SEQ_NO, Long.toString(localCheckpointTracker.getMaxSeqNo()));
commitData.put(MAX_UNSAFE_AUTO_ID_TIMESTAMP_COMMIT_ID, Long.toString(maxUnsafeAutoIdTimestamp.get()));
commitData.put(HISTORY_UUID_KEY, historyUUID);
final String currentForceMergeUUID = forceMergeUUID;
if (currentForceMergeUUID != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we also check the NA value and not write it out in that case? Otherwise it will be up to all readers to do the right thing? I find the NA / null handling a bit confusing here, and wonder if we should just have one of these. My preference would be to have it Nullable everywhere, and not introduce another "null" value that is NA.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @ywelsch, that's a good point :) => went for nullable all the way in e842569 now

@original-brownbear
Copy link
Contributor Author

Jenkins run elasticsearch-ci/1
Jenkins run elasticsearch-ci/default-distro

(some random dep. download issue)

@@ -158,7 +167,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(onlyExpungeDeletes);
out.writeBoolean(flush);
if (out.getVersion().onOrAfter(FORCE_MERGE_UUID_VERSION)) {
out.writeString(forceMergeUUID);
out.writeString(forceMergeUUID == null ? FORCE_MERGE_UUID_NA_VALUE : forceMergeUUID);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would just use readOptionalString and writeOptionalString, no need for the extra FORCE_MERGE_UUID_NA_VALUE. It simplifies the code and no need for the extra value. Sending an extra byte on the wire does not hurt either.

@@ -558,6 +566,11 @@ public String getHistoryUUID() {
return historyUUID;
}

/** returns the force merge uuid for the engine */
Copy link
Contributor

Choose a reason for hiding this comment

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

@original-brownbear
Copy link
Contributor Author

Thanks Nhat + Yannick!

@original-brownbear original-brownbear merged commit 713e931 into elastic:master Mar 10, 2020
@original-brownbear original-brownbear deleted the record-force-merge-id branch March 10, 2020 21:00
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Mar 10, 2020
* Record Force Merges in live commit data

Prerequisite of elastic#52182. Record force merges in the live commit data
so two shard states with the same sequence number that differ only in whether
or not they have been force merged can be distinguished when creating snapshots.
original-brownbear added a commit that referenced this pull request Mar 11, 2020
* Record Force Merges in live commit data

Prerequisite of #52182. Record force merges in the live commit data
so two shard states with the same sequence number that differ only in whether
or not they have been force merged can be distinguished when creating snapshots.
@original-brownbear original-brownbear restored the record-force-merge-id branch August 6, 2020 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >non-issue v7.7.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants