You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/05/06 16:21:45 UTC

[GitHub] [incubator-iotdb] Ring-k opened a new pull request #1161: [IOTDB-348] Fix DeleteTimeseriesPlan result inconsistent problem

Ring-k opened a new pull request #1161:
URL: https://github.com/apache/incubator-iotdb/pull/1161


   This pull request fixes DeleteTimeseriesPlan result inconsistent problem. 
   
   Some meta data checks are skipped in the cluster version. Some messages sent to MManager are now replaced by broadcast in the cluster.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #1161: [IOTDB-348] Fix DeleteTimeseriesPlan result inconsistent problem

Posted by GitBox <gi...@apache.org>.
jt2594838 commented on a change in pull request #1161:
URL: https://github.com/apache/incubator-iotdb/pull/1161#discussion_r421211185



##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/server/handlers/caller/DeleteTimeseriesHandler.java
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *     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.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.cluster.server.handlers.caller;
+
+import org.apache.iotdb.cluster.rpc.thrift.DeleteTimeseriesRespPair;
+import org.apache.iotdb.cluster.rpc.thrift.Node;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+public class DeleteTimeseriesHandler implements AsyncMethodCallback<DeleteTimeseriesRespPair> {
+  private static final Logger logger = LoggerFactory.getLogger(DeleteTimeseriesHandler.class);
+
+  private Node contact;
+  private AtomicReference<DeleteTimeseriesRespPair> result;
+
+  @Override
+  public void onComplete(DeleteTimeseriesRespPair resp) {
+    logger.info("Received delete timeseries result from {}", contact);
+    synchronized (result) {
+      result.set(resp);
+      result.notifyAll();
+    }
+  }
+
+  @Override
+  public void onError(Exception exception) {
+    logger.warn("Cannot delete timeseries from {}, because ", contact, exception);

Review comment:
       I think you should notify `result` when an error occurs.

##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/query/ClusterPlanExecutor.java
##########
@@ -373,8 +373,85 @@ protected void loadConfiguration(LoadConfigurationPlan plan) throws QueryProcess
         break;
       default:
         throw new QueryProcessException(String
-            .format("Unrecognized load configuration plan type: %s",
-                plan.getLoadConfigurationPlanType()));
+                .format("Unrecognized load configuration plan type: %s",
+                        plan.getLoadConfigurationPlanType()));
+    }
+  }
+
+  @Override
+  protected Pair<Set<String>, String> deleteTimeseries(String path) throws MetadataException {
+    ConcurrentHashMap<String, Set<String>> resultPair = new ConcurrentHashMap<>();
+    Pair<Set<String>, String> localPair = MManager.getInstance().deleteTimeseries(path);
+    resultPair.put(localPair.right, localPair.left);
+
+    ExecutorService pool = new ScheduledThreadPoolExecutor(THREAD_POOL_SIZE);
+
+    for (PartitionGroup group : metaGroupMember.getPartitionTable().getGlobalGroups()) {
+      Node header = group.getHeader();
+      if (header.equals(metaGroupMember.getThisNode())) {
+        continue;
+      }
+      pool.submit(() -> {
+        DeleteTimeseriesHandler handler = new DeleteTimeseriesHandler();
+        AtomicReference<DeleteTimeseriesRespPair> response = new AtomicReference<>(null);
+        handler.setResponse(response);
+
+        for (Node node : group) {

Review comment:
       As a node exists in multiple groups, a node will perform the same deletion several times and I am not sure if it is meaningful. Why not just send the deletion to each node in allNodes?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] Ring-k commented on a change in pull request #1161: [IOTDB-348] Fix DeleteTimeseriesPlan result inconsistent problem

Posted by GitBox <gi...@apache.org>.
Ring-k commented on a change in pull request #1161:
URL: https://github.com/apache/incubator-iotdb/pull/1161#discussion_r421222470



##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/server/handlers/caller/DeleteTimeseriesHandler.java
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *     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.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.cluster.server.handlers.caller;
+
+import org.apache.iotdb.cluster.rpc.thrift.DeleteTimeseriesRespPair;
+import org.apache.iotdb.cluster.rpc.thrift.Node;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+public class DeleteTimeseriesHandler implements AsyncMethodCallback<DeleteTimeseriesRespPair> {
+  private static final Logger logger = LoggerFactory.getLogger(DeleteTimeseriesHandler.class);
+
+  private Node contact;
+  private AtomicReference<DeleteTimeseriesRespPair> result;
+
+  @Override
+  public void onComplete(DeleteTimeseriesRespPair resp) {
+    logger.info("Received delete timeseries result from {}", contact);
+    synchronized (result) {
+      result.set(resp);
+      result.notifyAll();
+    }
+  }
+
+  @Override
+  public void onError(Exception exception) {
+    logger.warn("Cannot delete timeseries from {}, because ", contact, exception);

Review comment:
       Thanks for your reminding.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-iotdb] Ring-k commented on a change in pull request #1161: [IOTDB-348] Fix DeleteTimeseriesPlan result inconsistent problem

Posted by GitBox <gi...@apache.org>.
Ring-k commented on a change in pull request #1161:
URL: https://github.com/apache/incubator-iotdb/pull/1161#discussion_r421222398



##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/query/ClusterPlanExecutor.java
##########
@@ -373,8 +373,85 @@ protected void loadConfiguration(LoadConfigurationPlan plan) throws QueryProcess
         break;
       default:
         throw new QueryProcessException(String
-            .format("Unrecognized load configuration plan type: %s",
-                plan.getLoadConfigurationPlanType()));
+                .format("Unrecognized load configuration plan type: %s",
+                        plan.getLoadConfigurationPlanType()));
+    }
+  }
+
+  @Override
+  protected Pair<Set<String>, String> deleteTimeseries(String path) throws MetadataException {
+    ConcurrentHashMap<String, Set<String>> resultPair = new ConcurrentHashMap<>();
+    Pair<Set<String>, String> localPair = MManager.getInstance().deleteTimeseries(path);
+    resultPair.put(localPair.right, localPair.left);
+
+    ExecutorService pool = new ScheduledThreadPoolExecutor(THREAD_POOL_SIZE);
+
+    for (PartitionGroup group : metaGroupMember.getPartitionTable().getGlobalGroups()) {
+      Node header = group.getHeader();
+      if (header.equals(metaGroupMember.getThisNode())) {
+        continue;
+      }
+      pool.submit(() -> {
+        DeleteTimeseriesHandler handler = new DeleteTimeseriesHandler();
+        AtomicReference<DeleteTimeseriesRespPair> response = new AtomicReference<>(null);
+        handler.setResponse(response);
+
+        for (Node node : group) {

Review comment:
       Thanks for your advice. I've changed the logic.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org