Skip to content

Commit 03cc1bd

Browse files
authored
Load: Fixed multiple bugs (#17413) (#17421)
* fix * load * Update ClusterConfigTaskExecutor.java * fix
1 parent 33fa6fa commit 03cc1bd

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,6 +2871,7 @@ public SettableFuture<ConfigTaskResult> removeDataNode(
28712871
future.setException(
28722872
new IOException(
28732873
"The DataNode to be removed is not in the cluster, or the input format is incorrect."));
2874+
return future;
28742875
}
28752876

28762877
LOGGER.info("Starting to remove DataNode with nodeIds: {}", nodeIds);
@@ -2940,6 +2941,7 @@ public SettableFuture<ConfigTaskResult> removeConfigNode(
29402941
future.setException(
29412942
new IOException(
29422943
"The ConfigNode to be removed is not in the cluster, or the input format is incorrect."));
2944+
return future;
29432945
}
29442946

29452947
TConfigNodeLocation configNodeLocation = removeConfigNodeLocations.get(0);

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileScheduler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,10 @@ public void start() {
275275
final StringBuilder failedTsFiles =
276276
new StringBuilder(
277277
!tsFileNodeList.isEmpty()
278-
? tsFileNodeList.get(0).getTsFileResource().getTsFilePath()
278+
? tsFileNodeList
279+
.get(failedTsFileNodeIndexes.get(0))
280+
.getTsFileResource()
281+
.getTsFilePath()
279282
: "");
280283
final ListIterator<Integer> iterator = failedTsFileNodeIndexes.listIterator(1);
281284
while (iterator.hasNext()) {

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/LoadTsFileManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public void writeToDataRegion(DataRegion dataRegion, LoadTsFilePieceNode pieceNo
220220
}
221221
}
222222

223-
final Optional<CleanupTask> cleanupTask = Optional.of(uuid2CleanupTask.get(uuid));
223+
final Optional<CleanupTask> cleanupTask = Optional.ofNullable(uuid2CleanupTask.get(uuid));
224224
cleanupTask.ifPresent(CleanupTask::markLoadTaskRunning);
225225
try {
226226
final AtomicReference<Exception> exception = new AtomicReference<>();
@@ -293,7 +293,7 @@ public boolean loadAll(
293293
return false;
294294
}
295295

296-
final Optional<CleanupTask> cleanupTask = Optional.of(uuid2CleanupTask.get(uuid));
296+
final Optional<CleanupTask> cleanupTask = Optional.ofNullable(uuid2CleanupTask.get(uuid));
297297
cleanupTask.ifPresent(CleanupTask::markLoadTaskRunning);
298298
try {
299299
uuid2WriterManager.get(uuid).loadAll(isGeneratedByPipe, timePartitionProgressIndexMap);

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/active/ActiveLoadPendingQueue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ public synchronized boolean isFilePendingOrLoading(final String file) {
6666
return loadingFileSet.contains(file) || pendingFileSet.contains(file);
6767
}
6868

69-
public int size() {
69+
public synchronized int size() {
7070
return pendingFileQueue.size() + loadingFileSet.size();
7171
}
7272

73-
public boolean isEmpty() {
73+
public synchronized boolean isEmpty() {
7474
return pendingFileQueue.isEmpty() && loadingFileSet.isEmpty();
7575
}
7676

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/config/LoadTsFileConfigurator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ public static void validateParameters(final String key, final String value) {
6666

6767
public static void validateDatabaseLevelParam(final String databaseLevel) {
6868
try {
69-
int level = Integer.parseInt(databaseLevel);
69+
final int level = Integer.parseInt(databaseLevel);
7070
if (level < DATABASE_LEVEL_MIN_VALUE) {
7171
throw new SemanticException(
7272
String.format(
7373
"Given database level %d is less than the minimum value %d, please input a valid database level.",
7474
level, DATABASE_LEVEL_MIN_VALUE));
7575
}
76-
} catch (Exception e) {
76+
} catch (final NumberFormatException e) {
7777
throw new SemanticException(
7878
String.format(
7979
"Given database level %s is not a valid integer, please input a valid database level.",

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/memory/LoadTsFileMemoryManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ public synchronized LoadTsFileDataCacheMemoryBlock allocateDataCacheMemoryBlock(
127127
final long actuallyAllocateMemoryInBytes =
128128
tryAllocateFromQuery(MEMORY_TOTAL_SIZE_FROM_QUERY_IN_BYTES >> 2);
129129
dataCacheMemoryBlock = new LoadTsFileDataCacheMemoryBlock(actuallyAllocateMemoryInBytes);
130-
usedMemorySizeInBytes.addAndGet(actuallyAllocateMemoryInBytes);
131130
LOGGER.info(
132131
"Create Data Cache Memory Block {}, allocate memory {}",
133132
dataCacheMemoryBlock,

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/metrics/LoadTsFileCostMetricsSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public void unbindFrom(AbstractMetricService metricService) {
159159
stage));
160160

161161
metricService.remove(
162-
MetricType.RATE,
162+
MetricType.COUNTER,
163163
Metric.LOAD_DISK_IO.toString(),
164164
Tag.NAME.toString(),
165165
String.valueOf(IoTDBDescriptor.getInstance().getConfig().getDataNodeId()));

0 commit comments

Comments
 (0)