Pengzna commented on code in PR #17335:
URL: https://github.com/apache/iotdb/pull/17335#discussion_r2971655995
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java:
##########
@@ -859,6 +865,17 @@ public PipeEventResource eventResourceBuilder() {
this.eventParser);
}
+ private void refreshModFileState() {
+ if (!shouldTransferModFile || Objects.isNull(resource)) {
+ isWithMod = false;
+ modFile = null;
+ return;
+ }
+
+ isWithMod = resource.anyModFileExists();
+ modFile = isWithMod ? resource.getExclusiveModFile().getFile() : null;
Review Comment:
Good catch — this is a real issue.
`PipeTsFileResourceManager.increaseFileReference(...)` may replace `modFile`
with a copied file under the pipe dir. If we keep refreshing from
`resource.getExclusiveModFile().getFile()`, we can overwrite that pinned path,
which breaks ref tracking (leaks the copied mod / decreases the wrong path) and
can make the sink transfer an unpinned file.
I updated `refreshModFileState()` to **not refresh once the event is
pinned** (`referenceCount > 0`), so `modFile` remains the pinned (copied) file
after `increaseReferenceCount()`. Also added a regression test
`testPinnedModFilePathIsStableAfterIncreaseReferenceCount` to ensure repeated
`getModFile()/isWithMod()` calls don\x27t revert to the original mod path.
Patch is pushed to this PR branch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]