Skip to content

Commit d0c32f0

Browse files
authored
fix wal queue stuck and fix metric (#14387) (#14393)
1 parent e0c2f5e commit d0c32f0

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/WritingMetrics.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ private void bindWALMetrics(AbstractMetricService metricService) {
257257
MetricLevel.IMPORTANT,
258258
Tag.NAME.toString(),
259259
WRITE_WAL_BUFFER_COST_NS);
260+
walQueueMaxMemSizeGauge =
261+
metricService.getOrCreateGauge(
262+
Metric.WAL_QUEUE_MEM_COST.toString(),
263+
MetricLevel.IMPORTANT,
264+
Tag.NAME.toString(),
265+
WAL_QUEUE_MAX_MEM_COST);
260266
SystemInfo systemInfo = SystemInfo.getInstance();
261267
metricService.createAutoGauge(
262268
Metric.WAL_QUEUE_MEM_COST.toString(),
@@ -265,12 +271,6 @@ private void bindWALMetrics(AbstractMetricService metricService) {
265271
SystemInfo::getCurrentWalQueueMemoryCost,
266272
Tag.NAME.toString(),
267273
WAL_QUEUE_CURRENT_MEM_COST);
268-
walQueueMaxMemSizeGauge =
269-
metricService.getOrCreateGauge(
270-
Metric.WAL_QUEUE_MEM_COST.toString(),
271-
MetricLevel.IMPORTANT,
272-
Tag.NAME.toString(),
273-
WAL_QUEUE_MAX_MEM_COST);
274274
}
275275

276276
private void unbindWALMetrics(AbstractMetricService metricService) {

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/MemoryControlledWALEntryQueue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
public class MemoryControlledWALEntryQueue {
3030

3131
private final BlockingQueue<WALEntry> queue;
32-
private final Object nonFullCondition = new Object();
32+
private static final Object nonFullCondition = new Object();
3333

3434
public MemoryControlledWALEntryQueue() {
3535
queue = new LinkedBlockingQueue<>();

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/memory/SystemInfo.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ public synchronized void applyTemporaryMemoryForFlushing(long estimatedTemporary
532532
REJECT_THRESHOLD = memorySizeForMemtable * config.getRejectProportion();
533533
WritingMetrics.getInstance().recordFlushThreshold(FLUSH_THRESHOLD);
534534
WritingMetrics.getInstance().recordRejectThreshold(REJECT_THRESHOLD);
535+
WritingMetrics.getInstance().recordWALQueueMaxMemorySize(memorySizeForWalBufferQueue);
535536
}
536537

537538
public synchronized void releaseTemporaryMemoryForFlushing(long estimatedTemporaryMemSize) {
@@ -540,6 +541,7 @@ public synchronized void releaseTemporaryMemoryForFlushing(long estimatedTempora
540541
REJECT_THRESHOLD = memorySizeForMemtable * config.getRejectProportion();
541542
WritingMetrics.getInstance().recordFlushThreshold(FLUSH_THRESHOLD);
542543
WritingMetrics.getInstance().recordRejectThreshold(REJECT_THRESHOLD);
544+
WritingMetrics.getInstance().recordWALQueueMaxMemorySize(memorySizeForWalBufferQueue);
543545
}
544546

545547
public long getTotalMemTableSize() {

0 commit comments

Comments
 (0)