Skip to content

Commit

Permalink
modify code to account for OSM chunks having valid ranges
Browse files Browse the repository at this point in the history
in the catalog
  • Loading branch information
gayyappan committed Sep 19, 2023
1 parent 45edc0e commit bc3a6e1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 362 deletions.
12 changes: 10 additions & 2 deletions src/chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -3960,6 +3960,7 @@ ts_chunk_do_drop_chunks(Hypertable *ht, int64 older_than, int64 newer_than, int3

DEBUG_WAITPOINT("drop_chunks_chunks_found");

int32 osm_chunk_id = ts_chunk_get_osm_chunk_id(ht->fd.id);
if (has_continuous_aggs)
{
/* Exclusively lock all chunks, and invalidate the continuous
Expand Down Expand Up @@ -3989,6 +3990,11 @@ ts_chunk_do_drop_chunks(Hypertable *ht, int64 older_than, int64 newer_than, int3
* therefore be able to refresh accordingly.*/
for (uint64 i = 0; i < num_chunks; i++)
{
if (osm_chunk_id == chunks[i].fd.id)
{
// we do not rebuild continuous aggs if tiered data is dropped */
continue;

Check warning on line 3996 in src/chunk.c

View check run for this annotation

Codecov / codecov/patch

src/chunk.c#L3996

Added line #L3996 was not covered by tests
}
int64 start = ts_chunk_primary_dimension_start(&chunks[i]);
int64 end = ts_chunk_primary_dimension_end(&chunks[i]);

Expand All @@ -4008,8 +4014,11 @@ ts_chunk_do_drop_chunks(Hypertable *ht, int64 older_than, int64 newer_than, int3
/* frozen chunks are skipped. Not dropped. */
if (!ts_chunk_validate_chunk_status_for_operation(&chunks[i],
CHUNK_DROP,
false /*throw_error */))
false /*throw_error */) ||
osm_chunk_id == chunks[i].fd.id)
{
continue;
}

/* store chunk name for output */
schema_name = quote_identifier(chunks[i].fd.schema_name.data);
Expand All @@ -4032,7 +4041,6 @@ ts_chunk_do_drop_chunks(Hypertable *ht, int64 older_than, int64 newer_than, int3
}
// if we have tiered chunks cascade drop to tiering layer as well
#if PG14_GE
int32 osm_chunk_id = ts_chunk_get_osm_chunk_id(ht->fd.id);

if (osm_chunk_id != INVALID_CHUNK_ID)
{
Expand Down
Loading

0 comments on commit bc3a6e1

Please sign in to comment.