Merge pull request #10993 from kimchy/sync_interval_not_to_control_type
Use buffered tanslog type also when sync is set to 0
This commit is contained in:
commit
b4b5603617
|
@ -152,10 +152,10 @@ public class Translog extends AbstractIndexShardComponent implements IndexShardC
|
||||||
|
|
||||||
syncInterval = indexSettings.getAsTime(INDEX_TRANSLOG_SYNC_INTERVAL, TimeValue.timeValueSeconds(5));
|
syncInterval = indexSettings.getAsTime(INDEX_TRANSLOG_SYNC_INTERVAL, TimeValue.timeValueSeconds(5));
|
||||||
if (syncInterval.millis() > 0 && threadPool != null) {
|
if (syncInterval.millis() > 0 && threadPool != null) {
|
||||||
syncOnEachOperation(false);
|
this.syncOnEachOperation = false;
|
||||||
syncScheduler = threadPool.schedule(syncInterval, ThreadPool.Names.SAME, new Sync());
|
syncScheduler = threadPool.schedule(syncInterval, ThreadPool.Names.SAME, new Sync());
|
||||||
} else if (syncInterval.millis() == 0) {
|
} else if (syncInterval.millis() == 0) {
|
||||||
syncOnEachOperation(true);
|
this.syncOnEachOperation = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indexSettingsService != null) {
|
if (indexSettingsService != null) {
|
||||||
|
@ -507,15 +507,6 @@ public class Translog extends AbstractIndexShardComponent implements IndexShardC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void syncOnEachOperation(boolean syncOnEachOperation) {
|
|
||||||
this.syncOnEachOperation = syncOnEachOperation;
|
|
||||||
if (syncOnEachOperation) {
|
|
||||||
type = TranslogFile.Type.SIMPLE;
|
|
||||||
} else {
|
|
||||||
type = TranslogFile.Type.BUFFERED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** package private for testing */
|
/** package private for testing */
|
||||||
String getFilename(long translogId) {
|
String getFilename(long translogId) {
|
||||||
return TRANSLOG_FILE_PREFIX + translogId;
|
return TRANSLOG_FILE_PREFIX + translogId;
|
||||||
|
|
Loading…
Reference in New Issue