Skip to content
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

[Bug]: Insert directly into compressed chunk doesn't update compression state #7026

Open
erimatnor opened this issue Jun 12, 2024 · 2 comments
Labels

Comments

@erimatnor
Copy link
Contributor

erimatnor commented Jun 12, 2024

What type of bug is this?

Unexpected error

What subsystems and features are affected?

Compression

What happened?

When inserting data directly into a compressed chunk (not via the hypertable), the "partially compressed" state is not properly updated. This prevents running recompression, instead leading to an error.

TimescaleDB version affected

2.15.2

PostgreSQL version used

16.2

What operating system did you use?

Ubuntu 24.04

What installation method did you use?

Source

What platform did you run on?

Other

Relevant log output and stack trace

insert into :chunk3 values ('2022-06-15 16:00', 8, 8, 8.0, 8.0);
select * from only :chunk3;
          created_at          | location_id | device_id | temp | humidity 
------------------------------+-------------+-----------+------+----------
 Wed Jun 15 16:00:00 2022 PDT |           8 |         8 |    8 |        8
(1 row)

select compress_chunk(:'chunk3');
NOTICE:  chunk "_hyper_1_5_chunk" is already compressed
             compress_chunk             
----------------------------------------
 _timescaledb_internal._hyper_1_5_chunk
(1 row)

How can we reproduce the bug?

1. Create a table with at least one chunk.
2. Insert a row directly into a chunk as shown above.
3. Run compress_chunk() on the chunk and an error will be shown.
@erimatnor erimatnor added the bug label Jun 12, 2024
@nikkhils
Copy link
Contributor

nikkhils commented Jun 17, 2024

@erimatnor @antekresic as a rule, shouldn't we reject direct INSERTs into a compressed chunk?

@erimatnor
Copy link
Contributor Author

@erimatnor @antekresic as a rule, shouldn't we reject direct INSERTs into a compressed chunk?

That's an option, but I see no reason to reject it because it is a valid insert and uncompressed data goes into that chunk anyway. The only difference when inserting via hypertable is that the data is routed to the chunk instead of going directly. The routing is also where the partial compressed state is updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants