mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-19 04:03:06 +08:00
Fix segmentation fault due to incorrect call to chunk_scan_internal
chunk_scan_internal is called with 2 callback functions, a filter function and a tuple_found function that are invoked with the same argument. ts_chunk_set_compressed and ts_chunk_clear_compressed use chunk_tuple_dropped_filter but do not pass in the required ChunkStubScanCtx* as argument. Instead an argument of type int* is passed in. This causes a segmentation fault. Add a new chunk filter function that is compatible with the tuple_found function used by ts_chunk_clear_compressed_chunk and ts_chunk_set_compressed_chunk Fixes #3158
This commit is contained in:
parent
99ffe8fd6c
commit
80b915d001
@ -10,8 +10,12 @@ accidentally triggering the load of a previous DB version.**
|
|||||||
* #3209 Propagate grants to compressed hypertables
|
* #3209 Propagate grants to compressed hypertables
|
||||||
* #3241 Fix assertion failure in decompress_chunk_plan_create
|
* #3241 Fix assertion failure in decompress_chunk_plan_create
|
||||||
* #3250 Fix constraint triggers on hypertables
|
* #3250 Fix constraint triggers on hypertables
|
||||||
|
* #3251 Fix segmentation fault due to incorrect call to chunk_scan_internal
|
||||||
* #3252 Fix blocking triggers with transition tables
|
* #3252 Fix blocking triggers with transition tables
|
||||||
|
|
||||||
|
**Thanks**
|
||||||
|
* @yyjdelete for reporting a crash with decompress_chunk and identifying the bug in the code
|
||||||
|
|
||||||
## 2.2.1 (2021-05-05)
|
## 2.2.1 (2021-05-05)
|
||||||
|
|
||||||
This maintenance release contains bugfixes since the 2.2.0 release. We
|
This maintenance release contains bugfixes since the 2.2.0 release. We
|
||||||
|
22
src/chunk.c
22
src/chunk.c
@ -1322,6 +1322,24 @@ chunk_tuple_dropped_filter(TupleInfo *ti, void *arg)
|
|||||||
return stubctx->is_dropped ? SCAN_EXCLUDE : SCAN_INCLUDE;
|
return stubctx->is_dropped ? SCAN_EXCLUDE : SCAN_INCLUDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is a modified version of chunk_tuple_dropped_filter that does
|
||||||
|
* not use ChunkStubScanCtx as the arg, it just ignores the passed in
|
||||||
|
* argument.
|
||||||
|
* We need a variant as the ScannerCtx assumes that the the filter function
|
||||||
|
* and tuple_found function share the argument.
|
||||||
|
*/
|
||||||
|
static ScanFilterResult
|
||||||
|
chunk_check_ignorearg_dropped_filter(TupleInfo *ti, void *arg)
|
||||||
|
{
|
||||||
|
bool isnull;
|
||||||
|
Datum dropped = slot_getattr(ti->slot, Anum_chunk_dropped, &isnull);
|
||||||
|
|
||||||
|
Assert(!isnull);
|
||||||
|
bool is_dropped = DatumGetBool(dropped);
|
||||||
|
|
||||||
|
return is_dropped ? SCAN_EXCLUDE : SCAN_INCLUDE;
|
||||||
|
}
|
||||||
|
|
||||||
static ScanTupleResult
|
static ScanTupleResult
|
||||||
chunk_tuple_found(TupleInfo *ti, void *arg)
|
chunk_tuple_found(TupleInfo *ti, void *arg)
|
||||||
{
|
{
|
||||||
@ -3128,7 +3146,7 @@ ts_chunk_set_compressed_chunk(Chunk *chunk, int32 compressed_chunk_id)
|
|||||||
return chunk_scan_internal(CHUNK_ID_INDEX,
|
return chunk_scan_internal(CHUNK_ID_INDEX,
|
||||||
scankey,
|
scankey,
|
||||||
1,
|
1,
|
||||||
chunk_tuple_dropped_filter,
|
chunk_check_ignorearg_dropped_filter,
|
||||||
chunk_set_compressed_id_in_tuple,
|
chunk_set_compressed_id_in_tuple,
|
||||||
&compressed_chunk_id,
|
&compressed_chunk_id,
|
||||||
0,
|
0,
|
||||||
@ -3151,7 +3169,7 @@ ts_chunk_clear_compressed_chunk(Chunk *chunk)
|
|||||||
return chunk_scan_internal(CHUNK_ID_INDEX,
|
return chunk_scan_internal(CHUNK_ID_INDEX,
|
||||||
scankey,
|
scankey,
|
||||||
1,
|
1,
|
||||||
chunk_tuple_dropped_filter,
|
chunk_check_ignorearg_dropped_filter,
|
||||||
chunk_clear_compressed_status_in_tuple,
|
chunk_clear_compressed_status_in_tuple,
|
||||||
&compressed_chunk_id,
|
&compressed_chunk_id,
|
||||||
0,
|
0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user