Skip to content

Fixed bug with compressed dictionaries#160

Merged
sofia-tekdatum merged 3 commits into
mainfrom
debug
Nov 19, 2025
Merged

Fixed bug with compressed dictionaries#160
sofia-tekdatum merged 3 commits into
mainfrom
debug

Conversation

@sofia-tekdatum

Copy link
Copy Markdown
Collaborator

Problem found during canonical app development.

Dictionary pages can in fact be compressed, we were assuming they were not.

This caused problems with different data types, we observed INT64s being decoded wrong and BYTE_ARRAYS causing the server to crash when the length of the byte array did not match expectations.

Fixed by checking whether the dictionary is compressed or not and acting accordingly.

Comment thread src/common/dbpa_local_test.cpp Outdated
std::string app_context = R"({"user_id": "test_user"})";

EXPECT_NO_THROW(agent.init("test_column", connection_config, app_context, "test_key",
Type::BYTE_ARRAY, std::nullopt, CompressionCodec::SNAPPY, std::nullopt));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this Type::Undefined otherwise if SNAPPY is supported in the future, the test will fail when decoding the BYTE_ARRAY

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would the test fail in that case? I wanted to put in the test case that was actually failing. If I switch this to type Undefined and remove the Decompress line in the sequencer, this test would still pass.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline, updated test data to be a correct BYTE_ARRAY, compressed using GZIP

Comment thread src/server/encryption_sequencer.cpp Outdated
if (page_type == "DICTIONARY_PAGE") {
// TODO: Check whether dictionary pages can be compressed.
result.value_bytes = plaintext;
if (compression_ == CompressionCodec::UNCOMPRESSED) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decompress already handles the uncompressed case. It's best to just call it directly.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@argmarco-tkd argmarco-tkd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sofia-tekdatum
sofia-tekdatum merged commit dbb80b7 into main Nov 19, 2025
1 of 3 checks passed
@sofia-tekdatum
sofia-tekdatum deleted the debug branch November 19, 2025 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants