This commit is contained in:
@ -249,6 +249,7 @@ RowsetSharedPtr BetaRowsetWriter::build() {
|
||||
} else {
|
||||
_rowset_meta->set_rowset_state(VISIBLE);
|
||||
}
|
||||
_rowset_meta->set_segments_key_bounds(_segments_encoded_key_bounds);
|
||||
|
||||
if (_rowset_meta->oldest_write_timestamp() == -1) {
|
||||
_rowset_meta->set_oldest_write_timestamp(UnixSeconds());
|
||||
@ -319,6 +320,13 @@ Status BetaRowsetWriter::_flush_segment_writer(std::unique_ptr<segment_v2::Segme
|
||||
}
|
||||
_total_data_size += segment_size;
|
||||
_total_index_size += index_size;
|
||||
KeyBoundsPB key_bounds;
|
||||
Slice min_key = (*writer)->min_encoded_key();
|
||||
Slice max_key = (*writer)->max_encoded_key();
|
||||
DCHECK_LE(min_key.compare(max_key), 0);
|
||||
key_bounds.set_min_key(min_key.to_string());
|
||||
key_bounds.set_max_key(max_key.to_string());
|
||||
_segments_encoded_key_bounds.emplace_back(key_bounds);
|
||||
writer->reset();
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
@ -101,6 +101,8 @@ private:
|
||||
bool _is_pending = false;
|
||||
bool _already_built = false;
|
||||
|
||||
// for unique key table with merge-on-write
|
||||
std::vector<KeyBoundsPB> _segments_encoded_key_bounds;
|
||||
// record rows number of every segment
|
||||
std::vector<uint32_t> _segment_num_rows;
|
||||
};
|
||||
|
||||
@ -1897,7 +1897,11 @@ Status Tablet::lookup_row_key(const Slice& encoded_key, RowLocation* row_locatio
|
||||
return s;
|
||||
}
|
||||
loc.rowset_id = rs.first->rowset_id();
|
||||
// Check delete bitmap, if the row
|
||||
if (version >= 0 && _tablet_meta->delete_bitmap().contains_agg(
|
||||
{loc.rowset_id, loc.segment_id, version}, loc.row_id)) {
|
||||
// The key is deleted, we don't need to search for it any more.
|
||||
break;
|
||||
}
|
||||
*row_location = loc;
|
||||
// find it and return
|
||||
return s;
|
||||
|
||||
Reference in New Issue
Block a user