s/MapBuilder/singletonMap in InternalEngine
This commit is contained in:
parent
0a072f6fd0
commit
31db8cca4e
|
@ -297,12 +297,12 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
|
||||||
translogIdGenerator.set(Long.parseLong(commitUserData.get(Translog.TRANSLOG_ID_KEY)));
|
translogIdGenerator.set(Long.parseLong(commitUserData.get(Translog.TRANSLOG_ID_KEY)));
|
||||||
} else {
|
} else {
|
||||||
translogIdGenerator.set(System.currentTimeMillis());
|
translogIdGenerator.set(System.currentTimeMillis());
|
||||||
indexWriter.setCommitData(MapBuilder.<String, String>newMapBuilder().put(Translog.TRANSLOG_ID_KEY, Long.toString(translogIdGenerator.get())).map());
|
indexWriter.setCommitData(Collections.singletonMap(Translog.TRANSLOG_ID_KEY, Long.toString(translogIdGenerator.get())));
|
||||||
indexWriter.commit();
|
indexWriter.commit();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
translogIdGenerator.set(System.currentTimeMillis());
|
translogIdGenerator.set(System.currentTimeMillis());
|
||||||
indexWriter.setCommitData(MapBuilder.<String, String>newMapBuilder().put(Translog.TRANSLOG_ID_KEY, Long.toString(translogIdGenerator.get())).map());
|
indexWriter.setCommitData(Collections.singletonMap(Translog.TRANSLOG_ID_KEY, Long.toString(translogIdGenerator.get())));
|
||||||
indexWriter.commit();
|
indexWriter.commit();
|
||||||
}
|
}
|
||||||
translog.newTranslog(translogIdGenerator.get());
|
translog.newTranslog(translogIdGenerator.get());
|
||||||
|
@ -840,7 +840,7 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
|
||||||
try {
|
try {
|
||||||
{ // commit and close the current writer - we write the current tanslog ID just in case
|
{ // commit and close the current writer - we write the current tanslog ID just in case
|
||||||
final long translogId = translog.currentId();
|
final long translogId = translog.currentId();
|
||||||
indexWriter.setCommitData(MapBuilder.<String, String>newMapBuilder().put(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)).map());
|
indexWriter.setCommitData(Collections.singletonMap(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)));
|
||||||
indexWriter.commit();
|
indexWriter.commit();
|
||||||
indexWriter.rollback();
|
indexWriter.rollback();
|
||||||
}
|
}
|
||||||
|
@ -854,7 +854,7 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
|
||||||
if (flushNeeded || flush.force()) {
|
if (flushNeeded || flush.force()) {
|
||||||
flushNeeded = false;
|
flushNeeded = false;
|
||||||
long translogId = translogIdGenerator.incrementAndGet();
|
long translogId = translogIdGenerator.incrementAndGet();
|
||||||
indexWriter.setCommitData(MapBuilder.<String, String>newMapBuilder().put(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)).map());
|
indexWriter.setCommitData(Collections.singletonMap(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)));
|
||||||
indexWriter.commit();
|
indexWriter.commit();
|
||||||
translog.newTranslog(translogId);
|
translog.newTranslog(translogId);
|
||||||
}
|
}
|
||||||
|
@ -887,7 +887,7 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
|
||||||
try {
|
try {
|
||||||
long translogId = translogIdGenerator.incrementAndGet();
|
long translogId = translogIdGenerator.incrementAndGet();
|
||||||
translog.newTransientTranslog(translogId);
|
translog.newTransientTranslog(translogId);
|
||||||
indexWriter.setCommitData(MapBuilder.<String, String>newMapBuilder().put(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)).map());
|
indexWriter.setCommitData(Collections.singletonMap(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)));
|
||||||
indexWriter.commit();
|
indexWriter.commit();
|
||||||
// we need to refresh in order to clear older version values
|
// we need to refresh in order to clear older version values
|
||||||
refresh(new Refresh("version_table_flush").force(true));
|
refresh(new Refresh("version_table_flush").force(true));
|
||||||
|
@ -920,7 +920,7 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
|
||||||
// other flushes use flushLock
|
// other flushes use flushLock
|
||||||
try {
|
try {
|
||||||
long translogId = translog.currentId();
|
long translogId = translog.currentId();
|
||||||
indexWriter.setCommitData(MapBuilder.<String, String>newMapBuilder().put(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)).map());
|
indexWriter.setCommitData(Collections.singletonMap(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)));
|
||||||
indexWriter.commit();
|
indexWriter.commit();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
throw new FlushFailedEngineException(shardId, e);
|
throw new FlushFailedEngineException(shardId, e);
|
||||||
|
|
Loading…
Reference in New Issue