-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[IOTDB-5]Combine deletion with FileNodeProcessor and FileNodeManager #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# Conflicts: # iotdb/src/test/java/org/apache/iotdb/db/engine/bufferwrite/BufferWriteProcessorNewTest.java # iotdb/src/test/java/org/apache/iotdb/db/engine/bufferwrite/BufferWriteProcessorTest.java
# Conflicts: # iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java # iotdb/src/main/java/org/apache/iotdb/db/engine/overflow/ioV2/OverflowResource.java # iotdb/src/main/java/org/apache/iotdb/db/engine/overflow/ioV2/OverflowSupport.java
iotdb/src/main/java/org/apache/iotdb/db/engine/version/SimpleFileVersionController.java
Show resolved
Hide resolved
iotdb/src/test/java/org/apache/iotdb/db/engine/modification/DeletionFileNodeTest.java
Outdated
Show resolved
Hide resolved
| File[] versionFiles = directory.listFiles((dir, name) -> name.startsWith(FILE_PREFIX)); | ||
| File versionFile = null; | ||
| if (versionFiles != null && versionFiles.length > 0) { | ||
| Arrays.sort(versionFiles, Comparator.comparing(File::getName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose there are two version files: 900 and 1000. Then Comparator.comparing(File.getName) is incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with scan-and-find-maximum.
| if (isFlush) { | ||
| // flushing MemTable cannot be directly modified since another thread is reading it | ||
| flushMemTable = flushMemTable.copy(); | ||
| flushMemTable.delele(deviceId, measurementId, timestamp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... so is this operation is just for guaranteeing queryBufferWriteData() ?
Actually, flushMemTable = flushMemTable.copy(); can not affect the flushing memtable... so you have to add the Deletion operation in the modification file at the same time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly.
iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
Show resolved
Hide resolved
| statMonitor.registStatistics(statStorageDeltaName, this); | ||
| } | ||
| try { | ||
| versionController = new SimpleFileVersionController(fileNodeDirPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about create a VersionControllerFactory.
Latter we can modify the factory to switch the implementation of the versionController, otherwith SysTimestampVersionController is meaningless..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite necessary, SysTimestampVersionController is for test.
iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
Outdated
Show resolved
Hide resolved
iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
Show resolved
Hide resolved
| * @return A reduced copy of chunk if chunk contains data with timestamp less than 'timestamp', | ||
| * of null. | ||
| */ | ||
| private IWritableMemChunk filterChunk(IWritableMemChunk chunk, long timestamp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about using the concept of Page?
Suppose a Chunk consists of page1, page2, page3,...., page n, and you will delete page 1, 2 and a part of page 3.
Then, just re-compress page 3 (and as a result, this page will have just a few points), and keep page 4~n into the new Chunk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, but unfortunately IWritableMemChunk does not provide such interfaces. I would suggest you issue this and improve it later.
| } | ||
|
|
||
| fileWriter.endChunkGroup(chunkGroupFooter); | ||
| fileWriter.endChunkGroup(chunkGroupFooter, version++); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose we have many TsFiles, and they are generated by different programs..
When we put all of them into an IoTDB instance (e.g., using Postback module), maybe we need a version repairing tool .
(There is no need to add the function into this PR, but if so, we need record an issue at least.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a big issue. Stand-alone TsFile does not support deletion. After importing all the TsFiles, any new deletion takes effect on all of them. So the only thing we need to do is to make the version of new deletions greater than those of all existing TsFiles, which is straight-forward.
# This is the 1st commit message: Fix query one sensor in a vector from memtable (apache#3056) Fix query one sensor in a vector from memtable # This is the commit message apache#2: [IOTDB-1310] Enable docker, docker-compose and testcontainer for End to end test (apache#3024) * enable TestCongtainer for E2E test for (singleNode and cluster) * remove duplicated operations in integration-test phase * move spotless:apply to a profile `spotless`, which is enabled by default. Co-authored-by: xiangdong huang <sainthxd@gmail.com> # This is the commit message apache#3: add sink interface # This is the commit message apache#4: 3 new event sinks # This is the commit message apache#5: add ts sink # This is the commit message apache#6: add ts sink # This is the commit message apache#7: add mqtt sink # This is the commit message apache#8: refactor sink module # This is the commit message apache#9: init package sink.manager # This is the commit message apache#10: rename SinkException # This is the commit message apache#11: remove id in config # This is the commit message apache#12: fix doc # This is the commit message apache#13: add test framework # This is the commit message apache#14: add alertmanager sink & test & doc # This is the commit message apache#15: beautify the doc
Implemented deletion-related interfaces in FileNodeProcessor and FileNodeManager.