Add Ob2DTMArray to solve sys_tenant memory problem caused by ObPxTabletRange
This commit is contained in:
8
deps/oblib/src/lib/container/ob_2d_array.h
vendored
8
deps/oblib/src/lib/container/ob_2d_array.h
vendored
@ -73,12 +73,14 @@ public:
|
||||
static uint32_t capacity_offset_bits() { return offsetof(Ob2DArray, capacity_) * 8; }
|
||||
|
||||
NEED_SERIALIZE_AND_DESERIALIZE;
|
||||
private:
|
||||
using MyOp = ObClassOp<T, std::is_trivial<T>::value>;
|
||||
// function members
|
||||
|
||||
protected:
|
||||
template <typename U>
|
||||
int inner_assign(const U &other);
|
||||
|
||||
private:
|
||||
using MyOp = ObClassOp<T, std::is_trivial<T>::value>;
|
||||
// function members
|
||||
void construct_items(T *ptr, int64_t cnt);
|
||||
int set_default(const int64_t new_size);
|
||||
T *get_obj_pos(int64_t i) const;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "lib/compress/ob_compress_util.h"
|
||||
#include "storage/tx/ob_trans_define.h"
|
||||
#include "sql/engine/ob_exec_feedback_info.h"
|
||||
#include "sql/ob_sql_define.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -545,9 +546,9 @@ public:
|
||||
public:
|
||||
static const int64_t DEFAULT_RANGE_COUNT = 8;
|
||||
typedef common::ObSEArray<common::ObRowkey, DEFAULT_RANGE_COUNT> EndKeys;
|
||||
typedef Ob2DArray<ObDatum> DatumKey;
|
||||
typedef ObTMSegmentArray<ObDatum> DatumKey;
|
||||
typedef ObSEArray<int64_t, 2> RangeWeight;
|
||||
typedef ObSEArray<DatumKey, DEFAULT_RANGE_COUNT> RangeCut; // not include MAX at last nor MIN at first
|
||||
typedef ObTMArray<DatumKey> RangeCut; // not include MAX at last nor MIN at first
|
||||
typedef ObSEArray<RangeWeight, DEFAULT_RANGE_COUNT> RangeWeights;
|
||||
|
||||
int64_t tablet_id_;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "share/ob_define.h"
|
||||
#include "deps/oblib/src/lib/container/ob_array.h"
|
||||
#include "src/share/rc/ob_tenant_base.h"
|
||||
#include "deps/oblib/src/lib/container/ob_2d_array.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -624,6 +625,30 @@ ObTMArray<T, BlockAllocatorT, auto_free, CallBack, ItemEncode>::ObTMArray(int64_
|
||||
this->set_tenant_id(MTL_ID());
|
||||
}
|
||||
|
||||
template <typename T, int max_block_size = OB_MALLOC_BIG_BLOCK_SIZE,
|
||||
typename BlockAllocatorT = ModulePageAllocator,
|
||||
bool auto_free = false,
|
||||
typename BlockPointerArrayT = ObSEArray<T *, OB_BLOCK_POINTER_ARRAY_SIZE,
|
||||
BlockAllocatorT, auto_free> >
|
||||
class ObTMSegmentArray final : public Ob2DArray<T, max_block_size, BlockAllocatorT, auto_free,
|
||||
BlockPointerArrayT>
|
||||
{
|
||||
public:
|
||||
ObTMSegmentArray(const BlockAllocatorT &alloc = BlockAllocatorT("TMSegmentArray"));
|
||||
int assign(const ObTMSegmentArray &other) { return this->inner_assign(other); }
|
||||
};
|
||||
|
||||
template <typename T, int max_block_size,
|
||||
typename BlockAllocatorT, bool auto_free,
|
||||
typename BlockPointerArrayT>
|
||||
ObTMSegmentArray<T, max_block_size, BlockAllocatorT, auto_free,
|
||||
BlockPointerArrayT>::ObTMSegmentArray(const BlockAllocatorT &alloc)
|
||||
: Ob2DArray<T, max_block_size, BlockAllocatorT, auto_free,
|
||||
BlockPointerArrayT>(alloc)
|
||||
{
|
||||
this->set_tenant_id(MTL_ID());
|
||||
}
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
#endif /* OCEANBASE_SQL_OB_SQL_DEFINE_H_ */
|
||||
|
Reference in New Issue
Block a user