asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ti...@apache.org
Subject asterixdb git commit: ASTERIXDB-1611: reasonable names for threads
Date Wed, 31 Aug 2016 03:52:07 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 3954de1ad -> ee3ec00c9


ASTERIXDB-1611: reasonable names for threads

Change-Id: I3fea28c9e0ea7c3baad1c7a053adabc71bea2a8a
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1092
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>


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

Branch: refs/heads/master
Commit: ee3ec00c9cfc28dab7bd80644a6d6a2c68812fc1
Parents: 3954de1
Author: Till Westmann <tillw@apache.org>
Authored: Mon Aug 29 20:15:40 2016 -0700
Committer: Till Westmann <tillw@apache.org>
Committed: Tue Aug 30 20:51:27 2016 -0700

----------------------------------------------------------------------
 .../api/common/AsterixHyracksIntegrationUtil.java |  2 +-
 .../hyracks/bootstrap/GlobalRecoveryManager.java  |  8 +++-----
 .../org/apache/asterix/metadata/MetadataNode.java |  3 +++
 .../metadata/bootstrap/MetadataBootstrap.java     | 18 +++++-------------
 .../control/cc/ClusterControllerService.java      |  3 ++-
 .../hyracks/control/common/work/WorkQueue.java    |  7 ++++---
 .../hyracks/control/nc/NodeControllerService.java |  2 +-
 7 files changed, 19 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee3ec00c/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
index 44bc3bf..f35b844 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -72,7 +72,7 @@ public class AsterixHyracksIntegrationUtil {
         for (String ncName : nodes) {
             NodeControllerService nodeControllerService = new NodeControllerService(createNCConfig(ncName));
             nodeControllers.add(nodeControllerService);
-            Thread ncStartThread = new Thread() {
+            Thread ncStartThread = new Thread("IntegrationUtil-" + ncName) {
                 @Override
                 public void run() {
                     try {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee3ec00c/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
index 0d5cfb2..bbd400b 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
@@ -203,20 +203,18 @@ public class GlobalRecoveryManager implements IGlobalRecoveryMaanger
{
                          * Note: Throwing this illegal state exception will terminate this
thread
                          * and feeds listeners will not be notified.
                          */
-                        LOGGER.severe("Global recovery was not completed successfully" +
e);
+                        LOGGER.log(Level.SEVERE, "Global recovery was not completed successfully:
", e);
                         try {
                             MetadataManager.INSTANCE.abortTransaction(mdTxnCtx);
                         } catch (Exception e1) {
-                            if (LOGGER.isLoggable(Level.SEVERE)) {
-                                LOGGER.severe("Exception in aborting" + e.getMessage());
-                            }
+                            LOGGER.log(Level.SEVERE, "Exception in aborting", e1);
                             throw new IllegalStateException(e1);
                         }
                     }
                     AsterixClusterProperties.INSTANCE.setGlobalRecoveryCompleted(true);
                     LOGGER.info("Global Recovery Completed");
                 }
-            });
+            }, "RecoveryThread");
             setState(newState);
             recoveryThread.start();
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee3ec00c/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
index 383039e..182cbda 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
@@ -1145,6 +1145,9 @@ public class MetadataNode implements IMetadataNode {
             IValueExtractor<ResultType> valueExtractor, List<ResultType> results)
             throws MetadataException, IndexException, IOException {
         IBinaryComparatorFactory[] comparatorFactories = index.getKeyBinaryComparatorFactory();
+        if (index.getFile() == null) {
+            throw new MetadataException("No file for Index " + index.getDataverseName() +
"." + index.getIndexName());
+        }
         String resourceName = index.getFile().toString();
         IIndex indexInstance = datasetLifecycleManager.getIndex(resourceName);
         datasetLifecycleManager.open(resourceName);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee3ec00c/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
index f5ccb9e..616c724 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
@@ -32,9 +32,9 @@ import org.apache.asterix.common.api.IDatasetLifecycleManager;
 import org.apache.asterix.common.api.ILocalResourceMetadata;
 import org.apache.asterix.common.cluster.ClusterPartition;
 import org.apache.asterix.common.config.AsterixMetadataProperties;
-import org.apache.asterix.common.config.DatasetConfig.DatasetType;
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.common.config.IAsterixPropertiesProvider;
+import org.apache.asterix.common.config.DatasetConfig.DatasetType;
 import org.apache.asterix.common.context.BaseOperationTracker;
 import org.apache.asterix.common.context.CorrelatedPrefixMergePolicyFactory;
 import org.apache.asterix.common.ioopcallbacks.LSMBTreeIOOperationCallbackFactory;
@@ -59,10 +59,10 @@ import org.apache.asterix.metadata.entities.Dataverse;
 import org.apache.asterix.metadata.entities.FeedPolicyEntity;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.metadata.entities.InternalDatasetDetails;
-import org.apache.asterix.metadata.entities.InternalDatasetDetails.FileStructure;
-import org.apache.asterix.metadata.entities.InternalDatasetDetails.PartitioningStrategy;
 import org.apache.asterix.metadata.entities.Node;
 import org.apache.asterix.metadata.entities.NodeGroup;
+import org.apache.asterix.metadata.entities.InternalDatasetDetails.FileStructure;
+import org.apache.asterix.metadata.entities.InternalDatasetDetails.PartitioningStrategy;
 import org.apache.asterix.metadata.feeds.BuiltinFeedPolicies;
 import org.apache.asterix.metadata.utils.MetadataConstants;
 import org.apache.asterix.om.types.BuiltinType;
@@ -248,16 +248,8 @@ public class MetadataBootstrap {
     }
 
     public static void insertNodes(MetadataTransactionContext mdTxnCtx) throws Exception
{
-        Iterator<String> iter = nodeNames.iterator();
-        // Set<Entry<String, String[]>> set = nodeStores.entrySet();
-        // Iterator<Entry<String, String[]>> im = set.iterator();
-
-        while (iter.hasNext()) {
-            // Map.Entry<String, String[]> me = (Map.Entry<String,
-            // String[]>)im.next();
-            MetadataManager.INSTANCE.addNode(mdTxnCtx, new Node(iter.next(), 0, 0/*
-                                                                                  * , me
. getValue ( )
-                                                                                  */));
+        for (String nodesName : nodeNames) {
+            MetadataManager.INSTANCE.addNode(mdTxnCtx, new Node(nodesName, 0, 0));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee3ec00c/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/ClusterControllerService.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/ClusterControllerService.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/ClusterControllerService.java
index 1272562..58edf60 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/ClusterControllerService.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/ClusterControllerService.java
@@ -191,7 +191,8 @@ public class ClusterControllerService implements IControllerService {
                 return size() > allowedSize;
             }
         };
-        workQueue = new WorkQueue(Thread.MAX_PRIORITY); // WorkQueue is in charge of heartbeat
as well as other events.
+        // WorkQueue is in charge of heartbeat as well as other events.
+        workQueue = new WorkQueue("ClusterController", Thread.MAX_PRIORITY);
         this.timer = new Timer(true);
         final ClusterTopology topology = computeClusterTopology(ccConfig);
         ccContext = new ICCContext() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee3ec00c/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/work/WorkQueue.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/work/WorkQueue.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/work/WorkQueue.java
index 1f61543..f9df54b 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/work/WorkQueue.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/work/WorkQueue.java
@@ -39,14 +39,14 @@ public class WorkQueue {
     private AtomicInteger dequeueCount;
     private int threadPriority = Thread.MAX_PRIORITY;
 
-    public WorkQueue(int threadPriority) {
+    public WorkQueue(String id, int threadPriority) {
         if (threadPriority != Thread.MAX_PRIORITY && threadPriority != Thread.NORM_PRIORITY
                 && threadPriority != Thread.MIN_PRIORITY) {
             throw new IllegalArgumentException("Illegal thread priority number.");
         }
         this.threadPriority = threadPriority;
         queue = new LinkedBlockingQueue<AbstractWork>();
-        thread = new WorkerThread();
+        thread = new WorkerThread(id);
         stopSemaphore = new Semaphore(1);
         stopped = true;
         if(DEBUG) {
@@ -101,7 +101,8 @@ public class WorkQueue {
     }
 
     private class WorkerThread extends Thread {
-        WorkerThread() {
+        WorkerThread(String id) {
+            setName("Worker:" + id);
             setDaemon(true);
             setPriority(threadPriority);
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee3ec00c/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
index ac994a6..8373ebe 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
@@ -179,7 +179,7 @@ public class NodeControllerService implements IControllerService {
                 FullFrameChannelInterfaceFactory.INSTANCE);
 
         lccm = new LifeCycleComponentManager();
-        queue = new WorkQueue(Thread.NORM_PRIORITY); // Reserves MAX_PRIORITY of the heartbeat
thread.
+        queue = new WorkQueue(id, Thread.NORM_PRIORITY); // Reserves MAX_PRIORITY of the
heartbeat thread.
         jobletMap = new Hashtable<JobId, Joblet>();
         timer = new Timer(true);
         serverCtx = new ServerContext(ServerContext.ServerType.NODE_CONTROLLER,


Mime
View raw message