Skip to content

Commit c262edd

Browse files
committed
fix: data store ref count
1 parent 60c1ef8 commit c262edd

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/CteScanOperator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class CteScanOperator extends AbstractSourceOperator {
4141
RamUsageEstimator.shallowSizeOfInstance(CteScanOperator.class);
4242

4343
private final CteDataStore dataStore;
44+
private final int dataStoreRefCount;
4445
private CteDataReader dataReader;
4546

4647
private final long maxReturnSize =
@@ -50,8 +51,8 @@ public CteScanOperator(
5051
OperatorContext operatorContext, PlanNodeId sourceId, CteDataStore dataStore) {
5152
this.operatorContext = operatorContext;
5253
this.sourceId = sourceId;
53-
dataStore.increaseRefCount();
5454
this.dataStore = dataStore;
55+
this.dataStoreRefCount = dataStore.increaseRefCount();
5556
prepareReader();
5657
}
5758

@@ -109,7 +110,7 @@ public long ramBytesUsed() {
109110
if (dataReader != null) {
110111
bytes += dataReader.bytesUsed();
111112
}
112-
if (dataStore.getRefCount() == 1) {
113+
if (dataStoreRefCount == 1) {
113114
bytes += dataStore.getCachedBytes();
114115
}
115116

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/cte/CteDataStore.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ public List<Integer> getColumnIndex2TsBlockColumnIndexList() {
9595
return columnIndex2TsBlockColumnIndexList;
9696
}
9797

98-
public int getRefCount() {
99-
return count.get();
100-
}
101-
102-
public void increaseRefCount() {
103-
count.getAndIncrement();
98+
public int increaseRefCount() {
99+
return count.incrementAndGet();
104100
}
105101
}

0 commit comments

Comments
 (0)