This is an automated backport of #6931: Do not decompress batches for COPY with potentially invalid slot.
The original issue is #6540.
This PR will be merged automatically after all the relevant CI checks pass. If this fix should not be backported, or will be backported manually, just close this PR. You can use the backport branch to add your changes, it won't be modified automatically anymore.
Do not decompress batches for COPY with potentially invalid slot
We don't have to decompress anything more when we re-lookup the chunk insert state on COPY buffer flush. Moreover, ChunkInsertState.slots[0] is incorrect slot type for decompress_batches_for_insert(), because it is a chunk slot, not a hypertable slot. This can lead to rare errors when the chunk insert states go out of cache.
Just don't do this unnecessary lookup, and move decompression to a separate function for clarity. Add an assertion and test that detect the slot type mismatch on main.
This is an automated backport of #6931: Do not decompress batches for COPY with potentially invalid slot. The original issue is #6540. This PR will be merged automatically after all the relevant CI checks pass. If this fix should not be backported, or will be backported manually, just close this PR. You can use the backport branch to add your changes, it won't be modified automatically anymore.
For more details, please see the documentation
Original description
Do not decompress batches for COPY with potentially invalid slot
We don't have to decompress anything more when we re-lookup the chunk insert state on COPY buffer flush. Moreover,
ChunkInsertState.slots[0]
is incorrect slot type fordecompress_batches_for_insert()
, because it is a chunk slot, not a hypertable slot. This can lead to rare errors when the chunk insert states go out of cache.Just don't do this unnecessary lookup, and move decompression to a separate function for clarity. Add an assertion and test that detect the slot type mismatch on main.
There was a related fix that improved the situation for empty copy buffers, but not for wrong slot type https://github.com/timescale/timescaledb/pull/6117
Fixes https://github.com/timescale/timescaledb/issues/6540