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 current_appender:LogAppender = _
|
||||
var verify_checksums = false
|
||||
var sync = false
|
||||
|
||||
val log_infos = new TreeMap[Long, LogInfo]()
|
||||
|
||||
object log_mutex
|
||||
|
@ -130,22 +128,18 @@ case class RecordLog(directory: File, logSuffix:String) {
|
|||
channel.position(logSize-1)
|
||||
channel.write(new Buffer(1).toByteBuffer)
|
||||
channel.force(true)
|
||||
if( sync ) {
|
||||
channel.position(0)
|
||||
}
|
||||
}
|
||||
|
||||
val write_buffer = new DataByteArrayOutputStream(BUFFER_SIZE+LOG_HEADER_SIZE)
|
||||
|
||||
def force = {
|
||||
flush
|
||||
if(sync) {
|
||||
max_log_flush_latency {
|
||||
// only need to update the file metadata if the file size changes..
|
||||
channel.force(append_offset > logSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def skip(length:Long) = this.synchronized {
|
||||
flush
|
||||
|
|
|
@ -345,6 +345,7 @@ class MasterLevelDBStore extends LevelDBStore with ReplicatedLevelDBStoreTrait {
|
|||
val value = new LogWrite
|
||||
value.file = position;
|
||||
value.offset = offset;
|
||||
value.sync = (syncToMask & SYNC_TO_REMOTE_DISK)!=0
|
||||
value.length = fileTransferFrame.length
|
||||
value.date = date
|
||||
encoded = JsonCodec.encode(value)
|
||||
|
|
Loading…
Reference in New Issue