Skip to content

Commit 6c177e3

Browse files
committed
Remove PageCodecMarker
It became unused after 8262e35, when pages started being serialized in chunks.
1 parent 47b5e74 commit 6c177e3

File tree

9 files changed

+7
-303
lines changed

9 files changed

+7
-303
lines changed

core/trino-main/src/main/java/io/trino/execution/buffer/CompressingEncryptingPageSerializer.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
import static io.airlift.slice.SizeOf.instanceSize;
4141
import static io.airlift.slice.SizeOf.sizeOf;
4242
import static io.airlift.slice.SizeOf.sizeOfByteArray;
43-
import static io.trino.execution.buffer.PageCodecMarker.COMPRESSED;
44-
import static io.trino.execution.buffer.PageCodecMarker.ENCRYPTED;
4543
import static io.trino.execution.buffer.PagesSerdeUtil.ESTIMATED_AES_CIPHER_RETAINED_SIZE;
4644
import static io.trino.execution.buffer.PagesSerdeUtil.SERIALIZED_PAGE_CIPHER_NAME;
4745
import static io.trino.execution.buffer.PagesSerdeUtil.SERIALIZED_PAGE_COMPRESSED_BLOCK_MASK;
@@ -129,7 +127,6 @@ private static class SerializedPageOutput
129127

130128
private final Optional<Compressor> compressor;
131129
private final Optional<SecretKey> encryptionKey;
132-
private final int markers;
133130
private final Optional<Cipher> cipher;
134131

135132
private final WriteBuffer[] buffers;
@@ -149,10 +146,8 @@ private SerializedPageOutput(
149146
+ (encryptionKey.isPresent() ? 1 : 0) // encryption buffer
150147
+ 1 // output buffer
151148
];
152-
PageCodecMarker.MarkerSet markerSet = PageCodecMarker.MarkerSet.empty();
153149
if (compressor.isPresent()) {
154150
buffers[0] = new WriteBuffer(blockSizeInBytes);
155-
markerSet.add(COMPRESSED);
156151
}
157152
if (encryptionKey.isPresent()) {
158153
int bufferSize = blockSizeInBytes;
@@ -162,7 +157,6 @@ private SerializedPageOutput(
162157
+ Integer.BYTES;
163158
}
164159
buffers[buffers.length - 2] = new WriteBuffer(bufferSize);
165-
markerSet.add(ENCRYPTED);
166160

167161
try {
168162
cipher = Optional.of(Cipher.getInstance(SERIALIZED_PAGE_CIPHER_NAME));
@@ -174,14 +168,12 @@ private SerializedPageOutput(
174168
else {
175169
cipher = Optional.empty();
176170
}
177-
markers = markerSet.byteValue();
178171
}
179172

180173
public void startPage(int positionCount, int sizeInBytes)
181174
{
182175
WriteBuffer buffer = new WriteBuffer(round(sizeInBytes * 1.2F) + SERIALIZED_PAGE_HEADER_SIZE);
183176
buffer.writeInt(positionCount);
184-
buffer.writeByte(markers);
185177
// leave space for uncompressed and compressed sizes
186178
buffer.skip(Integer.BYTES * 2);
187179

core/trino-main/src/main/java/io/trino/execution/buffer/PageCodecMarker.java

Lines changed: 0 additions & 143 deletions
This file was deleted.

core/trino-main/src/main/java/io/trino/execution/buffer/PagesSerdeUtil.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import io.airlift.slice.SliceOutput;
2020
import io.airlift.slice.Slices;
2121
import io.airlift.slice.XxHash64;
22-
import io.trino.execution.buffer.PageCodecMarker.MarkerSet;
2322
import io.trino.spi.Page;
2423
import io.trino.spi.block.Block;
2524
import io.trino.spi.block.BlockEncodingSerde;
@@ -35,8 +34,6 @@
3534
import static com.google.common.base.Verify.verify;
3635
import static io.trino.block.BlockSerdeUtil.readBlock;
3736
import static io.trino.block.BlockSerdeUtil.writeBlock;
38-
import static io.trino.execution.buffer.PageCodecMarker.COMPRESSED;
39-
import static io.trino.execution.buffer.PageCodecMarker.ENCRYPTED;
4037
import static java.util.Arrays.asList;
4138
import static java.util.Objects.requireNonNull;
4239

@@ -45,8 +42,7 @@ public final class PagesSerdeUtil
4542
private PagesSerdeUtil() {}
4643

4744
static final int SERIALIZED_PAGE_POSITION_COUNT_OFFSET = 0;
48-
static final int SERIALIZED_PAGE_CODEC_MARKERS_OFFSET = SERIALIZED_PAGE_POSITION_COUNT_OFFSET + Integer.BYTES;
49-
static final int SERIALIZED_PAGE_UNCOMPRESSED_SIZE_OFFSET = SERIALIZED_PAGE_CODEC_MARKERS_OFFSET + Byte.BYTES;
45+
static final int SERIALIZED_PAGE_UNCOMPRESSED_SIZE_OFFSET = SERIALIZED_PAGE_POSITION_COUNT_OFFSET + Integer.BYTES;
5046
static final int SERIALIZED_PAGE_COMPRESSED_SIZE_OFFSET = SERIALIZED_PAGE_UNCOMPRESSED_SIZE_OFFSET + Integer.BYTES;
5147
static final int SERIALIZED_PAGE_HEADER_SIZE = SERIALIZED_PAGE_COMPRESSED_SIZE_OFFSET + Integer.BYTES;
5248
static final String SERIALIZED_PAGE_CIPHER_NAME = "AES/CBC/PKCS5Padding";
@@ -124,21 +120,6 @@ public static int getSerializedPageUncompressedSizeInBytes(Slice serializedPage)
124120
return serializedPage.getInt(SERIALIZED_PAGE_UNCOMPRESSED_SIZE_OFFSET);
125121
}
126122

127-
public static boolean isSerializedPageEncrypted(Slice serializedPage)
128-
{
129-
return getSerializedPageMarkerSet(serializedPage).contains(ENCRYPTED);
130-
}
131-
132-
public static boolean isSerializedPageCompressed(Slice serializedPage)
133-
{
134-
return getSerializedPageMarkerSet(serializedPage).contains(COMPRESSED);
135-
}
136-
137-
private static MarkerSet getSerializedPageMarkerSet(Slice serializedPage)
138-
{
139-
return MarkerSet.fromByteValue(serializedPage.getByte(Integer.BYTES));
140-
}
141-
142123
private static class PageReader
143124
extends AbstractIterator<Page>
144125
{

core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkPagesSerde.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ static void main()
215215
System.out.println("Page Size Max: " + Arrays.stream(data.dataPages).mapToLong(Page::getSizeInBytes).max().getAsLong());
216216
System.out.println("Page Size Sum: " + Arrays.stream(data.dataPages).mapToLong(Page::getSizeInBytes).sum());
217217
System.out.println("Page count: " + data.dataPages.length);
218-
System.out.println("Compressed: " + Arrays.stream(data.serializedPages).filter(PagesSerdeUtil::isSerializedPageCompressed).count());
219218

220219
benchmark(BenchmarkPagesSerde.class)
221220
.withOptions(optionsBuilder -> optionsBuilder.jvmArgs("-Xms4g", "-Xmx4g"))

core/trino-main/src/test/java/io/trino/execution/buffer/TestPageCodecMarker.java

Lines changed: 0 additions & 112 deletions
This file was deleted.

core/trino-main/src/test/java/io/trino/execution/buffer/TestPagesSerde.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ public void testBigintSerializedSize()
187187
// empty page
188188
Page page = new Page(builder.build());
189189
int pageSize = serializedSize(ImmutableList.of(BIGINT), page);
190-
assertThat(pageSize).isEqualTo(36);
190+
assertThat(pageSize).isEqualTo(35);
191191

192192
// page with one value
193193
BIGINT.writeLong(builder, 123);
194194
pageSize = 35; // Now we have moved to the normal block implementation so the page size overhead is 35
195195
page = new Page(builder.build());
196196
int firstValueSize = serializedSize(ImmutableList.of(BIGINT), page) - pageSize;
197-
assertThat(firstValueSize).isEqualTo(9); // value size + value overhead
197+
assertThat(firstValueSize).isEqualTo(8); // value size + value overhead
198198

199199
// page with two values
200200
BIGINT.writeLong(builder, 456);
@@ -211,11 +211,11 @@ public void testVarcharSerializedSize()
211211
// empty page
212212
Page page = new Page(builder.build());
213213
int pageSize = serializedSize(ImmutableList.of(VARCHAR), page);
214-
assertThat(pageSize).isEqualTo(44);
214+
assertThat(pageSize).isEqualTo(43);
215215

216216
// page with one value
217217
VARCHAR.writeString(builder, "alice");
218-
pageSize = 44; // Now we have moved to the normal block implementation so the page size overhead is 44
218+
pageSize = 43; // Now we have moved to the normal block implementation so the page size overhead is 43
219219
page = new Page(builder.build());
220220
int firstValueSize = serializedSize(ImmutableList.of(VARCHAR), page) - pageSize;
221221
assertThat(firstValueSize).isEqualTo(4 + 5); // ending offset + nonNullsCount + "alice"

0 commit comments

Comments
 (0)