Open riteme opened 3 years ago
cc @windtalker @fzhedu @zanmato1984
records_per_chunk
is used when return data to TiDB
, it actually only works when encode type is TypeChunk
and TypeDefault
, for exchange partition sender, the encode type is always TypeCHBlock
, so we can just ignore record_per_chunk
.
@windtalker do you think record_per_chunk
can be applied on TypeCHBlock
? is there any potential blocking issue?
@fuzhe1989 Current CHBlockChunkCodec
has some limitations. If we want to apply record_per_chunk
to TypeCHBlock
, we may need to enhance CHBlockChunkCodec
first.
@windtalker do you think
record_per_chunk
can be applied onTypeCHBlock
? is there any potential blocking issue?
Any potential benefit if we enable record_per_chunk
for TypeCHBlock
?
@windtalker To my understanding, our partition sender shuffles only one block at a time, into several partitioned blocks. Then each partitioned block is encoded in one chunk. So if the original block is not too large, the result partitioned block will not be too large as well.
I'm not sure whether merging small chunks (not blocks) before writing response is beneficial, given that we're using gRPC? If true, we can refactor current code and use records_per_chunk as a threshold.
Related PR: #2474
@windtalker To my understanding, our partition sender shuffles only one block at a time, into several partitioned blocks. Then each partitioned block is encoded in one chunk. So if the original block is not too large, the result partitioned block will not be too large as well.
I'm not sure whether merging small chunks (not blocks) before writing response is beneficial, given that we're using gRPC? If true, we can refactor current code and use records_per_chunk as a threshold.
For small chunks, we do not need merge them before sending because we already add a merge stage in receiver side. For larger blocks, it will throw error if the block is too large, and it is not the expected result of generating so large block, we need to find out the root cause to avoid generating such a large block.
@windtalker
I realized that there are three different concepts: chunk, response (tipb::SelectResponse
) and packet (mpp::MPPDataPacket
). Only serializing response into packet can fail. Given that all chunks are put in one response, is it useless to split chunks?
@windtalker
I realized that there are three different concepts: chunk, response (
tipb::SelectResponse
) and packet (mpp::MPPDataPacket
). Only serializing response into packet can fail. Given that all chunks are put in one response, is it useless to split chunks?
tipb::SelectResponse
is small enough to serialize into packet.Related PR: #2405
It is an outdated pr, at that time we do not knonw there is a size restriction when serializing response to packet, and we need to make sure that the updated pr will consider this restriction.
In
StreamingDAGResponseWriter
, broadcast sender will split blocks byrecords_per_chunk
but partition sender does not split. It may result in sending a very large chunk in one DAG response. SeeStreamingDAGResponseWriter::getEncodePartitionTask
.