From 252cd9866d0e95f4c3dd0833d7cad6c0f3b03531 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 1 Feb 2024 14:07:17 +0100 Subject: [PATCH] Fix UBSan failure in bulk text decompression Fix missing alignment handling, and also buffer size problems. We were not properly reporting the failures in the compression_algo tests, so didn't notice these problems. Add part of tests from "vector text predicates" PR to improve coverage. --- .github/workflows/libfuzzer.yaml | 13 ++-- .../workflows/sanitizer-build-and-test.yaml | 11 ++- scripts/upload_ci_stats.sh | 3 +- tsl/src/compression/array.c | 64 +++++++++++++---- tsl/src/compression/compression.h | 2 +- tsl/src/compression/dictionary.c | 1 + tsl/src/compression/gorilla_impl.c | 4 +- .../compression/simple8b_rle_decompress_all.h | 5 ++ tsl/test/expected/compression_algos.out | 16 ++--- tsl/test/expected/decompress_vector_qual.out | 68 ++++++++++++++++++ .../01accf1c403c681e8ccc10349c97a28ef2afbdd3 | Bin 0 -> 1046 bytes .../3f82cf837a5f3fae26f7cbb25ed3d903eed71687 | Bin 0 -> 1167 bytes .../5d1be7e9dda1ee8896be5b7e34a85ee16452a7b4 | 1 + .../6a126964d691ada7de1d25c976c4e7b481858665 | Bin 0 -> 36 bytes .../bc6960f7ed1b4b216c5cbc2721ea5136ffb80aae | Bin 0 -> 1081 bytes .../c2588a11e70caad0b9c91272f81d48348b94f938 | Bin 0 -> 1259 bytes .../d57ef126bce1cf2bb5a63addf172a9cf9bedb7da | Bin 0 -> 1078 bytes .../ebddebf24b791e82c4ac007197581ec4fa2886ee | Bin 0 -> 163 bytes .../ec536d9d30f08137531d4bfe676a545d897ae98b | Bin 0 -> 1155 bytes .../fuzzing/compression/array-text/length-saw | Bin 0 -> 62444 bytes .../03be2aaf02e2f78738dcd55209eb660c63460f73 | Bin 0 -> 625 bytes .../0ce9675bea488114cd61e0902df0f65bb266b414 | Bin 0 -> 625 bytes .../193ff1ad23aaeaa8feafcbe7168f259e5063e715 | Bin 0 -> 1221 bytes .../24a09483ef45200b6ed894e43934767755155e3d | Bin 0 -> 77 bytes .../2dd04d16222832a133c966eb5e9c4e7ae4d31059 | Bin 0 -> 115 bytes .../3902e1ec9e8894b6befc97144a957e69f696bc75 | Bin 0 -> 193 bytes .../39e6777ccb030519cefc62205e2df23e703aa9fa | Bin 0 -> 89 bytes .../3b2185a90d32decad650ceb443751a4023368cdd | Bin 0 -> 167 bytes .../446dbbeac1d19ca3ac51def5be4e9fcccf97cdc6 | Bin 0 -> 80 bytes .../48ddda607e4778f35289784b3f6c80234660856d | Bin 0 -> 72 bytes .../4979455aba5b4c7d302af47c4fd941214e16d3a9 | Bin 0 -> 72 bytes .../5e81672e813bd1e06ecba224f520328498f27ea8 | Bin 0 -> 161 bytes .../626bf1b65f1a0c5fba061fac07a711f970b07a80 | Bin 0 -> 626 bytes .../68c94392b09d47edea2a48f62808073bf83448f3 | Bin 0 -> 166 bytes .../75fc076b6fc8dac4f65c31fa4fd34ad236530422 | Bin 0 -> 105 bytes .../76fa9dc37fc42934404c72df57d296c663ee807d | Bin 0 -> 193 bytes .../79ef4a8ba594c7a2b611bc33fc8b83fe8ac14998 | Bin 0 -> 73 bytes .../7bbc7585698a7c3375bea9c3bcff8838722d8f64 | Bin 0 -> 57 bytes .../7be90a9058961ac6ee07f764618805dfe8b6cfae | Bin 0 -> 56 bytes .../8426e28aabe6684eb7200bd032ff0dad5a5169af | Bin 0 -> 57 bytes .../8a5c3216797d7a54adeafc86b708b942a9894b2f | Bin 0 -> 97 bytes .../9a78211436f6d425ec38f5c4e02270801f3524f8 | 1 + .../9b99593353a610c4bee0d6a94a01a3296080c0fb | Bin 0 -> 2 bytes .../a54a56388dd751dc1ea1727f8e2965b349b54800 | Bin 0 -> 620 bytes .../ae02ec1f395c202f6cd2965ea34d73dc35e10fdf | Bin 0 -> 137 bytes .../af094ea4a3607992332e87dbe90f1a0f0cf82e09 | Bin 0 -> 49 bytes .../b18ecac8feda2826b91131b386b8842a1fca17e5 | Bin 0 -> 108 bytes .../b931131d935fb27ebf7977285299dcf11bb52eb4 | Bin 0 -> 97 bytes .../e767ec96033f7d9da306711adab0a6557fd4b71e | Bin 0 -> 321 bytes .../f0f2e7efda77af51c83fe7870bd04d1b93556116 | Bin 0 -> 76 bytes .../f2d42e12fb2ed451e7ba0b270a9065916a391fb1 | Bin 0 -> 49 bytes .../f6377e2f32fd888f1877518c26bf6be4e24f92bd | Bin 0 -> 1073 bytes .../fc8f69146bf6f556444c5acd8053537a292db418 | Bin 0 -> 49 bytes .../fee17c65913f4eddcae3f69d1c2b6f318b938af2 | Bin 0 -> 72 bytes tsl/test/sql/decompress_vector_qual.sql | 37 ++++++++++ .../src/decompress_arithmetic_test_impl.c | 12 +++- tsl/test/src/decompress_text_test_impl.c | 12 +++- 57 files changed, 215 insertions(+), 35 deletions(-) create mode 100644 tsl/test/fuzzing/compression/array-text/01accf1c403c681e8ccc10349c97a28ef2afbdd3 create mode 100644 tsl/test/fuzzing/compression/array-text/3f82cf837a5f3fae26f7cbb25ed3d903eed71687 create mode 100644 tsl/test/fuzzing/compression/array-text/5d1be7e9dda1ee8896be5b7e34a85ee16452a7b4 create mode 100644 tsl/test/fuzzing/compression/array-text/6a126964d691ada7de1d25c976c4e7b481858665 create mode 100644 tsl/test/fuzzing/compression/array-text/bc6960f7ed1b4b216c5cbc2721ea5136ffb80aae create mode 100644 tsl/test/fuzzing/compression/array-text/c2588a11e70caad0b9c91272f81d48348b94f938 create mode 100644 tsl/test/fuzzing/compression/array-text/d57ef126bce1cf2bb5a63addf172a9cf9bedb7da create mode 100644 tsl/test/fuzzing/compression/array-text/ebddebf24b791e82c4ac007197581ec4fa2886ee create mode 100644 tsl/test/fuzzing/compression/array-text/ec536d9d30f08137531d4bfe676a545d897ae98b create mode 100644 tsl/test/fuzzing/compression/array-text/length-saw create mode 100644 tsl/test/fuzzing/compression/dictionary-text/03be2aaf02e2f78738dcd55209eb660c63460f73 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/0ce9675bea488114cd61e0902df0f65bb266b414 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/193ff1ad23aaeaa8feafcbe7168f259e5063e715 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/24a09483ef45200b6ed894e43934767755155e3d create mode 100644 tsl/test/fuzzing/compression/dictionary-text/2dd04d16222832a133c966eb5e9c4e7ae4d31059 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/3902e1ec9e8894b6befc97144a957e69f696bc75 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/39e6777ccb030519cefc62205e2df23e703aa9fa create mode 100644 tsl/test/fuzzing/compression/dictionary-text/3b2185a90d32decad650ceb443751a4023368cdd create mode 100644 tsl/test/fuzzing/compression/dictionary-text/446dbbeac1d19ca3ac51def5be4e9fcccf97cdc6 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/48ddda607e4778f35289784b3f6c80234660856d create mode 100644 tsl/test/fuzzing/compression/dictionary-text/4979455aba5b4c7d302af47c4fd941214e16d3a9 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/5e81672e813bd1e06ecba224f520328498f27ea8 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/626bf1b65f1a0c5fba061fac07a711f970b07a80 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/68c94392b09d47edea2a48f62808073bf83448f3 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/75fc076b6fc8dac4f65c31fa4fd34ad236530422 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/76fa9dc37fc42934404c72df57d296c663ee807d create mode 100644 tsl/test/fuzzing/compression/dictionary-text/79ef4a8ba594c7a2b611bc33fc8b83fe8ac14998 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/7bbc7585698a7c3375bea9c3bcff8838722d8f64 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/7be90a9058961ac6ee07f764618805dfe8b6cfae create mode 100644 tsl/test/fuzzing/compression/dictionary-text/8426e28aabe6684eb7200bd032ff0dad5a5169af create mode 100644 tsl/test/fuzzing/compression/dictionary-text/8a5c3216797d7a54adeafc86b708b942a9894b2f create mode 100644 tsl/test/fuzzing/compression/dictionary-text/9a78211436f6d425ec38f5c4e02270801f3524f8 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/9b99593353a610c4bee0d6a94a01a3296080c0fb create mode 100644 tsl/test/fuzzing/compression/dictionary-text/a54a56388dd751dc1ea1727f8e2965b349b54800 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/ae02ec1f395c202f6cd2965ea34d73dc35e10fdf create mode 100644 tsl/test/fuzzing/compression/dictionary-text/af094ea4a3607992332e87dbe90f1a0f0cf82e09 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/b18ecac8feda2826b91131b386b8842a1fca17e5 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/b931131d935fb27ebf7977285299dcf11bb52eb4 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/e767ec96033f7d9da306711adab0a6557fd4b71e create mode 100644 tsl/test/fuzzing/compression/dictionary-text/f0f2e7efda77af51c83fe7870bd04d1b93556116 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/f2d42e12fb2ed451e7ba0b270a9065916a391fb1 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/f6377e2f32fd888f1877518c26bf6be4e24f92bd create mode 100644 tsl/test/fuzzing/compression/dictionary-text/fc8f69146bf6f556444c5acd8053537a292db418 create mode 100644 tsl/test/fuzzing/compression/dictionary-text/fee17c65913f4eddcae3f69d1c2b6f318b938af2 diff --git a/.github/workflows/libfuzzer.yaml b/.github/workflows/libfuzzer.yaml index ac08fc7b7ec..ebe4354fb8b 100644 --- a/.github/workflows/libfuzzer.yaml +++ b/.github/workflows/libfuzzer.yaml @@ -49,7 +49,7 @@ jobs: # leading to a tainted cache - name: Cache PostgreSQL id: cache-postgresql - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/${{ env.PG_SRC_DIR }} key: "postgresql-libfuzzer-${{ steps.get-date.outputs.date }}-${{ hashFiles('.github/**') }}" @@ -145,7 +145,7 @@ jobs: uses: actions/checkout@v4 - name: Download the installation directory - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: fuzzing-install-dir @@ -240,9 +240,6 @@ jobs: exit 1 fi - # Check that the server is still alive. - psql -c "select 1" - ls db/corpus | wc -l fn="ts_read_compressed_data_directory('${{ matrix.case.algo }}', @@ -257,7 +254,7 @@ jobs: # Save interesting cases because the caches are not available for download from UI mkdir -p interesting psql -qtAX -c "select distinct on (location) 'db/' || path from $fn - order by location, bytes + order by location, bytes, path " | xargs cp -t interesting # Check that we don't have any internal errors @@ -267,10 +264,12 @@ jobs: echo "Internal program errors: $errors" [ $errors -eq 0 ] || exit 1 - # Shouldn't have any WARNINGS in the log. ! grep -F "] WARNING: " postgres.log + # Check that the server is still alive. + psql -c "select 1" + - name: Collect the logs if: always() id: collectlogs diff --git a/.github/workflows/sanitizer-build-and-test.yaml b/.github/workflows/sanitizer-build-and-test.yaml index ee1bb324f7d..261455cd48f 100644 --- a/.github/workflows/sanitizer-build-and-test.yaml +++ b/.github/workflows/sanitizer-build-and-test.yaml @@ -204,6 +204,11 @@ jobs: ./scripts/bundle_coredumps.sh grep -C40 "was terminated by signal" postgres.log > postgres-failure.log ||: + - name: Show sanitizer logs + if: always() + run: | + tail -vn +1 sanitizer* || : + - name: Coredumps if: always() && steps.collectlogs.outputs.coredumps == 'true' uses: actions/upload-artifact@v4 @@ -211,12 +216,14 @@ jobs: name: Coredumps ${{ matrix.os }} ${{ env.name }} ${{ matrix.pg }} path: coredumps - - name: sanitizer logs + - name: Upload sanitizer logs if: always() uses: actions/upload-artifact@v4 with: name: sanitizer logs ${{ matrix.os }} ${{ env.name }} ${{ matrix.pg }} - path: ${{ github.workspace }}/sanitizer + # The log_path sanitizer option means "Write logs to 'log_path.pid'". + # https://github.com/google/sanitizers/wiki/SanitizerCommonFlags + path: ${{ github.workspace }}/sanitizer* - name: Upload test results to the database if: always() diff --git a/scripts/upload_ci_stats.sh b/scripts/upload_ci_stats.sh index 38c0ff734da..e6b6ba7e85a 100755 --- a/scripts/upload_ci_stats.sh +++ b/scripts/upload_ci_stats.sh @@ -150,7 +150,8 @@ do done # Upload the logs. -for x in sanitizer/* {sqlsmith/sqlsmith,sanitizer,stacktrace,postgres-failure}.log *.diff +# Note that the sanitizer setting log_path means "write logs to 'log_path.pid'". +for x in sanitizer* sanitizer/* {sqlsmith/sqlsmith,sanitizer,stacktrace,postgres-failure}.log *.diff do if ! [ -e "$x" ]; then continue ; fi "${PSQL[@]}" <<<" diff --git a/tsl/src/compression/array.c b/tsl/src/compression/array.c index 78b8e6b2aa3..d73287c8a73 100644 --- a/tsl/src/compression/array.c +++ b/tsl/src/compression/array.c @@ -493,12 +493,18 @@ text_array_decompress_all_serialized_no_header(StringInfo si, bool has_nulls, Simple8bRleSerialized *sizes_serialized = bytes_deserialize_simple8b_and_advance(si); - uint32 sizes[GLOBAL_MAX_ROWS_PER_COMPRESSION]; + /* + * We need a quite significant padding of 63 elements, not bytes, after the + * last element, because we work in Simple8B blocks which can contain up to + * 64 elements. + */ + uint32 sizes[GLOBAL_MAX_ROWS_PER_COMPRESSION + 63]; const uint16 n_notnull = simple8brle_decompress_all_buf_uint32(sizes_serialized, sizes, sizeof(sizes) / sizeof(sizes[0])); const int n_total = has_nulls ? nulls_serialized->num_elements : n_notnull; + CheckCompressedData(n_total >= n_notnull); uint32 *offsets = (uint32 *) MemoryContextAllocZero(dest_mctx, @@ -509,22 +515,56 @@ text_array_decompress_all_serialized_no_header(StringInfo si, bool has_nulls, uint32 offset = 0; for (int i = 0; i < n_notnull; i++) { - void *vardata = consumeCompressedData(si, sizes[i]); + void *unaligned = consumeCompressedData(si, sizes[i]); + + /* + * We start reading from the end of previous datum, but this pointer + * might be not aligned as required for varlena-4b struct. We have to + * align it here. Note that sizes[i] includes the alignment as well in + * addition to the varlena size. + * + * See the corresponding row-by-row code in bytes_to_datum_and_advance(). + */ + void *vardata = DatumGetPointer(att_align_pointer(unaligned, TYPALIGN_INT, -1, unaligned)); + /* * Check for potentially corrupt varlena headers since we're reading them - * directly from compressed data. We can only have a plain datum - * with 1-byte or 4-byte header here, no TOAST or compressed data. + * directly from compressed data. */ - CheckCompressedData(VARATT_IS_4B_U(vardata) || - (VARATT_IS_1B(vardata) && !VARATT_IS_1B_E(vardata))); + if (VARATT_IS_4B_U(vardata)) + { + /* + * Full varsize must be larger or equal than the header size so that + * the calculation of size without header doesn't overflow. + */ + CheckCompressedData(VARSIZE_4B(vardata) >= VARHDRSZ); + } + else if (VARATT_IS_1B(vardata)) + { + /* Can't have a TOAST pointer here. */ + CheckCompressedData(!VARATT_IS_1B_E(vardata)); + + /* + * Full varsize must be larger or equal than the header size so that + * the calculation of size without header doesn't overflow. + */ + CheckCompressedData(VARSIZE_1B(vardata) >= VARHDRSZ_SHORT); + } + else + { + /* + * Can only have an uncompressed datum with 1-byte or 4-byte header + * here, no TOAST or compressed data. + */ + CheckCompressedData(false); + } + /* - * Full varsize must be larger or equal than the header size so that the - * calculation of size without header doesn't overflow. + * Size of varlena plus alignment must match the size stored in the + * sizes array for this element. */ - CheckCompressedData((VARATT_IS_1B(vardata) && VARSIZE_1B(vardata) >= VARHDRSZ_SHORT) || - (VARSIZE_4B(vardata) >= VARHDRSZ)); - /* Varsize must match the size stored in the sizes array for this element. */ - CheckCompressedData(VARSIZE_ANY(vardata) == sizes[i]); + const Datum alignment_bytes = PointerGetDatum(vardata) - PointerGetDatum(unaligned); + CheckCompressedData(VARSIZE_ANY(vardata) + alignment_bytes == sizes[i]); const uint32 textlen = VARSIZE_ANY_EXHDR(vardata); memcpy(&arrow_bodies[offset], VARDATA_ANY(vardata), textlen); diff --git a/tsl/src/compression/compression.h b/tsl/src/compression/compression.h index 7c391c0a854..5f917eaa7c1 100644 --- a/tsl/src/compression/compression.h +++ b/tsl/src/compression/compression.h @@ -377,7 +377,7 @@ extern enum CompressionAlgorithms compress_get_default_algorithm(Oid typeoid); */ #ifndef TS_COMPRESSION_FUZZING #define CORRUPT_DATA_MESSAGE(X) \ - (errmsg("the compressed data is corrupt"), errdetail(X), errcode(ERRCODE_DATA_CORRUPTED)) + (errmsg("the compressed data is corrupt"), errdetail("%s", X), errcode(ERRCODE_DATA_CORRUPTED)) #else #define CORRUPT_DATA_MESSAGE(X) (errcode(ERRCODE_DATA_CORRUPTED)) #endif diff --git a/tsl/src/compression/dictionary.c b/tsl/src/compression/dictionary.c index 63fa38104b2..2147105c7d7 100644 --- a/tsl/src/compression/dictionary.c +++ b/tsl/src/compression/dictionary.c @@ -426,6 +426,7 @@ tsl_text_dictionary_decompress_all(Datum compressed, Oid element_type, MemoryCon const uint16 n_notnull = indices_serialized->num_elements; const uint16 n_total = header->has_nulls ? nulls_serialized->num_elements : n_notnull; + CheckCompressedData(n_total >= n_notnull); const uint16 n_padded = n_total + 63; /* This is the padding requirement of simple8brle_decompress_all. */ int16 *restrict indices = MemoryContextAlloc(dest_mctx, sizeof(int16) * n_padded); diff --git a/tsl/src/compression/gorilla_impl.c b/tsl/src/compression/gorilla_impl.c index 41f98a31345..1fdd1d1a956 100644 --- a/tsl/src/compression/gorilla_impl.c +++ b/tsl/src/compression/gorilla_impl.c @@ -51,11 +51,11 @@ FUNCTION_NAME(gorilla_decompress_all, ELEMENT_TYPE)(CompressedGorillaData *goril const uint16 leading_zeros_padded = unpack_leading_zeros_array(&gorilla_data->leading_zeros, all_leading_zeros); - uint8 bit_widths[MAX_NUM_LEADING_ZEROS_PADDED_N64]; + uint8 bit_widths[GLOBAL_MAX_ROWS_PER_COMPRESSION + 63]; const uint16 num_bit_widths = simple8brle_decompress_all_buf_uint8(gorilla_data->num_bits_used_per_xor, bit_widths, - MAX_NUM_LEADING_ZEROS_PADDED_N64); + sizeof(bit_widths) / sizeof(bit_widths[0])); BitArray xors_bitarray = gorilla_data->xors; BitArrayIterator xors_iterator; diff --git a/tsl/src/compression/simple8b_rle_decompress_all.h b/tsl/src/compression/simple8b_rle_decompress_all.h index 52f8de8499b..8d36cd19087 100644 --- a/tsl/src/compression/simple8b_rle_decompress_all.h +++ b/tsl/src/compression/simple8b_rle_decompress_all.h @@ -21,6 +21,11 @@ FUNCTION_NAME(simple8brle_decompress_all_buf, { const uint16 n_total_values = compressed->num_elements; + /* + * Caller must have allocated a properly sized buffer, see the comment above. + */ + Assert(n_buffer_elements >= n_total_values + 63); + const uint16 num_selector_slots = simple8brle_num_selector_slots_for_num_blocks(compressed->num_blocks); const uint16 num_blocks = compressed->num_blocks; diff --git a/tsl/test/expected/compression_algos.out b/tsl/test/expected/compression_algos.out index fef1cb4444a..27cde6265a4 100644 --- a/tsl/test/expected/compression_algos.out +++ b/tsl/test/expected/compression_algos.out @@ -1595,10 +1595,10 @@ group by 2, 3 order by 1 desc ; count | bulk_result | rowbyrow_result -------+-------------+----------------- - 21 | XX001 | XX001 - 6 | 08P01 | 08P01 + 17 | XX001 | XX001 + 15 | true | true + 7 | 08P01 | 08P01 2 | 3F000 | 3F000 - 2 | true | true 1 | 22021 | 22021 1 | false | false (6 rows) @@ -1613,11 +1613,11 @@ group by 2, 3 order by 1 desc ; count | bulk_result | rowbyrow_result -------+-------------+----------------- - 51 | XX001 | XX001 - 4 | 08P01 | 08P01 - 4 | XX001 | true - 2 | true | true - 2 | 22021 | 22021 + 80 | XX001 | XX001 + 5 | 08P01 | 08P01 + 5 | XX001 | true + 4 | true | true + 3 | 22021 | 22021 1 | 3F000 | 3F000 1 | false | false (7 rows) diff --git a/tsl/test/expected/decompress_vector_qual.out b/tsl/test/expected/decompress_vector_qual.out index a567d375015..759f516740e 100644 --- a/tsl/test/expected/decompress_vector_qual.out +++ b/tsl/test/expected/decompress_vector_qual.out @@ -1053,3 +1053,71 @@ select * from date_table where ts < CURRENT_DATE; 01-01-2021 (3 rows) +-- Text columns. Only tests bulk decompression for now. +create table text_table(ts int, d int); +select create_hypertable('text_table', 'ts'); +NOTICE: adding not-null constraint to column "ts" + create_hypertable +------------------------- + (9,public,text_table,t) +(1 row) + +alter table text_table set (timescaledb.compress, timescaledb.compress_segmentby = 'd'); +insert into text_table select x, 0 /*, default */ from generate_series(1, 1000) x; +select count(compress_chunk(x, true)) from show_chunks('text_table') x; + count +------- + 1 +(1 row) + +alter table text_table add column a text default 'default'; +insert into text_table select x, 1, '' from generate_series(1, 1000) x; +insert into text_table select x, 2, 'same' from generate_series(1, 1000) x; +insert into text_table select x, 3, 'different' || x from generate_series(1, 1000) x; +insert into text_table select x, 4, case when x % 2 = 0 then null else 'same-with-nulls' end from generate_series(1, 1000) x; +insert into text_table select x, 5, case when x % 2 = 0 then null else 'different-with-nulls' || x end from generate_series(1, 1000) x; +insert into text_table select x, 6, 'одинаковый' from generate_series(1, 1000) x; +insert into text_table select x, 7, '異なる' || x from generate_series(1, 1000) x; +-- Some text values with varying lengths in a single batch. They are all different +-- to prevent dictionary compression, because we want to test particular orders +-- here as well. +insert into text_table select x, 8, repeat( x::text || 'a', x) from generate_series(1, 100) x; +insert into text_table select x + 100, 8, repeat((101 - x)::text || 'b', (101 - x)) from generate_series(1, 100) x; +insert into text_table select x + 200, 8, repeat((101 - x)::text || 'c', (101 - x)) from generate_series(1, 100) x; +insert into text_table select x + 300, 8, repeat( x::text || 'd', x) from generate_series(1, 100) x; +set timescaledb.debug_require_vector_qual to 'forbid'; +select sum(length(a)) from text_table; + sum +-------- + 118551 +(1 row) + +select count(distinct a) from text_table; + count +------- + 2905 +(1 row) + +select count(compress_chunk(x, true)) from show_chunks('text_table') x; +NOTICE: chunk "_hyper_9_17_chunk" is already compressed + count +------- + 1 +(1 row) + +select format('call recompress_chunk(''%s'')', x) from show_chunks('text_table') x \gexec +call recompress_chunk('_timescaledb_internal._hyper_9_17_chunk') +set timescaledb.enable_bulk_decompression to on; +set timescaledb.debug_require_vector_qual to 'forbid'; +select sum(length(a)) from text_table; + sum +-------- + 118551 +(1 row) + +select count(distinct a) from text_table; + count +------- + 2905 +(1 row) + diff --git a/tsl/test/fuzzing/compression/array-text/01accf1c403c681e8ccc10349c97a28ef2afbdd3 b/tsl/test/fuzzing/compression/array-text/01accf1c403c681e8ccc10349c97a28ef2afbdd3 new file mode 100644 index 0000000000000000000000000000000000000000..00a5f7bbffaef07e63852c05b7849772dabcdb18 GIT binary patch literal 1046 ocmZQ%C`gY_PAo~x$xmk}Nv$Yh00HKIU}}^Y4S~@R7=a-G0I=)^*#H0l literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/array-text/3f82cf837a5f3fae26f7cbb25ed3d903eed71687 b/tsl/test/fuzzing/compression/array-text/3f82cf837a5f3fae26f7cbb25ed3d903eed71687 new file mode 100644 index 0000000000000000000000000000000000000000..1f88b03407d5b503109c8b343dd6b8f854df2d6f GIT binary patch literal 1167 zcmZQ%C`gY_PAo~x$xmk}Nv$Yh00HJtK!P_VGc7F@$VdSR;RlL1q!}4;NRTB=&@fG8 zV+pE8R!lW^JsBqPlA#Ah3kM31fepk3dY=g)Y>!|PW~mTXGGtW9$^xA_AYlPYj6`G| z27y5mma;%#33Q8CG$`K}rRJ6BmS>hQa%bRhpKL5h2NFP2#{%JJCZvIk19EuM;3^P) MhNV$Ph61200Eu@PB>(^b literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/array-text/5d1be7e9dda1ee8896be5b7e34a85ee16452a7b4 b/tsl/test/fuzzing/compression/array-text/5d1be7e9dda1ee8896be5b7e34a85ee16452a7b4 new file mode 100644 index 00000000000..303e398c82e --- /dev/null +++ b/tsl/test/fuzzing/compression/array-text/5d1be7e9dda1ee8896be5b7e34a85ee16452a7b4 @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tsl/test/fuzzing/compression/array-text/6a126964d691ada7de1d25c976c4e7b481858665 b/tsl/test/fuzzing/compression/array-text/6a126964d691ada7de1d25c976c4e7b481858665 new file mode 100644 index 0000000000000000000000000000000000000000..2031608b3299d23d4bf4630deb48756e288f789d GIT binary patch literal 36 lcmZQ%EJ%+}PAo~x$xmk}Nv$YhU|?imVCH9lfKVV{1^}b)2SWe= literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/array-text/bc6960f7ed1b4b216c5cbc2721ea5136ffb80aae b/tsl/test/fuzzing/compression/array-text/bc6960f7ed1b4b216c5cbc2721ea5136ffb80aae new file mode 100644 index 0000000000000000000000000000000000000000..a0ba87a1079adf6947e4eda58eb76ba7ffa837ab GIT binary patch literal 1081 zcmZQ%C`gY_PAo~x$xmk}Nv$Yh00HI~K!P_VGc7H(C^fId(7?a|D8K_3u(Y%U@$Md1eVCcLol($i{+n$jXCB5P_zS1;WovNCSpL5s<@^hNglc9Vk#zkqQpA z5C&r)kC6cwhK?nmaARPAngC`GG{MM7O&1U}OcU8Qf~t`fQ;l6uHIs-phyztA8;A?^ zJrhFM9>E05q2@mWh-|8fxi$ksCW=zr97e2}n1M7yV8)l2=D?W5)45=!q?8!g%?>97 RuxrC53d+0su=IIU)c6 literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/array-text/d57ef126bce1cf2bb5a63addf172a9cf9bedb7da b/tsl/test/fuzzing/compression/array-text/d57ef126bce1cf2bb5a63addf172a9cf9bedb7da new file mode 100644 index 0000000000000000000000000000000000000000..269d95e5d7281d994d89c33a84c262b1a5c310e1 GIT binary patch literal 1078 zcmZQ%C`gY_PAo~x$xmk}Nv$Yh00HI~K!P_VGc7F@%qN>jL(*x8#HJT~AIyYJ4Ox#ymH&e?mfz1FfmckVgcUTgh+-#ho7bM{`}^?UB* zi!Xe}_0FO5 z%ytEk>Fq=7nJo&S(OZYcGgm2qKyMjp&pcBB)OqtzdFE*akmgN8>6uFkpvxPF!ZQ~Y zK$Np#<(YE@P~;8$;F*mA$Z^{Dop5Zt2|an?~h&SQ9^Ei=n9Vy68n9(^2i{o-?f9s1S$Qt?L8XE=QnNV zaX>P^Zd;E4GWk{8_|hSbU$(U`8glqWTlsP!fuFafFBGExSzGuLA@rZND_A^yL-)RaD z6N3A8v+@8TvTxOchX!H2TK66l#PrR&^Kc-bZ`7>^0?~ZEZaf4C0#oRtKKJuSzoF;pAx2gv1)xXnC}Z!&sL?63UhqADttVc;8WGgM}pBmSq?r14E>3+_oKtOA1^yUE)4py zvh^dvh#xH*KNbx4k+Sxqz*rwHD?c0t`cPT=fiTJk%fb(VAwE#9d~fJK6oc;vo!g@K zJ)mb*bbeFlwkle`5%hU~(fIDr;eAEzJHpxTDJtIuPJLHV`n7Q0JBq@$!%1%|)_&S6 z;fx13TrV|_-ekIe7CXJ8qe;v_Il&_S!Wj;NACCbWaHR_!7ewBqK<8W zGZ5Lf!%6(a>{>XF{{*%RoXY<$+Y!#@KdoH z!iPXvA!dt!SXq2$OM!4%-DnGfh*?Bx%YvX;v1^NixLG7^ON7u_oo)+-=rIS_av=d6 z8n$T20ke!P9n!$PWD!6nn93{;NCwBBMFaU@%CwjuCET+X8Dxdo+2Vu5aHw09kQ~Avpbo{wEOV6t2tMNwAE?4kf-t*Z*-am`<$Xu!3fTZQuP?NZD2_dAuY8;?$F z-83HGZS=LqvwN++-gti2>BYv8`@KHdIQC%B%Z;O$o^=bHf$3Sd!%3K)^;$R&)3fdZ zr($~69pP+D&$>Hw!1Sy)fbLXFV1Shv`|52qR*8*5ksUn4b0MFfOKN9Rr5O^sFPn=$M{$JeUB} zvyKXL;CR-tVH!-&Iswdt=~<_N$uK?ZWH2A5XPpwJ#PqBa!>pK|b$XZ>)3eS3b7Oke zxnO!s&pIPSfazK1g&;6J>+BE*re_TSLc#Q`fj~5vo;4f@2-C9$1u2b4&ui2tV@K@F+J--A$m;Dx?D&A)3Yuba=`SgONTTtJ!=Gz38rU_1Cqh?tkFO| zn4UEzND0%kMh017de-U=Ar_Kg6UZ^mlQx3OwXEmS^=cN^sJd@ zDu6neo;7oo0tkfZSu`)J8*Q2>qjFeaI+6hI(8%S+~& z3ZM=bfh6;^0!YJkL&;oH0A0AqESZZ6APV;)By+9+ig2?^G8+YugZr40K>@Vj=C))I zg0&8kIGaT;(l_aX1gv|KWFdbRy-AvoJZl{#LCBoNt&$p~%{pdD3UX$#x}*aM<3*4} zAX`i(k^-cPZ%CqtJTZYu+>j(*K8YAI#EdDiLVEaUB}&K*^RvVUiQ!e3$RH~=6_A)9 zCH8%gXdoXp<&Zca8TLw%2p|(SuaTug8tfw^i-sK7%t@9D39y%zEEJ+=6Ej&NgwDQk zvN(vFP5NY65Hx!s%7P$bHk*{CK)CGVDT{zu*&J2Ehd|kDRsx48*|b+eh7j5JSb~N4 z*fd(ggy7g~TLOg0*qmHKgRt1gU4nv`*z8`yfqlQCdu>ITZuVO)wF%5h;(YB9R8HAU@VGj%Hc2&wLaxQ7=@yvatI7T-BZ~c`crgO_JhvUdX+t(C&gvurqGQ# zwsIrrL$O@h9Xe2pS9XN6De^13z^T*?mTTcWiV(|oIEh-u_=&HCGag`Xz0^2*pVjJ5 vG>)CI#OFfe$USaAoj0D}g`zj6$gn$44gZ&K-4V*!R N>~JNZZV~_^0|4rwY}Nn( literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/0ce9675bea488114cd61e0902df0f65bb266b414 b/tsl/test/fuzzing/compression/dictionary-text/0ce9675bea488114cd61e0902df0f65bb266b414 new file mode 100644 index 0000000000000000000000000000000000000000..e0ceba082c0460a46be69f96af6793d1989617b1 GIT binary patch literal 625 zcmb7?Jqp4=5QX0^0kzWfwiX`1#xh`Iqc@PCk|q#~6c(OHtn9SZ(u;Tiv9Va^XH6mo z(GRjS+00|!&c-|v=)n%`HQMaawh}<3^1kV z3)IPLuT*6oybN$F6b(4et#dfN1984+V<=2yN>M%Kd5i4x+$z09m2R>%uFxNoKQ(95 zmvg!rrQ@RytsN(PLXM8GrlRrJDId5%66cJMTrY4xgPxRV?}p5T2Ns|ihMQ2>Dzr;K bi%LbK3n|r}iSs1Rkn;8&UGm3Q@G5!&UT?VU literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/193ff1ad23aaeaa8feafcbe7168f259e5063e715 b/tsl/test/fuzzing/compression/dictionary-text/193ff1ad23aaeaa8feafcbe7168f259e5063e715 new file mode 100644 index 0000000000000000000000000000000000000000..492ae25446f287dfa35ca84de95a976d17fe6011 GIT binary patch literal 1221 zcmZQ#EJ%+}PAo~x$xmk}Nv$YhU|?YU0wRDI1o{~m**^3ruRD dX-vlsw2KC_{lhu51O{Ee4?Y)B5=7Y24ge~8JPiN< literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/24a09483ef45200b6ed894e43934767755155e3d b/tsl/test/fuzzing/compression/dictionary-text/24a09483ef45200b6ed894e43934767755155e3d new file mode 100644 index 0000000000000000000000000000000000000000..b9af7a27b03bf88e113227d0e1469d640f26a1e0 GIT binary patch literal 77 zcmZQ#C`gY_PAo~x$xmk}Nv$YhU|?W=0VEh17+C&80Hc@=!#AA?Y4I~6L1qD|@Kv-yK SC`ghSh#BtyiD(cHq#FPL#Sgat literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/3b2185a90d32decad650ceb443751a4023368cdd b/tsl/test/fuzzing/compression/dictionary-text/3b2185a90d32decad650ceb443751a4023368cdd new file mode 100644 index 0000000000000000000000000000000000000000..4cf12c61b2ae059eabf35867e0d6527ee0d01dab GIT binary patch literal 167 zcmZQ#EJ%+}PAo~x$xmk}Nv$YhU|?YU0wRDI1o{~m*-0313#43X#g?|fEXynY{$0$e-MM| z|9^%l|i44`;Ll0jzz G6#xKy4#-#l literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/68c94392b09d47edea2a48f62808073bf83448f3 b/tsl/test/fuzzing/compression/dictionary-text/68c94392b09d47edea2a48f62808073bf83448f3 new file mode 100644 index 0000000000000000000000000000000000000000..c367012e07d38a1964ba1798f59598f649ef12d1 GIT binary patch literal 166 zcmZQ#EJ%+}PAo~x$xmk}Nv$YhU|?YU0wRDI1o{~m2)2F4daT0js4{{8>|A0)U6 z2pAYRVTwT_AVG)(ND>A@!$6{7^`W7$p->PDG6Sxei2=neKyk2hKx!CLfxJLu#b8mO FUI6wdD;)p; literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/79ef4a8ba594c7a2b611bc33fc8b83fe8ac14998 b/tsl/test/fuzzing/compression/dictionary-text/79ef4a8ba594c7a2b611bc33fc8b83fe8ac14998 new file mode 100644 index 0000000000000000000000000000000000000000..ec70dbd3d3a897f3629d1d6cf5a6676539d3b341 GIT binary patch literal 73 zcmZQ#EJ%+}PAo~x$xmk}Nv$YhU|?YU3?hIS1o#;k2)2F4dano$8r0D(UPgB^n) IOc^5s0NvsU=Kufz literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/7bbc7585698a7c3375bea9c3bcff8838722d8f64 b/tsl/test/fuzzing/compression/dictionary-text/7bbc7585698a7c3375bea9c3bcff8838722d8f64 new file mode 100644 index 0000000000000000000000000000000000000000..f6e3ac22f9cafde39950b077b5d98b7aafdddd3b GIT binary patch literal 57 zcmZQ#C`gY_PAo~x$xmk}Nv$Yh00KrJW&%>H!a~8|B_mLQT7G&u!#4&QkOH6z0H@at AaR2}S literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/7be90a9058961ac6ee07f764618805dfe8b6cfae b/tsl/test/fuzzing/compression/dictionary-text/7be90a9058961ac6ee07f764618805dfe8b6cfae new file mode 100644 index 0000000000000000000000000000000000000000..5076d4c666a36c0fb003be6cfe05b435e6110d57 GIT binary patch literal 56 zcmZQ#C`gY_PAo~x$xmk}Nv$YhU|?W=0VEh17+4q>1R4G_FgS|oFnqIX0LcI`P`ZSH F0|0fB3wi(m literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/8426e28aabe6684eb7200bd032ff0dad5a5169af b/tsl/test/fuzzing/compression/dictionary-text/8426e28aabe6684eb7200bd032ff0dad5a5169af new file mode 100644 index 0000000000000000000000000000000000000000..b14a908aa6fcda594534d8e4358e5dbd07d80eab GIT binary patch literal 57 zcmZQ#C`gY_PAo~x$xmk}Nv$Yh00MC!W@2DqToo1y1}_<-%)=lK1Zp5c%K%7VQwLIvu1;K>iQzvOFx)E4 RhZqeq6AqZ*EF=aa0{~sO8gu{v literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/af094ea4a3607992332e87dbe90f1a0f0cf82e09 b/tsl/test/fuzzing/compression/dictionary-text/af094ea4a3607992332e87dbe90f1a0f0cf82e09 new file mode 100644 index 0000000000000000000000000000000000000000..46f0878ad9de34e43a6ace3124b69ace342019e5 GIT binary patch literal 49 tcmZQ#C`gY_PAo~x$xmk}Nv$YhU|?W=3M3dgSQug%7_?Y`Yy@Cr000j-2U-9C literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/b18ecac8feda2826b91131b386b8842a1fca17e5 b/tsl/test/fuzzing/compression/dictionary-text/b18ecac8feda2826b91131b386b8842a1fca17e5 new file mode 100644 index 0000000000000000000000000000000000000000..314e37e727c42524de54a354e73cf52422fc2765 GIT binary patch literal 108 zcmZQ#EJ%+}PAo~x$xmk}Nv$YhU|?YU0wRDI2sro|7~~zmOa|u5KpH5{@*e^i#SE0c e=`;WZd4QOSp+WrX|Nmk-|JmCSfb~C63JL(RDje4U literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/b931131d935fb27ebf7977285299dcf11bb52eb4 b/tsl/test/fuzzing/compression/dictionary-text/b931131d935fb27ebf7977285299dcf11bb52eb4 new file mode 100644 index 0000000000000000000000000000000000000000..3312fe547a308c58dd73261cf96f250f34b8e272 GIT binary patch literal 97 zcmZQ#EJ%+}PAo~x$xmk}Nv$YhU|?YU0wRDI1o#;k2)2Ik8^8Ys^49|9P~bQr$r cGynxzKoTkq;$Q#&XJ`G-z@Wrn2qeJ(08PLb2LJ#7 literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/e767ec96033f7d9da306711adab0a6557fd4b71e b/tsl/test/fuzzing/compression/dictionary-text/e767ec96033f7d9da306711adab0a6557fd4b71e new file mode 100644 index 0000000000000000000000000000000000000000..343f09135c0d222a723debb825a1d74dc68fc298 GIT binary patch literal 321 zcmZQ#C`gY_PAo~x$xmk}Nv$YhU|?W=0VEU|m>5A)|AA5r=_L&L45=j*3}!$XIB-;e zGm#jFAmBd`@BuNDi;H3?00I^k79<03F@cI085jb97!P2=;vcYbh;9~;vl#!2{r|7S v@J*)yC}RY~j0~~Nh7fNv{x$&e4H>?GHGv3rhW{Xn=|6~i0ka)SGco`GFb+zg literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/f0f2e7efda77af51c83fe7870bd04d1b93556116 b/tsl/test/fuzzing/compression/dictionary-text/f0f2e7efda77af51c83fe7870bd04d1b93556116 new file mode 100644 index 0000000000000000000000000000000000000000..2fbea9bb8d89f1318bb2cd4d8ed94f9c9af030b2 GIT binary patch literal 76 zcmZQ#C`gY_PAo~x$xmk}Nv$YhU|?W=03;Y07+C)Q|Ia95_ literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/dictionary-text/fee17c65913f4eddcae3f69d1c2b6f318b938af2 b/tsl/test/fuzzing/compression/dictionary-text/fee17c65913f4eddcae3f69d1c2b6f318b938af2 new file mode 100644 index 0000000000000000000000000000000000000000..f7ca816fb8772ce486baa6f2d6b909b84dd1966b GIT binary patch literal 72 zcmZQ#C`gY_PAo~x$xmk}Nv$YhU|?W=03;Y07+C%%=OpGQrk8*v{sYC-Are56fq@@P LGB79uX_gWImaz^p literal 0 HcmV?d00001 diff --git a/tsl/test/sql/decompress_vector_qual.sql b/tsl/test/sql/decompress_vector_qual.sql index b9105ec4ec8..d68d05db828 100644 --- a/tsl/test/sql/decompress_vector_qual.sql +++ b/tsl/test/sql/decompress_vector_qual.sql @@ -352,3 +352,40 @@ select * from date_table where ts <= '2021-01-02'; select * from date_table where ts < '2021-01-02'; select * from date_table where ts < CURRENT_DATE; +-- Text columns. Only tests bulk decompression for now. +create table text_table(ts int, d int); +select create_hypertable('text_table', 'ts'); +alter table text_table set (timescaledb.compress, timescaledb.compress_segmentby = 'd'); + +insert into text_table select x, 0 /*, default */ from generate_series(1, 1000) x; +select count(compress_chunk(x, true)) from show_chunks('text_table') x; +alter table text_table add column a text default 'default'; + +insert into text_table select x, 1, '' from generate_series(1, 1000) x; +insert into text_table select x, 2, 'same' from generate_series(1, 1000) x; +insert into text_table select x, 3, 'different' || x from generate_series(1, 1000) x; +insert into text_table select x, 4, case when x % 2 = 0 then null else 'same-with-nulls' end from generate_series(1, 1000) x; +insert into text_table select x, 5, case when x % 2 = 0 then null else 'different-with-nulls' || x end from generate_series(1, 1000) x; +insert into text_table select x, 6, 'одинаковый' from generate_series(1, 1000) x; +insert into text_table select x, 7, '異なる' || x from generate_series(1, 1000) x; + +-- Some text values with varying lengths in a single batch. They are all different +-- to prevent dictionary compression, because we want to test particular orders +-- here as well. +insert into text_table select x, 8, repeat( x::text || 'a', x) from generate_series(1, 100) x; +insert into text_table select x + 100, 8, repeat((101 - x)::text || 'b', (101 - x)) from generate_series(1, 100) x; +insert into text_table select x + 200, 8, repeat((101 - x)::text || 'c', (101 - x)) from generate_series(1, 100) x; +insert into text_table select x + 300, 8, repeat( x::text || 'd', x) from generate_series(1, 100) x; + +set timescaledb.debug_require_vector_qual to 'forbid'; +select sum(length(a)) from text_table; +select count(distinct a) from text_table; + +select count(compress_chunk(x, true)) from show_chunks('text_table') x; +select format('call recompress_chunk(''%s'')', x) from show_chunks('text_table') x \gexec + +set timescaledb.enable_bulk_decompression to on; +set timescaledb.debug_require_vector_qual to 'forbid'; + +select sum(length(a)) from text_table; +select count(distinct a) from text_table; diff --git a/tsl/test/src/decompress_arithmetic_test_impl.c b/tsl/test/src/decompress_arithmetic_test_impl.c index c8445095d05..83db75b0a73 100644 --- a/tsl/test/src/decompress_arithmetic_test_impl.c +++ b/tsl/test/src/decompress_arithmetic_test_impl.c @@ -200,7 +200,17 @@ FUNCTION_NAME3(decompress, ALGO, PG_TYPE_PREFIX)(const uint8 *Data, size_t Size, * 3) The bulk decompression must absolutely work on the correct compressed * data we've just generated. */ - arrow = decompress_all(compressed_data, PG_TYPE_OID, CurrentMemoryContext); + PG_TRY(); + { + arrow = decompress_all(compressed_data, PG_TYPE_OID, CurrentMemoryContext); + } + PG_CATCH(); + { + EmitErrorReport(); + elog(PANIC, "bulk decompression failed for data that we've just compressed"); + } + PG_END_TRY(); + FUNCTION_NAME2(check_arrow, CTYPE)(arrow, PANIC, results, n); return n; diff --git a/tsl/test/src/decompress_text_test_impl.c b/tsl/test/src/decompress_text_test_impl.c index e4741af4d44..da9a158704b 100644 --- a/tsl/test/src/decompress_text_test_impl.c +++ b/tsl/test/src/decompress_text_test_impl.c @@ -220,7 +220,17 @@ decompress_generic_text(const uint8 *Data, size_t Size, bool bulk, int requested * 3) The bulk decompression must absolutely work on the correct compressed * data we've just generated. */ - arrow = decompress_all(compressed_data, TEXTOID, CurrentMemoryContext); + PG_TRY(); + { + arrow = decompress_all(compressed_data, TEXTOID, CurrentMemoryContext); + } + PG_CATCH(); + { + EmitErrorReport(); + elog(PANIC, "bulk decompression failed for data that we've just compressed"); + } + PG_END_TRY(); + decompress_generic_text_check_arrow(arrow, PANIC, results, n); return n;