mirror of https://github.com/apache/activemq.git
Fixes AMQ-5115: LevelDB sync=true is not being honored.
This commit is contained in:
parent
2ccc349542
commit
db321727c9
|
@ -76,8 +76,6 @@ case class RecordLog(directory: File, logSuffix:String) {
|
||||||
var logSize = 1024 * 1024 * 100L
|
var logSize = 1024 * 1024 * 100L
|
||||||
var current_appender:LogAppender = _
|
var current_appender:LogAppender = _
|
||||||
var verify_checksums = false
|
var verify_checksums = false
|
||||||
var sync = false
|
|
||||||
|
|
||||||
val log_infos = new TreeMap[Long, LogInfo]()
|
val log_infos = new TreeMap[Long, LogInfo]()
|
||||||
|
|
||||||
object log_mutex
|
object log_mutex
|
||||||
|
@ -130,20 +128,16 @@ case class RecordLog(directory: File, logSuffix:String) {
|
||||||
channel.position(logSize-1)
|
channel.position(logSize-1)
|
||||||
channel.write(new Buffer(1).toByteBuffer)
|
channel.write(new Buffer(1).toByteBuffer)
|
||||||
channel.force(true)
|
channel.force(true)
|
||||||
if( sync ) {
|
channel.position(0)
|
||||||
channel.position(0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val write_buffer = new DataByteArrayOutputStream(BUFFER_SIZE+LOG_HEADER_SIZE)
|
val write_buffer = new DataByteArrayOutputStream(BUFFER_SIZE+LOG_HEADER_SIZE)
|
||||||
|
|
||||||
def force = {
|
def force = {
|
||||||
flush
|
flush
|
||||||
if(sync) {
|
max_log_flush_latency {
|
||||||
max_log_flush_latency {
|
// only need to update the file metadata if the file size changes..
|
||||||
// only need to update the file metadata if the file size changes..
|
channel.force(append_offset > logSize)
|
||||||
channel.force(append_offset > logSize)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,6 +345,7 @@ class MasterLevelDBStore extends LevelDBStore with ReplicatedLevelDBStoreTrait {
|
||||||
val value = new LogWrite
|
val value = new LogWrite
|
||||||
value.file = position;
|
value.file = position;
|
||||||
value.offset = offset;
|
value.offset = offset;
|
||||||
|
value.sync = (syncToMask & SYNC_TO_REMOTE_DISK)!=0
|
||||||
value.length = fileTransferFrame.length
|
value.length = fileTransferFrame.length
|
||||||
value.date = date
|
value.date = date
|
||||||
encoded = JsonCodec.encode(value)
|
encoded = JsonCodec.encode(value)
|
||||||
|
|
Loading…
Reference in New Issue