wangbo commented on a change in pull request #1694: optimize V2 BinaryPlainPage 
format (#1648)
URL: https://github.com/apache/incubator-doris/pull/1694#discussion_r317461852
 
 

 ##########
 File path: be/src/olap/rowset/segment_v2/binary_plain_page.h
 ##########
 @@ -147,37 +140,16 @@ class BinaryPlainPageDecoder : public PageDecoder {
     Status init() override {
         CHECK(!_parsed);
 
-        if (_data.size < MIN_HEADER_SIZE) {
-            std::stringstream ss;
-            ss << "file corrupton: not enough bytes for header in 
BinaryPlainPageDecoder ."
-                  "invalid data size:" << _data.size << ", header size:" << 
MIN_HEADER_SIZE;
-            return Status::InternalError(ss.str());
-        }
-
-        // Decode header.
-        _num_elems         = decode_fixed32_le((const uint8_t *)&_data[0]);
-        size_t offsets_pos = decode_fixed32_le((const uint8_t *)&_data[4]);
-
-        // Sanity check.
-        if (offsets_pos > _data.size) {
+        if (_data.size < sizeof(uint32_t)) {
             std::stringstream ss;
-            ss << "offsets_pos "<< offsets_pos << " > page size " << 
_data.size << " in plain string page";
+            ss << "file corrupton: not enough bytes for trailer in 
BinaryPlainPageDecoder ."
+                  "invalid data size:" << _data.size << ", trailer size:" << 
sizeof(uint32_t);
             return Status::InternalError(ss.str());
 
 Review comment:
   👌

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to