mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 18:35:25 +00:00
[ENGINE] Add current translog ID to commit meta before closing
Today we simply close the IW when we have to open a new one if ie. we change merge settings. Yet, the API is deprecated and under the hood it commits the IW. For safety we should add the current translog ID and use rollback instead to not wait for merges.
This commit is contained in:
parent
006acfe8bf
commit
0a072f6fd0
@ -838,10 +838,12 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
|
|||||||
// disable refreshing, not dirty
|
// disable refreshing, not dirty
|
||||||
dirty = false;
|
dirty = false;
|
||||||
try {
|
try {
|
||||||
// that's ok if the index writer failed and is in inconsistent state
|
{ // commit and close the current writer - we write the current tanslog ID just in case
|
||||||
// we will get an exception on a dirty operation, and will cause the shard
|
final long translogId = translog.currentId();
|
||||||
// to be allocated to a different node
|
indexWriter.setCommitData(MapBuilder.<String, String>newMapBuilder().put(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)).map());
|
||||||
currentIndexWriter().close(false);
|
indexWriter.commit();
|
||||||
|
indexWriter.rollback();
|
||||||
|
}
|
||||||
indexWriter = createWriter();
|
indexWriter = createWriter();
|
||||||
mergeScheduler.removeListener(this.throttle);
|
mergeScheduler.removeListener(this.throttle);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user