This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch rel/0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.12 by this push:
new f94a02a [To rel/0.12][IOTDB-1958] Add storage group not ready
exception (#4336)
f94a02a is described below
commit f94a02ad392e254298fdf76868621edb4cdd5778
Author: Alan Choo <[email protected]>
AuthorDate: Mon Nov 8 17:52:48 2021 +0800
[To rel/0.12][IOTDB-1958] Add storage group not ready exception (#4336)
---
.../org/apache/iotdb/db/engine/StorageEngine.java | 16 +++----------
.../virtualSg/VirtualStorageGroupManager.java | 8 +++----
.../exception/StorageGroupNotReadyException.java | 27 ++++++++++++++++++++++
.../org/apache/iotdb/db/service/TSServiceImpl.java | 9 +++-----
4 files changed, 36 insertions(+), 24 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
b/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
index 1e9481d..67b5643 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
@@ -33,14 +33,7 @@ import
org.apache.iotdb.db.engine.storagegroup.StorageGroupProcessor.TimePartiti
import org.apache.iotdb.db.engine.storagegroup.TsFileProcessor;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import
org.apache.iotdb.db.engine.storagegroup.virtualSg.VirtualStorageGroupManager;
-import org.apache.iotdb.db.exception.BatchProcessException;
-import org.apache.iotdb.db.exception.LoadFileException;
-import org.apache.iotdb.db.exception.ShutdownException;
-import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.StorageGroupProcessorException;
-import org.apache.iotdb.db.exception.TsFileProcessorException;
-import org.apache.iotdb.db.exception.WriteProcessException;
-import org.apache.iotdb.db.exception.WriteProcessRejectException;
+import org.apache.iotdb.db.exception.*;
import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
@@ -569,11 +562,8 @@ public class StorageEngine implements IService {
}
} else {
// not finished recover, refuse the request
- throw new StorageEngineException(
- "the sg "
- + storageGroupMNode.getPartialPath()
- + " may not ready now, please wait and retry later",
- TSStatusCode.STORAGE_GROUP_NOT_READY.getStatusCode());
+ throw new StorageGroupNotReadyException(
+ storageGroupMNode.getFullPath(),
TSStatusCode.STORAGE_GROUP_NOT_READY.getStatusCode());
}
}
return virtualStorageGroupManager.getProcessor(devicePath,
storageGroupMNode);
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/virtualSg/VirtualStorageGroupManager.java
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/virtualSg/VirtualStorageGroupManager.java
index 6e62bce..2012101 100644
---
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/virtualSg/VirtualStorageGroupManager.java
+++
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/virtualSg/VirtualStorageGroupManager.java
@@ -24,6 +24,7 @@ import
org.apache.iotdb.db.engine.storagegroup.StorageGroupProcessor.TimePartiti
import org.apache.iotdb.db.engine.storagegroup.TsFileProcessor;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.exception.StorageEngineException;
+import org.apache.iotdb.db.exception.StorageGroupNotReadyException;
import org.apache.iotdb.db.exception.StorageGroupProcessorException;
import org.apache.iotdb.db.exception.TsFileProcessorException;
import org.apache.iotdb.db.metadata.PartialPath;
@@ -141,11 +142,8 @@ public class VirtualStorageGroupManager {
}
} else {
// not finished recover, refuse the request
- throw new StorageEngineException(
- "the sg "
- + storageGroupMNode.getFullPath()
- + " may not ready now, please wait and retry later",
- TSStatusCode.STORAGE_GROUP_NOT_READY.getStatusCode());
+ throw new StorageGroupNotReadyException(
+ storageGroupMNode.getFullPath(),
TSStatusCode.STORAGE_GROUP_NOT_READY.getStatusCode());
}
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/exception/StorageGroupNotReadyException.java
b/server/src/main/java/org/apache/iotdb/db/exception/StorageGroupNotReadyException.java
new file mode 100644
index 0000000..36a0d1b
--- /dev/null
+++
b/server/src/main/java/org/apache/iotdb/db/exception/StorageGroupNotReadyException.java
@@ -0,0 +1,27 @@
+/*
+ * 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.db.exception;
+
+public class StorageGroupNotReadyException extends StorageEngineException {
+
+ public StorageGroupNotReadyException(String storageGroup, int errorCode) {
+ super("the sg " + storageGroup + " may not ready now, please wait and
retry later", errorCode);
+ }
+}
diff --git
a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index b36a5ee..ad4238d 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -28,10 +28,7 @@ import org.apache.iotdb.db.conf.IoTDBConstant;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.cost.statistic.Measurement;
import org.apache.iotdb.db.cost.statistic.Operation;
-import org.apache.iotdb.db.exception.BatchProcessException;
-import org.apache.iotdb.db.exception.IoTDBException;
-import org.apache.iotdb.db.exception.QueryInBatchStatementException;
-import org.apache.iotdb.db.exception.StorageEngineException;
+import org.apache.iotdb.db.exception.*;
import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
@@ -1924,7 +1921,7 @@ public class TSServiceImpl implements TSIService.Iface {
DETAILED_FAILURE_QUERY_TRACE_LOGGER.warn(INFO_NOT_ALLOWED_IN_BATCH_ERROR, e);
return RpcUtils.getStatus(
TSStatusCode.QUERY_NOT_ALLOWED, INFO_NOT_ALLOWED_IN_BATCH_ERROR +
getRootCause(e));
- } else if (e instanceof IoTDBException) {
+ } else if (e instanceof IoTDBException && !(e instanceof
StorageGroupNotReadyException)) {
DETAILED_FAILURE_QUERY_TRACE_LOGGER.warn(INFO_QUERY_PROCESS_ERROR, e);
return RpcUtils.getStatus(((IoTDBException) e).getErrorCode(),
getRootCause(e));
}
@@ -1943,7 +1940,7 @@ public class TSServiceImpl implements TSIService.Iface {
if (e instanceof BatchProcessException) {
LOGGER.warn(message, e);
return RpcUtils.getStatus(Arrays.asList(((BatchProcessException)
e).getFailingStatus()));
- } else if (e instanceof IoTDBException) {
+ } else if (e instanceof IoTDBException && !(e instanceof
StorageGroupNotReadyException)) {
if (((IoTDBException) e).isUserException()) {
LOGGER.warn(message + e.getMessage());
} else {