Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion be/src/olap/rowset/alpha_rowset_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ OLAPStatus AlphaRowsetWriter::flush() {

RowsetSharedPtr AlphaRowsetWriter::build() {
if (_writer_state != WRITER_FLUSHED) {
LOG(WARNING) << "invalid writer state before build:" << _writer_state;
LOG(WARNING) << "invalid writer state before build, state:" << _writer_state;
return nullptr;
}
for (auto& segment_group : _segment_groups) {
Expand Down Expand Up @@ -200,6 +200,13 @@ RowsetSharedPtr AlphaRowsetWriter::build() {
_current_rowset_meta->set_num_rows(_num_rows_written);
_current_rowset_meta->set_creation_time(time(nullptr));

// validate rowset arguments before create rowset
bool ret = _validate_rowset();
if (!ret) {
LOG(WARNING) << "valiate rowset arguments failed";
return nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fatal here, because the caller may not check rowset == nullptr, and validate == false is an exception, should not happen.

}

RowsetSharedPtr rowset(new(std::nothrow) AlphaRowset(_rowset_writer_context.tablet_schema,
_rowset_writer_context.rowset_path_prefix,
_rowset_writer_context.data_dir, _current_rowset_meta));
Expand Down Expand Up @@ -289,4 +296,18 @@ OLAPStatus AlphaRowsetWriter::_init() {
return OLAP_SUCCESS;
}

bool AlphaRowsetWriter::_validate_rowset() {
if (_is_pending_rowset) {
int64_t partition_id = _current_rowset_meta->partition_id();
if (partition_id <= 0) {
LOG(WARNING) << "invalid partition id:" << partition_id << " for pending rowset."
<< ", rowset_id:" << _current_rowset_meta->rowset_id()
<< ", tablet_id:" << _current_rowset_meta->tablet_id()
<< ", schema_hash:" << _current_rowset_meta->tablet_schema_hash();
return false;
}
}
return true;
}

} // namespace doris
3 changes: 3 additions & 0 deletions be/src/olap/rowset/alpha_rowset_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class AlphaRowsetWriter : public RowsetWriter {

private:
OLAPStatus _init();

// validate rowset build arguments before create rowset to make sure correctness
bool _validate_rowset();

private:
int32_t _segment_group_id;
Expand Down
7 changes: 5 additions & 2 deletions be/src/olap/schema_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ OLAPStatus RowBlockAllocator::allocate(RowBlock** row_block,

void RowBlockAllocator::release(RowBlock* row_block) {
if (row_block == nullptr) {
LOG(FATAL) << "null row block released.";
LOG(INFO) << "null row block released.";
return;
}

Expand Down Expand Up @@ -811,7 +811,10 @@ bool SchemaChangeDirectly::process(RowsetReaderSharedPtr rowset_reader, RowsetWr
}

DIRECTLY_PROCESS_ERR:
_row_block_allocator->release(new_row_block);
if (new_row_block) {
_row_block_allocator->release(new_row_block);
new_row_block = nullptr;
}
return result;
}

Expand Down