Skip to content

Commit

Permalink
encoded the key+value same way as the client side
Browse files Browse the repository at this point in the history
  • Loading branch information
rsingh433 committed Feb 1, 2024
1 parent 18867e5 commit 4fe7a6e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ public class StoredTabletFile extends AbstractTabletFile<StoredTabletFile> {
private static final Comparator<StoredTabletFile> comparator = Comparator
.comparing(StoredTabletFile::getMetadataPath).thenComparing(StoredTabletFile::getRange);

public byte[] getMetadataBytes() {
return getMetadataText().getBytes();
}

/**
* Construct a tablet file using the string read from the metadata. Preserve the exact string so
* the entry can be deleted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,22 @@ public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean i
int count = 0;

while (source.hasTop()) {
byte[] ba = source.getTopKey().getColumnQualifierData().toArray();
dos.writeInt(ba.length);
dos.write(ba, 0, ba.length);

if (includeValue) {
byte[] ba = source.getTopKey().getColumnQualifierData().toArray();
byte[] valueData = source.getTopValue().get();
dos.writeInt(valueData.length);
dos.write(valueData, 0, valueData.length);

byte[] encodedData = encodeEntry(Map.entry(ba, valueData));

dos.writeInt(encodedData.length);
dos.write(encodedData, 0, encodedData.length);
}

else {

// only encode the key/qualifier
byte[] ba = source.getTopKey().getColumnQualifierData().toArray();
dos.writeInt(ba.length);
dos.write(ba, 0, ba.length);
}

source.next();
Expand Down

0 comments on commit 4fe7a6e

Please sign in to comment.