-
Notifications
You must be signed in to change notification settings - Fork 459
Log more information about why compaction can not be planned #5532
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
For the case when a tablet has more than tablet.file.max files and a compaction can not be planned, log more information about what went into the planning process.
Manually tested this by running the unit test for the class and examining the log output. Saw the following. Also had to adjust the log config for the test run.
|
* @return the tablet for which a compaction is being planned | ||
* @since 2.1.4 | ||
*/ | ||
TabletId getTabletId(); |
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.
Is there an issue with adding this method in a bugfix release? This would cause a build and runtime issue for any user that has their own CompactionPlanner implementation written against 2.1.4 and deploys it to a 2.1.3 instance, right? I'm wondering if this should be a default
method that returns null
(not throws a UnsupportedOperationException).
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'm wondering if this should be a default method that returns null (not throws a UnsupportedOperationException).
Returning null would not be the best long term behavior (like the behavior we would want in 4.0). I was worried about adding this, but chose this approach because a few lines up there is the following and I just followed its precedent.
/**
* @return The id of the namespace that the table is assigned to
* @throws TableNotFoundException thrown when the namespace for a table cannot be calculated
* @since 2.1.4
*/
NamespaceId getNamespaceId() throws TableNotFoundException;
Whatever we do here, we probably need to do that consistently for all changes like this in 2.1.4.
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 for a 3.1 and a 4.0 we could remove the default method that returns null and just leave the method declaration in the interface. I think this change (and the other that you pointed out) potentially make a 2.1.4 api implementation not backwards compatible.
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 leaving these methods unimplemented w/o a default impl is best because that is the most straightforward way for a developer to know they need to do something if they implemented this interface. If a user were to implement this interface it would most likely be for testing and it would be easy for a developer to deai with test code not implementing a method. If we want to add default method I think it would be best to throw unsupported op exception instead of returning null. Returning null has the potential to cause runtime exceptions that are far from the method that returned null, making it harder to track down. The unsupported op exception makes the issue easy to track down. We have returned unsupported op exception in other places in the past and that turned out to be bad, but that was a bit different. In this case its a completely new method that no 2.1.3 code could have called, we are not all of a sudden throwing that exception for an existing method.
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 agree that leaving the methods unimplemented is better since a user would run into a compile time error vs a runtime error in a production deployment.
For the case when a tablet has more than tablet.file.max files and a compaction can not be planned, log more information about what went into the planning process.