Skip to content

Commit 7252ed7

Browse files
committed
ts_chunk_is_compressed
1 parent b0586b9 commit 7252ed7

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

tsl/src/chunk_merge.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ chunk_merge_chunks(PG_FUNCTION_ARGS)
13551355
* Fill in the compressed mergerelinfo array here after final sort of
13561356
* rels so that the two arrays have the same order.
13571357
*/
1358-
if (chunk->fd.compressed_chunk_id != INVALID_CHUNK_ID)
1358+
if (ts_chunk_is_compressed(chunk))
13591359
{
13601360
RelationMergeInfo *crelinfo = &crelinfos[i];
13611361
Chunk *cchunk = ts_chunk_get_by_id(chunk->fd.compressed_chunk_id, true);
@@ -1395,7 +1395,7 @@ chunk_merge_chunks(PG_FUNCTION_ARGS)
13951395
const CompressionSettings *result_settings = NULL;
13961396
const Chunk *result_chunk = relinfos[mergeindex].chunk;
13971397

1398-
if (result_chunk->fd.compressed_chunk_id != INVALID_CHUNK_ID)
1398+
if (ts_chunk_is_compressed(result_chunk))
13991399
{
14001400
result_settings = ts_compression_settings_get(result_chunk->table_id);
14011401
}
@@ -1405,7 +1405,7 @@ chunk_merge_chunks(PG_FUNCTION_ARGS)
14051405
const Chunk *chunk = relinfos[i].chunk;
14061406
const CompressionSettings *settings;
14071407

1408-
if (i == mergeindex || chunk->fd.compressed_chunk_id == INVALID_CHUNK_ID)
1408+
if (i == mergeindex || !ts_chunk_is_compressed(chunk))
14091409
{
14101410
continue;
14111411
}

tsl/src/compression/api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ find_chunk_to_merge_into(Hypertable *ht, Chunk *current_chunk)
314314
/* If there is no previous adjacent chunk along the time dimension or
315315
* if it hasn't been compressed yet, we can't merge.
316316
*/
317-
if (!previous_chunk || !OidIsValid(previous_chunk->fd.compressed_chunk_id))
317+
if (!previous_chunk || !ts_chunk_is_compressed(previous_chunk))
318318
{
319319
return NULL;
320320
}
@@ -633,7 +633,7 @@ decompress_chunk_impl(Chunk *uncompressed_chunk, bool if_compressed)
633633
elog(ERROR, "hypertable and chunk do not match");
634634
}
635635

636-
if (uncompressed_chunk->fd.compressed_chunk_id == INVALID_CHUNK_ID)
636+
if (!ts_chunk_is_compressed(uncompressed_chunk))
637637
{
638638
ts_cache_release(&hcache);
639639
ereport((if_compressed ? NOTICE : ERROR),
@@ -1098,9 +1098,9 @@ tsl_get_compressed_chunk_index_for_recompression(PG_FUNCTION_ARGS)
10981098
static Oid
10991099
get_compressed_chunk_index_for_recompression(Chunk *uncompressed_chunk)
11001100
{
1101-
Chunk *compressed_chunk = ts_chunk_get_by_id(uncompressed_chunk->fd.compressed_chunk_id, true);
1101+
Oid compressed_relid = ts_relation_get_compressed_relid(uncompressed_chunk->table_id);
11021102
Relation uncompressed_chunk_rel = table_open(uncompressed_chunk->table_id, AccessShareLock);
1103-
Relation compressed_chunk_rel = table_open(compressed_chunk->table_id, AccessShareLock);
1103+
Relation compressed_chunk_rel = table_open(compressed_relid, AccessShareLock);
11041104

11051105
CompressionSettings *settings = ts_compression_settings_get(uncompressed_chunk->table_id);
11061106

0 commit comments

Comments
 (0)