Skip to content

Commit

Permalink
[fix](ut) repair segcompaction ut (#38165) (#38225) (#39153)
Browse files Browse the repository at this point in the history
cherry-pick #38165 and #22928
  • Loading branch information
zhannngchen authored Aug 21, 2024
1 parent 5e73981 commit 7e52a1a
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 266 deletions.
1 change: 1 addition & 0 deletions be/src/olap/rowset/beta_rowset_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ Status BetaRowsetWriter::add_rowset_for_linked_schema_change(RowsetSharedPtr row
Status BetaRowsetWriter::flush() {
if (_segment_writer != nullptr) {
RETURN_IF_ERROR(_flush_segment_writer(&_segment_writer));
RETURN_IF_ERROR(_segcompaction_if_necessary());
}
return Status::OK();
}
Expand Down
8 changes: 5 additions & 3 deletions be/src/olap/rowset/segcompaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
namespace doris {
using namespace ErrorCode;

SegcompactionWorker::SegcompactionWorker(BetaRowsetWriter* writer) : _writer(writer) {}

Status SegcompactionWorker::_get_segcompaction_reader(
SegCompactionCandidatesSharedPtr segments, TabletSharedPtr tablet,
std::shared_ptr<Schema> schema, OlapReaderStatistics* stat,
Expand Down Expand Up @@ -151,8 +153,8 @@ Status SegcompactionWorker::_delete_original_segments(uint32_t begin, uint32_t e
}

Status SegcompactionWorker::_check_correctness(OlapReaderStatistics& reader_stat,
Merger::Statistics& merger_stat, uint64_t begin,
uint64_t end) {
Merger::Statistics& merger_stat, uint32_t begin,
uint32_t end) {
uint64_t raw_rows_read = reader_stat.raw_rows_read; /* total rows read before merge */
uint64_t sum_src_row = 0; /* sum of rows in each involved source segments */
uint64_t filtered_rows = merger_stat.filtered_rows; /* rows filtered by del conditions */
Expand Down Expand Up @@ -192,7 +194,7 @@ Status SegcompactionWorker::_check_correctness(OlapReaderStatistics& reader_stat
}

Status SegcompactionWorker::_create_segment_writer_for_segcompaction(
std::unique_ptr<segment_v2::SegmentWriter>* writer, uint64_t begin, uint64_t end) {
std::unique_ptr<segment_v2::SegmentWriter>* writer, uint32_t begin, uint32_t end) {
return _writer->_do_create_segment_writer(writer, true, begin, end);
}

Expand Down
6 changes: 3 additions & 3 deletions be/src/olap/rowset/segcompaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SegcompactionWorker {
friend class BetaRowsetWriter;

public:
SegcompactionWorker(BetaRowsetWriter* writer) { _writer = writer; }
SegcompactionWorker(BetaRowsetWriter* writer);

void compact_segments(SegCompactionCandidatesSharedPtr segments);

Expand All @@ -59,7 +59,7 @@ class SegcompactionWorker {

private:
Status _create_segment_writer_for_segcompaction(
std::unique_ptr<segment_v2::SegmentWriter>* writer, uint64_t begin, uint64_t end);
std::unique_ptr<segment_v2::SegmentWriter>* writer, uint32_t begin, uint32_t end);
Status _get_segcompaction_reader(SegCompactionCandidatesSharedPtr segments,
TabletSharedPtr tablet, std::shared_ptr<Schema> schema,
OlapReaderStatistics* stat,
Expand All @@ -70,7 +70,7 @@ class SegcompactionWorker {
uint64_t end);
Status _delete_original_segments(uint32_t begin, uint32_t end);
Status _check_correctness(OlapReaderStatistics& reader_stat, Merger::Statistics& merger_stat,
uint64_t begin, uint64_t end);
uint32_t begin, uint32_t end);
Status _do_compact_segments(SegCompactionCandidatesSharedPtr segments);

private:
Expand Down
1 change: 0 additions & 1 deletion be/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ list(REMOVE_ITEM UT_FILES
${CMAKE_CURRENT_SOURCE_DIR}/olap/rowset/segment_v2/frame_of_reference_page_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/olap/rowset/segment_v2/plain_page_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/olap/rowset/segment_v2/rle_page_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/olap/segcompaction_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/runtime/decimal_value_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/runtime/result_buffer_mgr_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/util/decompress_test.cpp
Expand Down
Loading

0 comments on commit 7e52a1a

Please sign in to comment.