phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeffr...@apache.org
Subject git commit: PHOENIX-1173: MutableIndexFailureIT.java doesn't finish sometimes or is flappy.
Date Fri, 15 Aug 2014 23:04:54 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.0 5aa381516 -> 80a3c4806


PHOENIX-1173: MutableIndexFailureIT.java doesn't finish sometimes or is flappy.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/80a3c480
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/80a3c480
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/80a3c480

Branch: refs/heads/4.0
Commit: 80a3c4806534594e94fdc204b37a7103a7eb787e
Parents: 5aa3815
Author: Jeffrey Zhong <jeffreyz@apache.org>
Authored: Fri Aug 15 14:02:51 2014 -0700
Committer: Jeffrey Zhong <jeffreyz@apache.org>
Committed: Fri Aug 15 14:50:29 2014 -0700

----------------------------------------------------------------------
 .../apache/phoenix/coprocessor/MetaDataEndpointImpl.java    | 2 ++
 .../apache/phoenix/coprocessor/MetaDataRegionObserver.java  | 9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/80a3c480/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index b99483b..5b43a90 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -1508,6 +1508,8 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements
Coprocesso
                         dataTableKey = SchemaUtil.getTableKey(tenantId, schemaName, dataTableKV.getValue());
                     }
                     if(dataTableKey != null) {
+                        // make a copy of tableMetadata
+                        tableMetadata = new ArrayList<Mutation>(tableMetadata);
                         // insert an empty KV to trigger time stamp update on data table
row
                         Put p = new Put(dataTableKey);
                         p.add(TABLE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, timeStamp,
ByteUtil.EMPTY_BYTE_ARRAY);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/80a3c480/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
index 6ce0148..822ced8 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
@@ -28,6 +28,9 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Timer;
 import java.util.TimerTask;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.logging.Log;
@@ -65,14 +68,14 @@ import org.apache.phoenix.util.SchemaUtil;
  */
 public class MetaDataRegionObserver extends BaseRegionObserver {
     public static final Log LOG = LogFactory.getLog(MetaDataRegionObserver.class);
-    protected Timer scheduleTimer = new Timer(true);
+    protected ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
     private boolean enableRebuildIndex = QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD;
     private long rebuildIndexTimeInterval = QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD_INTERVAL;
   
     @Override
     public void preClose(final ObserverContext<RegionCoprocessorEnvironment> c,
             boolean abortRequested) {
-        scheduleTimer.cancel();
+        executor.shutdownNow();
         GlobalCache.getInstance(c.getEnvironment()).getMetaDataCache().invalidateAll();
     }
     
@@ -113,7 +116,7 @@ public class MetaDataRegionObserver extends BaseRegionObserver {
             // starts index rebuild schedule work
             BuildIndexScheduleTask task = new BuildIndexScheduleTask(e.getEnvironment());
             // run scheduled task every 10 secs
-            scheduleTimer.schedule(task, 10000, rebuildIndexTimeInterval);
+            executor.scheduleAtFixedRate(task, 10000, rebuildIndexTimeInterval, TimeUnit.MILLISECONDS);
         } catch (ClassNotFoundException ex) {
             LOG.error("BuildIndexScheduleTask cannot start!", ex);
         }


Mime
View raw message