You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by yo...@apache.org on 2023/05/29 08:26:53 UTC
[iotdb] 01/06: Update PartitionManager.java
This is an automated email from the ASF dual-hosted git repository.
yongzao pushed a commit to branch optimize-getOrCreatePartition
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 4eea85a2173f8a3b499eca4de57803b313a628ce
Author: YongzaoDan <53...@qq.com>
AuthorDate: Wed May 3 13:22:10 2023 +0800
Update PartitionManager.java
---
.../confignode/manager/partition/PartitionManager.java | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
index 60dcb30007e..11dad7a43dc 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
@@ -205,6 +205,13 @@ public class PartitionManager {
// by the number of SeriesPartitionSlots,
// the number of serialized CreateSchemaPartitionReqs is acceptable.
synchronized (this) {
+ // Here we should check again if the SchemaPartition
+ // has been created by other threads to improve concurrent performance
+ resp = (SchemaPartitionResp) getSchemaPartition(req);
+ if (resp.isAllPartitionsExist()) {
+ return resp;
+ }
+
// Filter unassigned SchemaPartitionSlots
Map<String, List<TSeriesPartitionSlot>> unassignedSchemaPartitionSlotsMap =
partitionInfo.filterUnassignedSchemaPartitionSlots(req.getPartitionSlotsMap());
@@ -258,7 +265,7 @@ public class PartitionManager {
resp = (SchemaPartitionResp) getSchemaPartition(req);
if (!resp.isAllPartitionsExist()) {
LOGGER.error(
- "Lacked some SchemaPartition allocation result in the response of getOrCreateDataPartition method");
+ "Lacked some SchemaPartition allocation result in the response of getOrCreateSchemaPartition method");
resp.setStatus(
new TSStatus(TSStatusCode.LACK_PARTITION_ALLOCATION.getStatusCode())
.setMessage("Lacked some SchemaPartition allocation result in the response"));
@@ -304,6 +311,13 @@ public class PartitionManager {
// by the number of SeriesPartitionSlots,
// the number of serialized CreateDataPartitionReqs is acceptable.
synchronized (this) {
+ // Here we should check again if the DataPartition
+ // has been created by other threads to improve concurrent performance
+ resp = (DataPartitionResp) getDataPartition(req);
+ if (resp.isAllPartitionsExist()) {
+ return resp;
+ }
+
// Filter unassigned DataPartitionSlots
Map<String, Map<TSeriesPartitionSlot, TTimeSlotList>> unassignedDataPartitionSlotsMap =
partitionInfo.filterUnassignedDataPartitionSlots(req.getPartitionSlotsMap());