mirror of https://github.com/apache/activemq.git
Suspend/Resume index compactions instead of closing out the index.
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1480710 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3ef7911a1d
commit
d98ac90f28
|
@ -835,22 +835,28 @@ class LevelDBClient(store: LevelDBStore) {
|
||||||
writeExecutor = null
|
writeExecutor = null
|
||||||
|
|
||||||
// this blocks until all io completes..
|
// this blocks until all io completes..
|
||||||
// Suspend also deletes the index.
|
snapshotRwLock.writeLock().lock()
|
||||||
if( index!=null ) {
|
try {
|
||||||
suspend()
|
// Suspend also deletes the index.
|
||||||
index = null
|
if( index!=null ) {
|
||||||
|
storeCounters
|
||||||
|
index.put(DIRTY_INDEX_KEY, FALSE, new WriteOptions().sync(true))
|
||||||
|
index.close
|
||||||
|
index = null
|
||||||
|
}
|
||||||
|
if (log.isOpen) {
|
||||||
|
log.close
|
||||||
|
copyDirtyIndexToSnapshot
|
||||||
|
wal_append_position = log.appender_limit
|
||||||
|
log = null
|
||||||
|
}
|
||||||
|
if( plist!=null ) {
|
||||||
|
plist.close
|
||||||
|
plist=null
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
snapshotRwLock.writeLock().unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log.isOpen) {
|
|
||||||
log.close
|
|
||||||
copyDirtyIndexToSnapshot
|
|
||||||
wal_append_position = log.appender_limit
|
|
||||||
}
|
|
||||||
if( plist!=null ) {
|
|
||||||
plist.close
|
|
||||||
plist=null
|
|
||||||
}
|
|
||||||
log = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -875,10 +881,10 @@ class LevelDBClient(store: LevelDBStore) {
|
||||||
// we will be closing it to create a consistent snapshot.
|
// we will be closing it to create a consistent snapshot.
|
||||||
snapshotRwLock.writeLock().lock()
|
snapshotRwLock.writeLock().lock()
|
||||||
|
|
||||||
// Close the index so that it's files are not changed async on us.
|
|
||||||
storeCounters
|
storeCounters
|
||||||
index.put(DIRTY_INDEX_KEY, FALSE, new WriteOptions().sync(true))
|
index.put(DIRTY_INDEX_KEY, FALSE, new WriteOptions().sync(true))
|
||||||
index.close
|
// Suspend the index so that it's files are not changed async on us.
|
||||||
|
index.db.suspendCompactions()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -887,10 +893,7 @@ class LevelDBClient(store: LevelDBStore) {
|
||||||
*/
|
*/
|
||||||
def resume() = {
|
def resume() = {
|
||||||
// re=open it..
|
// re=open it..
|
||||||
retry {
|
index.db.resumeCompactions()
|
||||||
index = new RichDB(factory.open(dirtyIndexFile, indexOptions));
|
|
||||||
index.put(DIRTY_INDEX_KEY, TRUE)
|
|
||||||
}
|
|
||||||
snapshotRwLock.writeLock().unlock()
|
snapshotRwLock.writeLock().unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue