mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-21 22:00:36 -04:00
Pass checkpoint to commit extra user data function (#122930)
Relates ES-10852
This commit is contained in:
parent
04422cdc7f
commit
ad220c1abb
2 changed files with 5 additions and 3 deletions
|
@ -2925,7 +2925,7 @@ public class InternalEngine extends Engine {
|
|||
* {@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());
|
||||
|
@ -2973,8 +2973,10 @@ public class InternalEngine extends Engine {
|
|||
/**
|
||||
* 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();
|
||||
}
|
||||
|
||||
|
|
|
@ -7327,7 +7327,7 @@ public class InternalEngineTests extends EngineTestCase {
|
|||
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());
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue