Skip to content

Commit 32e701e

Browse files
XNX02xnx021128
andauthored
Pipe: Pin unpin log frequency decrease (apache#14049)
Co-authored-by: nanxiang xia <[email protected]>
1 parent 34221fb commit 32e701e

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeTsFileResourceManager.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private void ttlCheck() throws InterruptedException {
8080
PipeConfig.getInstance().getPipeTsFilePinMaxLogNumPerRound(),
8181
PipeConfig.getInstance().getPipeTsFilePinMaxLogIntervalRounds(),
8282
hardlinkOrCopiedFileToPipeTsFileResourceMap.size());
83-
83+
final StringBuilder logBuilder = new StringBuilder();
8484
while (iterator.hasNext()) {
8585
final Map.Entry<String, PipeTsFileResource> entry = iterator.next();
8686

@@ -97,19 +97,19 @@ private void ttlCheck() throws InterruptedException {
9797
if (entry.getValue().closeIfOutOfTimeToLive()) {
9898
iterator.remove();
9999
} else {
100-
logger.ifPresent(
101-
l ->
102-
l.info(
103-
"Pipe file (file name: {}) is still referenced {} times",
104-
entry.getKey(),
105-
entry.getValue().getReferenceCount()));
100+
logBuilder.append(
101+
String.format(
102+
"<%s , %d times> ", entry.getKey(), entry.getValue().getReferenceCount()));
106103
}
107104
} catch (final IOException e) {
108105
LOGGER.warn("failed to close PipeTsFileResource when checking TTL: ", e);
109106
} finally {
110107
segmentLock.unlock(new File(hardlinkOrCopiedFile));
111108
}
112109
}
110+
if (logBuilder.length() > 0) {
111+
logger.ifPresent(l -> l.info("Pipe file {}are still referenced", logBuilder));
112+
}
113113
}
114114

115115
/**

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/wal/PipeWALResourceManager.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ private void ttlCheck() {
7373
PipeConfig.getInstance().getPipeWalPinMaxLogIntervalRounds(),
7474
memtableIdToPipeWALResourceMap.size());
7575

76+
final StringBuilder logBuilder = new StringBuilder();
7677
try {
7778
while (iterator.hasNext()) {
7879
final Map.Entry<Long, PipeWALResource> entry = iterator.next();
@@ -84,12 +85,9 @@ private void ttlCheck() {
8485
if (entry.getValue().invalidateIfPossible()) {
8586
iterator.remove();
8687
} else {
87-
logger.ifPresent(
88-
l ->
89-
l.info(
90-
"WAL (memtableId {}) is still referenced {} times",
91-
entry.getKey(),
92-
entry.getValue().getReferenceCount()));
88+
logBuilder.append(
89+
String.format(
90+
"<%d , %d times> ", entry.getKey(), entry.getValue().getReferenceCount()));
9391
}
9492
} finally {
9593
lock.unlock();
@@ -99,6 +97,10 @@ private void ttlCheck() {
9997
LOGGER.error(
10098
"Concurrent modification issues happened, skipping the WAL in this round of ttl check",
10199
e);
100+
} finally {
101+
if (logBuilder.length() > 0) {
102+
logger.ifPresent(l -> l.info("WAL {}are still referenced", logBuilder));
103+
}
102104
}
103105
}
104106

0 commit comments

Comments
 (0)