@@ -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)
10981098static Oid
10991099get_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