[improvement] improvement for light weight schema change (#10860)

* improvement for dynamic schema
not use schema as lru cache key any more.
load segment just use the rowset's original schema not the current read schema.
generate column reader and column iterator using the original schema, using the read schema if it is a new column.
using column unique id as key instead of column ordinals.
Co-authored-by: yiguolei <yiguolei@gmail.com>
This commit is contained in:
yiguolei
2022-07-18 17:53:31 +08:00
committed by GitHub
parent ba04c983ae
commit a2ed4b5c78
11 changed files with 75 additions and 47 deletions

View File

@ -59,17 +59,16 @@ void SegmentLoader::_insert(const SegmentLoader::CacheKey& key, SegmentLoader::C
}
Status SegmentLoader::load_segments(const BetaRowsetSharedPtr& rowset,
SegmentCacheHandle* cache_handle,
const TabletSchema* read_tablet_schema, bool use_cache) {
SegmentLoader::CacheKey cache_key(rowset->rowset_id(), *read_tablet_schema);
if (use_cache && _lookup(cache_key, cache_handle)) {
SegmentCacheHandle* cache_handle, bool use_cache) {
SegmentLoader::CacheKey cache_key(rowset->rowset_id());
if (_lookup(cache_key, cache_handle)) {
cache_handle->owned = false;
return Status::OK();
}
cache_handle->owned = !use_cache;
std::vector<segment_v2::SegmentSharedPtr> segments;
RETURN_NOT_OK(rowset->load_segments(&segments, read_tablet_schema));
RETURN_NOT_OK(rowset->load_segments(&segments));
if (use_cache) {
// memory of SegmentLoader::CacheValue will be handled by SegmentLoader