Skip to content
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

feat: filter out trimmed data on compaction #379

Merged
merged 9 commits into from
Oct 24, 2023
Merged

Conversation

SCNieh
Copy link
Contributor

@SCNieh SCNieh commented Oct 19, 2023

use stream metadata to identify trimmed data blocks instead of object metadata

@github-actions
Copy link

github-actions bot commented Oct 19, 2023

Qodana for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

@codecov
Copy link

codecov bot commented Oct 19, 2023

The author of this PR, SCNieh, is not an activated member of this organization on Codecov.
Please activate this user on Codecov to display this PR comment.
Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.
Please don't hesitate to email us at [email protected] with any questions.

CompletableFuture<List<StreamMetadata>> streamMetadataFuture = this.streamManager.getOpeningStreams();
CompletableFuture<List<S3ObjectMetadata>> objectMetadataFuture = this.objectManager.getServerObjects();
return CompletableFuture.allOf(streamMetadataFuture, objectMetadataFuture).thenApplyAsync(v -> {
List<StreamMetadata> streamMetadataList = streamMetadataFuture.join();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 我们风格对齐一下,我看大家都习惯把Future命名为xxxCf,也挺好的。
  2. allOf + join 这个写法总感觉让人不放心,因为join涉及到异常的,是不是aCf.thenCombine(bCf, Pair::new).thenApplyAsync() 更好点。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved in #379

@@ -384,6 +428,10 @@ boolean sanityCheckCompactionResult(List<S3ObjectMetadata> objectsToSplit, List<
for (long objectId : request.getCompactedObjectIds()) {
S3ObjectMetadata metadata = objectMetadataMap.get(objectId);
for (StreamOffsetRange streamOffsetRange : metadata.getOffsetRanges()) {
if (!streamMetadataMap.containsKey(streamOffsetRange.getStreamId()) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里加一点注释,为什么我们需要这么做?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved in #379

}
if (streamDataBlock.getStartOffset() < streamMetadataMap.get(streamDataBlock.getStreamId()).getStartOffset()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use block.endOffset <= stream.startOffset to filter

}
}, executorService));
this.scheduledExecutorService.execute(() -> {
CompletableFuture<List<StreamMetadata>> streamMetadataCf = this.streamManager.getOpeningStreams();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StreamManager#getOpeningStreams will get the current node opening streams

@daniel-y daniel-y marked this pull request as draft October 20, 2023 10:52
@daniel-y
Copy link
Contributor

Merge after this issue closed: #419

@SCNieh SCNieh marked this pull request as ready for review October 24, 2023 06:22
@SCNieh SCNieh merged commit 10b664a into main Oct 24, 2023
8 of 9 checks passed
@SCNieh SCNieh deleted the compact_trimmed_data branch October 24, 2023 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants