-
Notifications
You must be signed in to change notification settings - Fork 3k
Core: add delete option for bin-packing #3454
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
| posDeleteWriter.delete(dataFile.path(), 1); | ||
| posDeleteWriter.close(); | ||
| rowDelta.addDeletes(posDeleteWriter.toDeleteFile()); | ||
| } |
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.
I know there are some repeated code here for generating deletes. So far I am still not sure what is the correct boundary to create util methods. I am planning to refactor after I add more tests for the RewriteDeleteStrategy
| * <p> | ||
| * Defaults to Integer.MAX_VALUE, which means this feature is not enabled by default. | ||
| */ | ||
| public static final String MIN_DELETES_PER_FILE = "min-deletes-per-file"; |
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.
What value is recommended to the user? Or how does the user compute the proper value? I'm thinking maybe adding an option to count filegroup valid if any file of it contains deletes. Because you don't know how many records match the equality delete, for example, delete a set of records in an area/province.
Nit: This is disabled by default but it is always comparing.
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.
I think it's fine to just do this based on the number of files since the read penalty is directly related to the number of files and less so to the amount of actual rows deleted.
No strong feeling on the default since we already have the amount of delete files in the task information so I don't think the check is very expensive
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.
Also, do we need to have specific settings for equality delete and position delete separately? Since the read penalties are different.
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.
I think that is equivalent to setting this value to 0?
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.
I think the exact value to set depends on the user's tolerance of read performance, because more deletes means worse read performance and potentially getting out of memory, so users can tune this value based on their system requirements.
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.
I think that is equivalent to setting this value to 0?
Hm, that's it.
RussellSpitzer
left a comment
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.
This looks good to me based on our discussions of how the Binpack and Sort algorithms should be modified.
kbendick
left a comment
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.
This looks good!
A question for my own understanding, but overall +1. Thanks @jackye1995.
| import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.Iterables; | ||
| import org.assertj.core.util.Lists; |
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.
Question / Nit: Is there a reason to use Lists from assertj instead of Lists from the relocated google commons library?
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.
oh nice catch, should not use that. We need to add it to checkstyle.
|
|
||
| @Test | ||
| public void testBinPackWithDeletes() throws Exception { | ||
| Table table = createTablePartitioned(4, 2); |
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.
Nit: Would it be worth while to add inline comments to explain these parameters (like createTablePartitioned(4 /* ??? */, 2 /* ??? */)? Right now, it's hard to tell immediately what these arguments are, but I'll leave the choice to you.
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.
I think this is not needed, because you can see the meaning of the parameters in Intellij
chenjunjiedada
left a comment
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.
+1
|
@aokolnychyi any additional comments? Otherwise I think this is mostly ready to be merged |
|
Looks like there are a few approvals here. Given that @RussellSpitzer who implemented this part of the code approved, I will wait until EOD today, if there is no additional comments, I will merge this, thanks everyone. |
| BinPackStrategy.MIN_INPUT_FILES, Integer.toString(5), | ||
| BinPackStrategy.MAX_FILE_SIZE_BYTES, Long.toString(550 * MB), | ||
| BinPackStrategy.MIN_FILE_SIZE_BYTES, Long.toString(490 * MB), | ||
| BinPackStrategy.MIN_DELETES_PER_FILE, Integer.toString(2) |
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.
@kbendick, can you check our checkstyle config? It looks like lines that have incorrect indentation are getting through.
|
@jackye1995, thanks for getting this done! Sorry I didn't have a chance to review it sooner. My only comment is that I don't think that we are using "min" in a consistent way so the option names may be confusing. For file sizes, min and max are the min and max allowed file sizes. Anything that is larger than max or less than min gets rewritten. But min deletes per file is actually the minimum before taking action. In other words, it is the maximum allowed number of delete files. I'd prefer making these consistent and using |
Add an option
min-deletes-per-fileto allow rewriting files with certain number of deletes. This does not remove the deletes. It is used to solve the situation that a file is already of optimized size and never included in for bin packing, but deletes are associated with it so the deletes cannot be expired.