Skip to content

Commit

Permalink
[drop] fix slice error
Browse files Browse the repository at this point in the history
  • Loading branch information
kaijchen committed Jun 28, 2023
1 parent b1989ab commit 3a3e3f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions be/src/olap/rowset/segment_v2/column_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,12 +727,12 @@ Status ScalarColumnWriter::finish_current_page() {
if (has_null) {
OwnedSlice tmp_map(std::move(body.back()));
body.pop_back();
OwnedSlice tmp_value(std::move(body.back()));;
OwnedSlice tmp_value(std::move(body.back()));
body.pop_back();
page->data.emplace_back(std::move(tmp_value));
page->data.emplace_back(std::move(tmp_map));
} else {
OwnedSlice tmp_value(std::move(body.back()));;
OwnedSlice tmp_value(std::move(body.back()));
body.pop_back();
page->data.emplace_back(std::move(tmp_value));
}
Expand Down
10 changes: 6 additions & 4 deletions be/src/olap/rowset/segment_v2/page_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,17 @@ Status PageIO::write_page(io::FileWriter* writer, std::vector<OwnedSlice>& body,
put_fixed32_le(&footer_buf, static_cast<uint32_t>(footer_buf.size()));

std::vector<OwnedSlice>& page = body;
faststring footer_and_checksum;
footer_and_checksum.assign_copy(footer_buf);
faststring footer_str;
footer_str.assign_copy(footer_buf);
page.emplace_back(footer_str.build());

// checksum
uint8_t checksum_buf[sizeof(uint32_t)];
uint32_t checksum = crc32c::Value(page);
encode_fixed32_le(checksum_buf, checksum);
footer_and_checksum.append(checksum_buf, sizeof(uint32_t));
page.emplace_back(footer_and_checksum.build());
faststring checksum_str;
checksum_str.append(checksum_buf, sizeof(uint32_t));
page.emplace_back(checksum_str.build());

uint64_t offset = writer->bytes_appended();
RETURN_IF_ERROR(writer->appendv(&page[0], page.size()));
Expand Down

0 comments on commit 3a3e3f9

Please sign in to comment.