Add a comment explaining use of bulk dense content.
And some cosmetic changes.
@@ -1190,7 +1190,7 @@ AppendOnlyStorageWrite_CompressAppend(AppendOnlyStorageWrite *storageWrite,
sourceLen,
dataBuffer,
dataBufferWithOverrrunLen,
- sourceLen, //Limit compression to be no more than the input size.
+ sourceLen, /* maxCompressedLen */
compressedLen,
storageWrite->storageAttributes.compressLevel,
compressor,
@@ -1208,7 +1208,8 @@ AppendOnlyStorageWrite_CompressAppend(AppendOnlyStorageWrite *storageWrite,
* compress data user configurable.
*/
int32 dataLen = *compressedLen;
- if (*compressedLen >= sourceLen) {
+ if (*compressedLen >= sourceLen)
+ {
dataLen = sourceLen;
memcpy(dataBuffer, sourceData, sourceLen);
*compressedLen = 0;
@@ -1216,13 +1217,11 @@ AppendOnlyStorageWrite_CompressAppend(AppendOnlyStorageWrite *storageWrite,
int32 dataRoundedUpLen =
AOStorage_RoundUp(dataLen, storageWrite->formatVersion);
AOStorage_ZeroPad(dataBuffer, dataLen, dataRoundedUpLen);
+
+ /* Make the header and compute the checksum if necessary. */
switch (storageWrite->getBufferAoHeaderKind)
{
case AoHeaderKind_SmallContent:
-
- /*
- * Make the header and compute the checksum if necessary.
- */
AppendOnlyStorageFormat_MakeSmallContentHeader
(header,
storageWrite->storageAttributes.checksum,
@@ -1236,9 +1235,12 @@ AppendOnlyStorageWrite_CompressAppend(AppendOnlyStorageWrite *storageWrite,
break;
case AoHeaderKind_BulkDenseContent:
-
/*
- * Make the header and compute the checksum if necessary.
+ * This header is used when compresslevel > 1 is specified with
+ * rle_type compression. The sourceData is already encoded with
+ * RLE. It is further compressed with bulk compression.
+ * Corresponding datumstream version is
+ * DatumStreamVersion_Dense_Enhanced.
*/
AppendOnlyStorageFormat_MakeBulkDenseContentHeader
(header,
@@ -1253,32 +1255,32 @@ AppendOnlyStorageWrite_CompressAppend(AppendOnlyStorageWrite *storageWrite,
break;
default:
- elog(ERROR, "Unexpected Append-Only header kind %d",
+ elog(ERROR, "unexpected Append-Only header kind %d",
storageWrite->getBufferAoHeaderKind);
break;
}
if (Debug_appendonly_print_storage_headers)
{
- AppendOnlyStorageWrite_LogBlockHeader(storageWrite,
+ AppendOnlyStorageWrite_LogBlockHeader(
+ storageWrite,
BufferedAppendCurrentBufferPosition(&storageWrite->bufferedAppend),
header);
}
- if (Debug_appendonly_print_insert) {
- elog(LOG,
+ elogif(Debug_appendonly_print_insert, LOG,
"Append-only insert block for table '%s' stored %s "
"(segment file '%s', header offset in file " INT64_FORMAT ", "
- "source length = %d, result length %d item count %d, block count " INT64_FORMAT ")",
+ "source length = %d, result length %d item count %d, block count "
+ INT64_FORMAT ")",
storageWrite->relationName,
- (*compressedLen > 0) ? "compressed" : "uncompressed (couldn't compress)",
+ (*compressedLen > 0) ? "compressed" : "uncompressed",
storageWrite->segmentFileName,
BufferedAppendCurrentBufferPosition(&storageWrite->bufferedAppend),
sourceLen,
dataLen,
itemCount,
storageWrite->bufferCount);
- }
*bufferLen = storageWrite->currentCompleteHeaderLen + dataRoundedUpLen;
}
