-
Notifications
You must be signed in to change notification settings - Fork 3k
Core: Skip unnecessary metadata refresh after merge append #14709
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3271,6 +3271,11 @@ public void testCatalogWithCustomMetricsReporter() throws IOException { | |
| assertThat(CustomMetricsReporter.SCAN_COUNTER.get()).isEqualTo(1); | ||
| // reset counter in case subclasses run this test multiple times | ||
| CustomMetricsReporter.SCAN_COUNTER.set(0); | ||
|
|
||
| // append file through MergeAppend and check and reset counter | ||
| table.newAppend().appendFile(FILE_A).commit(); | ||
| assertThat(CustomMetricsReporter.COMMIT_COUNTER.get()).isEqualTo(1); | ||
| CustomMetricsReporter.COMMIT_COUNTER.set(0); | ||
|
Comment on lines
+3276
to
+3278
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry not entirely following, what additional behavior related to this change are we trying test here? This just looks like it verifies the commit is performed and the metrics after that. |
||
| } | ||
|
|
||
| public static class CustomMetricsReporter implements MetricsReporter { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4326,6 +4326,23 @@ public void testTableCacheAgeDoesNotRefreshesAfterAccess() { | |
| .isEqualTo(HALF_OF_TABLE_EXPIRATION); | ||
| } | ||
|
|
||
| @Test | ||
| public void testNumLoadTableCallsForMergeAppend() { | ||
| RESTCatalogAdapter adapter = Mockito.spy(new RESTCatalogAdapter(backendCatalog)); | ||
|
|
||
| RESTCatalog catalog = catalog(adapter); | ||
|
|
||
| catalog.createNamespace(TABLE.namespace()); | ||
|
|
||
| BaseTable table = (BaseTable) catalog.createTable(TABLE, SCHEMA); | ||
|
|
||
| table.newAppend().appendFile(FILE_A).commit(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before the commit, we may want to extract out the CreateSnapshotEvent and assert it's what we expect, since that's the part we're changing? |
||
|
|
||
| // loadTable is executed once | ||
| Mockito.verify(adapter) | ||
| .execute(reqMatcher(HTTPMethod.GET, RESOURCE_PATHS.table(TABLE)), any(), any(), any()); | ||
| } | ||
|
|
||
| private RESTCatalog catalog(RESTCatalogAdapter adapter) { | ||
| RESTCatalog catalog = | ||
| new RESTCatalog(SessionCatalog.SessionContext.createEmpty(), (config) -> adapter); | ||
|
|
||
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.
Thanks a lot for the changes, @gaborkaszab ! Should we check if
opsis an instance ofRESTTableOperationsto ensure this is REST operation?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.
That is the other approach I was considering. I didn't want (Merging)SnapshotProducer to know about what is the underlying TableOps implementation and I preferred this more general approach. Basically, instead of asking "is this REST ops?" I ask "do we have this snapshot" that seemed more robust and general.
WDYT @flyrain ?
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.
Thanks for the explanation. To be clear, I'm all for a generic way instead of dedicating to one type of table operation. My confusion and concern came from the PR description as the following:
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.
Thanks for pointing that out, @flyrain ! I updated the description to be a bit more generic, and use RESTTableOperations as an example.