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

Pass checkpoint to commit extra user data function #122930

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2925,7 +2925,7 @@ protected void commitIndexWriter(final IndexWriter writer, final Translog transl
* {@link IndexWriter#commit()} call flushes all documents, we defer computation of the maximum sequence number to the time
* of invocation of the commit data iterator (which occurs after all documents have been flushed to Lucene).
*/
final Map<String, String> extraCommitUserData = getCommitExtraUserData();
final Map<String, String> extraCommitUserData = getCommitExtraUserData(localCheckpoint);
final Map<String, String> commitData = Maps.newMapWithExpectedSize(8 + extraCommitUserData.size());
commitData.putAll(extraCommitUserData);
commitData.put(Translog.TRANSLOG_UUID_KEY, translog.getTranslogUUID());
Expand Down Expand Up @@ -2973,8 +2973,10 @@ protected void commitIndexWriter(final IndexWriter writer, final Translog transl
/**
* Allows InternalEngine extenders to return custom key-value pairs which will be included in the Lucene commit user-data. Custom user
* data keys can be overwritten by if their keys conflict keys used by InternalEngine.
*
* @param localCheckpoint the local checkpoint of the commit
*/
protected Map<String, String> getCommitExtraUserData() {
protected Map<String, String> getCommitExtraUserData(final long localCheckpoint) {
return Collections.emptyMap();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7327,7 +7327,7 @@ public void testExtraUserDataIsCommitted() throws IOException {
engine.close();
engine = new InternalEngine(engine.config()) {
@Override
protected Map<String, String> getCommitExtraUserData() {
protected Map<String, String> getCommitExtraUserData(final long localCheckpoint) {
return Map.of("userkey", "userdata", ES_VERSION, IndexVersions.ZERO.toString());
}
};
Expand Down