gaodayue commented on a change in pull request #2075: Segment v2 stream load
core dump(#2037)
URL: https://github.com/apache/incubator-doris/pull/2075#discussion_r341432269
##########
File path: be/src/olap/rowset/segment_v2/plain_page.h
##########
@@ -78,12 +73,14 @@ class PlainPageBuilder : public PageBuilder {
// this api will release the memory ownership of encoded data
// Note:
- // release() should be called after finish
// reset() should be called after this function before reuse the
builder
- void release() override {
- uint8_t *ret = _buffer.release();
+ OwnedSlice release() override {
+ encode_fixed32_le((uint8_t *) &_buffer[0], _count);
+ OwnedSlice ownedSlice = OwnedSlice(Slice(_buffer.release(),
PLAIN_PAGE_HEADER_SIZE + _count * SIZE_OF_TYPE));
+
_buffer.reserve(_options.data_page_size + 1024);
- (void) ret;
+
+ return ownedSlice;
Review comment:
```suggestion
return OwnedSlice(_buffer.release(), PLAIN_PAGE_HEADER_SIZE +
_count * SIZE_OF_TYPE);
```
Add a helper constructor `OwnedSlice(const uint8_t* s, size_t n)` to achieve
this.
----------------------------------------------------------------
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]