-
Notifications
You must be signed in to change notification settings - Fork 889
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 drop chunk hook for OSM #6067
Conversation
Codecov Report
@@ Coverage Diff @@
## main #6067 +/- ##
==========================================
- Coverage 81.52% 81.50% -0.03%
==========================================
Files 246 246
Lines 56714 56727 +13
Branches 12572 12568 -4
==========================================
- Hits 46236 46233 -3
+ Misses 8103 8083 -20
- Partials 2375 2411 +36
... and 41 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
df06528
to
f882c94
Compare
src/chunk.c
Outdated
@@ -3890,6 +3889,7 @@ ts_chunk_do_drop_chunks(Hypertable *ht, int64 older_than, int64 newer_than, int3 | |||
|
|||
{ | |||
uint64 num_chunks = 0; | |||
int32 osm_chunk_id = 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.
int32 osm_chunk_id = 0; |
0db4a5b
to
8b2bf1f
Compare
tsl/test/src/test_chunk_stats.c
Outdated
osm_ht_drop_chunks_hook_mock(Oid osm_chunk_oid, const char *schema_name, const char *table_name, | ||
int64 range_start, int64 range_end) | ||
{ | ||
elog(NOTICE, "hypertable_drop_chunks_hook (%ld %ld)", range_start, range_end); |
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.
elog(NOTICE, "hypertable_drop_chunks_hook (%ld %ld)", range_start, range_end); | |
elog(NOTICE, "hypertable_drop_chunks_hook (" INT64_FORMAT " " INT64_FORMAT ")", range_start, range_end); |
tsl/test/src/test_chunk_stats.c
Outdated
for (int i = 1; i < 2; i++) | ||
{ | ||
char *chunk_name; | ||
chunk_name = psprintf("%s", "_timescaledb_internal.dummy"); | ||
ret = lappend(ret, chunk_name); | ||
} |
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 is the purpose of this for loop?
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.
fixed.
int64 range_start = ts_internal_to_time_int64(newer_than, dim->fd.column_type); | ||
int64 range_end = ts_internal_to_time_int64(older_than, dim->fd.column_type); | ||
Chunk *osm_chunk = ts_chunk_get_by_id(osm_chunk_id, true); | ||
List *osm_dropped_names = osm_drop_chunks_hook(osm_chunk->table_id, |
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.
Since those are osm-internal objects it makes no sense to return them to timescaledb.
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.
the drop_chunks api prints the names of the dropped chunks today.
I think we need to make the call on the OSM side whether these values should be printed or not when drop_chunks is invoked.
So far, we have been consistent with the behavior across APIs.
I don't want to change the hook definition in case we decide that drop_chunks should also behave consistently.
b6fb493
to
644b58b
Compare
Introduce version number for OsmCallbacks struct Add a callback for cascading drop chunks to OSM and integrate with drop_chunks Add backward compatibility for OsmCallbacks
Add a callback for cascading drop chunks to OSM and integrate with drop_chunks
Add tests to verify that callbacks are triggered for drop_chunks