fix granule op_ordering bug
This commit is contained in:
16
deps/oblib/src/common/ob_range.h
vendored
16
deps/oblib/src/common/ob_range.h
vendored
@ -567,6 +567,22 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class ObNewRangeCmp
|
||||
{
|
||||
public:
|
||||
ObNewRangeCmp() {}
|
||||
|
||||
// caller ensures no intersection between any two ranges
|
||||
OB_INLINE bool operator() (const ObNewRange *a, const ObNewRange *b) const
|
||||
{
|
||||
int cmp = 0;
|
||||
if (OB_NOT_NULL(a) && OB_NOT_NULL(b)) {
|
||||
cmp = a->compare_with_startkey2(*b);
|
||||
}
|
||||
return cmp < 0;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Allocator>
|
||||
int ObNewRange::deserialize(Allocator &allocator, const char *buf, const int64_t data_len,
|
||||
int64_t &pos)
|
||||
|
@ -865,6 +865,13 @@ int ObGranuleSplitter::get_query_range(ObExecContext &ctx,
|
||||
LOG_WARN("failed to final extract index skip query range", K(ret));
|
||||
} else {
|
||||
has_extract_query_range = true;
|
||||
/* Here is an improvement made:
|
||||
1. By default, access to each partition is always in sequential ascending order.
|
||||
Compared to not sorting, this is an enhancement that is not always 100% necessary
|
||||
(some scenarios do not require order), but the logic is acceptable.
|
||||
2. If reverse order is required outside, then the reverse sorting should be done outside on its own.
|
||||
*/
|
||||
std::sort(scan_ranges.begin(), scan_ranges.end(), ObNewRangeCmp());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user