asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject incubator-asterixdb git commit: AsterixDB changes for: 1. fix "writerCount!=0" issue 2. protect deactivate/activate call of an index by its opTracker.
Date Fri, 29 May 2015 01:53:34 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master b9611bb9a -> be562c238


AsterixDB changes for:
1. fix "writerCount!=0" issue
2. protect deactivate/activate call of an index by its opTracker.

Note that this change includes https://asterix-gerrit.ics.uci.edu/#/c/269/.

Change-Id: I4669d49fd1cf9b058f7e0da233ad45c6c78b5797
Reviewed-on: https://asterix-gerrit.ics.uci.edu/279
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <hubailmor@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/be562c23
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/be562c23
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/be562c23

Branch: refs/heads/master
Commit: be562c23848aedc0d5dbd85be1a7475e06d62516
Parents: b9611bb
Author: Yingyi Bu <buyingyi@gmail.com>
Authored: Thu May 28 12:47:08 2015 -0700
Committer: Murtadha Hubail <hubailmor@gmail.com>
Committed: Thu May 28 15:03:33 2015 -0700

----------------------------------------------------------------------
 .../common/context/DatasetLifecycleManager.java | 15 +++++++++++---
 .../context/PrimaryIndexOperationTracker.java   | 21 ++++++++++++--------
 2 files changed, 25 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/be562c23/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/DatasetLifecycleManager.java
----------------------------------------------------------------------
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/DatasetLifecycleManager.java
b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/DatasetLifecycleManager.java
index 9a91289..8476174 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/DatasetLifecycleManager.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/DatasetLifecycleManager.java
@@ -145,7 +145,10 @@ public class DatasetLifecycleManager implements IIndexLifecycleManager,
ILifeCyc
         flushAndWaitForIO(dsInfo, iInfo);
 
         if (iInfo.isOpen) {
-            iInfo.index.deactivate(false);
+            ILSMOperationTracker indexOpTracker = iInfo.index.getOperationTracker();
+            synchronized (indexOpTracker) {
+                iInfo.index.deactivate(false);
+            }
         }
 
         dsInfo.indexes.remove(resourceID);
@@ -195,7 +198,10 @@ public class DatasetLifecycleManager implements IIndexLifecycleManager,
ILifeCyc
         dsInfo.isOpen = true;
         dsInfo.touch();
         if (!iInfo.isOpen) {
-            iInfo.index.activate();
+            ILSMOperationTracker opTracker = iInfo.index.getOperationTracker();
+            synchronized (opTracker) {
+                iInfo.index.activate();
+            }
             iInfo.isOpen = true;
         }
         iInfo.touch();
@@ -530,7 +536,10 @@ public class DatasetLifecycleManager implements IIndexLifecycleManager,
ILifeCyc
 
         for (IndexInfo iInfo : dsInfo.indexes.values()) {
             if (iInfo.isOpen) {
-                iInfo.index.deactivate(false);
+                ILSMOperationTracker opTracker = iInfo.index.getOperationTracker();
+                synchronized (opTracker) {
+                    iInfo.index.deactivate(false);
+                }
                 iInfo.isOpen = false;
             }
             assert iInfo.referenceCount == 0;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/be562c23/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/PrimaryIndexOperationTracker.java
----------------------------------------------------------------------
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/PrimaryIndexOperationTracker.java
b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/PrimaryIndexOperationTracker.java
index 7a56600..67a61a8 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/PrimaryIndexOperationTracker.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/PrimaryIndexOperationTracker.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,6 +32,7 @@ import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMComponent.ComponentStat
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndex;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndexAccessor;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndexInternal;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMOperationTracker;
 import edu.uci.ics.hyracks.storage.am.lsm.common.impls.AbstractLSMIndex;
 import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMOperationType;
 
@@ -72,7 +73,7 @@ public class PrimaryIndexOperationTracker extends BaseOperationTracker {
     @Override
     public synchronized void completeOperation(ILSMIndex index, LSMOperationType opType,
             ISearchOperationCallback searchCallback, IModificationOperationCallback modificationCallback)
-            throws HyracksDataException {
+                    throws HyracksDataException {
         if (opType == LSMOperationType.MODIFICATION || opType == LSMOperationType.FORCE_MODIFICATION)
{
             decrementNumActiveOperations(modificationCallback);
             if (numActiveOperations.get() == 0) {
@@ -86,7 +87,7 @@ public class PrimaryIndexOperationTracker extends BaseOperationTracker {
     }
 
     public void flushIfRequested() throws HyracksDataException {
-        // If we need a flush, and this is the last completing operation, then schedule the
flush,  
+        // If we need a flush, and this is the last completing operation, then schedule the
flush,
         // or if there is a flush scheduled by the checkpoint (flushOnExit), then schedule
it
 
         boolean needsFlush = false;
@@ -105,8 +106,12 @@ public class PrimaryIndexOperationTracker extends BaseOperationTracker
{
         if (needsFlush || flushOnExit) {
             //Make the current mutable components READABLE_UNWRITABLE to stop coming modify
operations from entering them until the current flush is schedule.
             for (ILSMIndex lsmIndex : indexes) {
-                if (((AbstractLSMIndex) lsmIndex).getCurrentMutableComponentState() == ComponentState.READABLE_WRITABLE)
{
-                    ((AbstractLSMIndex) lsmIndex).setCurrentMutableComponentState(ComponentState.READABLE_UNWRITABLE);
+                AbstractLSMIndex abstractLSMIndex = ((AbstractLSMIndex) lsmIndex);
+                ILSMOperationTracker opTracker = abstractLSMIndex.getOperationTracker();
+                synchronized (opTracker) {
+                    if (abstractLSMIndex.getCurrentMutableComponentState() == ComponentState.READABLE_WRITABLE)
{
+                        abstractLSMIndex.setCurrentMutableComponentState(ComponentState.READABLE_UNWRITABLE);
+                    }
                 }
             }
 
@@ -155,7 +160,7 @@ public class PrimaryIndexOperationTracker extends BaseOperationTracker
{
     }
 
     private void incrementNumActiveOperations(IModificationOperationCallback modificationCallback)
{
-        //modificationCallback can be NoOpOperationCallback when redo/undo operations are
executed. 
+        //modificationCallback can be NoOpOperationCallback when redo/undo operations are
executed.
         if (modificationCallback != NoOpOperationCallback.INSTANCE) {
             numActiveOperations.incrementAndGet();
             ((AbstractOperationCallback) modificationCallback).incrementLocalNumActiveOperations();
@@ -188,4 +193,4 @@ public class PrimaryIndexOperationTracker extends BaseOperationTracker
{
         return flushLogCreated;
     }
 
-}
\ No newline at end of file
+}


Mime
View raw message