You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by je...@apache.org on 2014/08/15 23:47:19 UTC
git commit: PHOENIX-1173: MutableIndexFailureIT.java doesn't finish
sometimes or is flappy.
Repository: phoenix
Updated Branches:
refs/heads/3.0 19dc23aa5 -> 71cc23c8f
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/71cc23c8
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/71cc23c8
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/71cc23c8
Branch: refs/heads/3.0
Commit: 71cc23c8fa03694db1816cf8e3f5d0bb3f391ccb
Parents: 19dc23a
Author: Jeffrey Zhong <je...@apache.org>
Authored: Fri Aug 15 14:02:51 2014 -0700
Committer: Jeffrey Zhong <je...@apache.org>
Committed: Fri Aug 15 14:02:51 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/71cc23c8/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 07d4cc8..9cb3b89 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
@@ -1207,6 +1207,8 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements Met
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/71cc23c8/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 2820e59..1526a98 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
@@ -24,6 +24,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;
@@ -64,14 +67,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();
}
@@ -112,7 +115,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);
}