add data size field for partition cache (#6026)

Co-authored-by: wangxixu <wangxixu@xiaomi.com>
This commit is contained in:
xinghuayu007
2021-06-18 11:40:00 +08:00
committed by GitHub
parent 1999a0c26b
commit bff6ede94e

View File

@ -167,13 +167,17 @@ public class RowBatchBuilder {
Long key = entry.getKey();
PartitionRange.PartitionSingle partition = cachePartMap.get(key);
partitionRowList = entry.getValue();
int data_size = 0;
for (byte[] buf : partitionRowList) {
data_size += buf.length;
}
updateRequest = updateRequest.toBuilder()
.addValues(InternalService.PCacheValue.newBuilder()
.setParam(InternalService.PCacheParam.newBuilder()
.setPartitionKey(key)
.setLastVersion(partition.getPartition().getVisibleVersion())
.setLastVersionTime(partition.getPartition().getVisibleVersionTime())
.build()).addAllRows(
.build()).setDataSize(dataSize).addAllRows(
partitionRowList.stream().map(row -> ByteString.copyFrom(row))
.collect(Collectors.toList()))).build();
}