wwbmmm commented on code in PR #3666:
URL: https://github.com/apache/brpc/pull/3666#discussion_r4501008439


##########
src/brpc/redis_command.h:
##########
@@ -73,6 +74,7 @@ class RedisCommandParser {
                                          butil::Arena* arena,
                                          ParseError* err);
 
+    detail::RedisLineScanState _line_scan;

Review Comment:
   [replied by brpc-oncall robot] `_line_scan` caches backing-block 
index/offset, so from now on `Consume()` requires the caller to keep passing 
the same `IOBuf` (append-only) across calls. Before this change `FindCRLF()` 
rescanned `buf` from the front, so callers that rebuilt/compacted the buffer 
between reads (e.g. accumulating chunks in a `std::string` and re-appending 
them) still parsed correctly; now such a caller silently resumes at a stale 
`block_index`/`block_offset` and can parse the wrong bytes. Please state this 
invariant in the public comment of `Consume()` (the reply-side 
`ConsumePartialIOBuf()` doc already says 'the same buf', but it does not say 
the existing blocks/prefix must be preserved).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to