Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions system/jhtree/jhblockcompressed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,7 @@ bool CBlockCompressedWriteNode::add(offset_t pos, const void *indata, size32_t i
bool isVariable = keyHdr->isVariable();
bool hasFilepos = !context.zeroFilePos;
size32_t fixedKeySize = isVariable ? 0 : (hasFilepos ? keyLen + sizeof(offset_t) : keyLen);

ICompressHandler * handler = queryCompressHandler(context.compressionMethod);
compressor.open(keyPtr, maxBytes-hdr.keyBytes, handler, context.compressionOptions, isVariable, fixedKeySize);
compressor.open(keyPtr, maxBytes-hdr.keyBytes, context.compressor, isVariable, fixedKeySize);
}

unsigned writeOptions = (context.zeroFilePos ? KeyCompressor::NoFilePosition : KeyCompressor::TrailingFilePosition);
Expand All @@ -400,6 +398,15 @@ void CBlockCompressedWriteNode::finalize()

//=========================================================================================================

void CBlockCompressedBuildContext::initCompressor()
{
compressionHandler = queryCompressHandler(compressionMethod);
if (!compressionHandler)
throw MakeStringException(0, "Unknown compression method %d", (int)compressionMethod);

compressor.setown(compressionHandler->getCompressor(compressionOptions.str()));
}

HybridIndexCompressor::HybridIndexCompressor(unsigned keyedSize, const CKeyHdr* keyHdr, IHThorIndexWriteArg *helper, const char * compression, bool isTLK)
{
//Process options for leaf (block-compressed) nodes
Expand Down Expand Up @@ -438,9 +445,7 @@ HybridIndexCompressor::HybridIndexCompressor(unsigned keyedSize, const CKeyHdr*
if (colon)
processOptionString(colon+1, processOption);

leafContext.compressionHandler = queryCompressHandler(leafContext.compressionMethod);
if (!leafContext.compressionHandler)
throw MakeStringException(0, "Unknown compression method %d", (int)leafContext.compressionMethod);
leafContext.initCompressor();

if (!isTLK && helper && (helper->getFlags() & TIWzerofilepos))
leafContext.zeroFilePos = true;
Expand Down
5 changes: 5 additions & 0 deletions system/jhtree/jhblockcompressed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ class CJHNewBlobNode final : public CJHBlobNode

struct CBlockCompressedBuildContext
{
public:
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

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

The struct has two consecutive public access specifiers. The first public label at line 84 is redundant and should be removed, as structs have public access by default and there's another public label immediately following at line 87.

Suggested change
public:

Copilot uses AI. Check for mistakes.
void initCompressor();

public:
ICompressHandler* compressionHandler = nullptr;
Owned<ICompressor> compressor;
StringBuffer compressionOptions;
CompressionMethod compressionMethod = COMPRESS_METHOD_ZSTDS6;
bool zeroFilePos = false;
Expand Down
Loading