commit | e0f4e1e4653de2990ff00edc7145fc7076f8e117 | [log] [tgz] |
---|---|---|
author | alexander.behm <alexander.behm@123451ca-8445-de46-9d55-352943316053> | Sat Jan 28 19:17:47 2012 +0000 |
committer | alexander.behm <alexander.behm@123451ca-8445-de46-9d55-352943316053> | Sat Jan 28 19:17:47 2012 +0000 |
tree | a54fe1415a7412daaae161de9355a4f2c5193ed2 | |
parent | 184f71f7bac5e28629b82f6c108990463e01fe27 [diff] |
Fixed a concurrency bug in the LSMBTree that allowed more than one concurrent merge (needed to use isMerging CAS properly). git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1086 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java index 8266387..1881d2f 100644 --- a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java +++ b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java
@@ -443,10 +443,9 @@ if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("Merging LSM-BTree."); } - if (isMerging.get()) { + if (!isMerging.compareAndSet(false, true)) { throw new TreeIndexException("Merge already in progress in LSMBTree. Only one concurrent merge allowed."); } - isMerging.set(true); // Point to the current searcher ref count, so we can wait for it later // (after we swap the searcher ref count).