-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add API to return automatic compaction config history #13699
Conversation
server/src/main/java/org/apache/druid/server/coordinator/DataSourceCompactionConfigHistory.java
Show resolved
Hide resolved
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 is very useful, @suneet-s !
+1 after CI passes
if (newEntry != null || (current != null && !hasDataSourceCompactionConfig)) { | ||
if (newEntry == null) { | ||
newEntry = new DatasourceCompactionConfigAuditEntry( | ||
new DatasourceCompactionConfigAuditEntry.GlobalCompactionConfig( | ||
coordinatorCompactionConfig.getCompactionTaskSlotRatio(), | ||
coordinatorCompactionConfig.getMaxCompactionTaskSlots(), | ||
coordinatorCompactionConfig.isUseAutoScaleSlots() | ||
), | ||
null, | ||
auditInfo, | ||
auditTime | ||
); | ||
} | ||
auditEntries.push(newEntry); | ||
} |
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: maybe simplify this for readability:
if (newEntry != null) {
auditEntries.push(newEntry);
} else if (current != null && !hasDataSourceCompactionConfig) {
newEntry = ...
auditEntries.push(newEntry);
}
/** | ||
* A DTO containing audit information for compaction config for a datasource. | ||
*/ | ||
public class DatasourceCompactionConfigAuditEntry |
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: Rename to DataSourceCompactionConfigAuditEntry
with a capitalized S
in DataSource
, similar to rest of the classes here.
count | ||
); | ||
} else { | ||
auditEntries = auditManager.fetchAuditHistory( |
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.
Can a user pass in both interval and count?
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 copied the pattern in CoordinatorDynamicConfigsResource#getDatasourceRuleHistory
where it looks like we ignore the count silently if the interval is specified.
Add a new API to return the history of changes to automatic compaction config history to make it easy for users to see what changes have been made to their auto-compaction config. The API is scoped per dataSource to allow users to triage issues with an individual dataSource. The API responds with a list of configs when there is a change to either the settings that impact all auto-compaction configs on a cluster or the dataSource in question.
Description
Add a new API to return the history of changes to automatic compaction config history to make it easy for users to see what changes have been made to their auto-compaction config.
The API is scoped per dataSource to allow users to triage issues with an individual dataSource. The API responds with a list of configs when there is a change to either the settings that impact all auto-compaction configs on a cluster or the dataSource in question.
I had considered adding another API to expose the entire compaction config history as it was stored in the audit table, however I chose against doing this, as I didn't think users would want the ability to see this global view.
Release note
New: You can now get the history of changes to automatic compaction config for a dataSource via an API.
Key changed/added classes in this PR
DataSourceCompactionConfigHistory#add
- Ensures that only changes that affect a particular dataSource's auto-compaction config are added to the historyCoordinatorCompactionConfigsResource#getCompactionConfigHistory
- the API endpointThis PR has: