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; }
|
static uint32_t capacity_offset_bits() { return offsetof(Ob2DArray, capacity_) * 8; }
|
||||||
|
|
||||||
NEED_SERIALIZE_AND_DESERIALIZE;
|
NEED_SERIALIZE_AND_DESERIALIZE;
|
||||||
private:
|
|
||||||
using MyOp = ObClassOp<T, std::is_trivial<T>::value>;
|
protected:
|
||||||
// function members
|
|
||||||
template <typename U>
|
template <typename U>
|
||||||
int inner_assign(const U &other);
|
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);
|
void construct_items(T *ptr, int64_t cnt);
|
||||||
int set_default(const int64_t new_size);
|
int set_default(const int64_t new_size);
|
||||||
T *get_obj_pos(int64_t i) const;
|
T *get_obj_pos(int64_t i) const;
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
#include "lib/compress/ob_compress_util.h"
|
#include "lib/compress/ob_compress_util.h"
|
||||||
#include "storage/tx/ob_trans_define.h"
|
#include "storage/tx/ob_trans_define.h"
|
||||||
#include "sql/engine/ob_exec_feedback_info.h"
|
#include "sql/engine/ob_exec_feedback_info.h"
|
||||||
|
#include "sql/ob_sql_define.h"
|
||||||
|
|
||||||
namespace oceanbase
|
namespace oceanbase
|
||||||
{
|
{
|
||||||
@ -545,9 +546,9 @@ public:
|
|||||||
public:
|
public:
|
||||||
static const int64_t DEFAULT_RANGE_COUNT = 8;
|
static const int64_t DEFAULT_RANGE_COUNT = 8;
|
||||||
typedef common::ObSEArray<common::ObRowkey, DEFAULT_RANGE_COUNT> EndKeys;
|
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<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;
|
typedef ObSEArray<RangeWeight, DEFAULT_RANGE_COUNT> RangeWeights;
|
||||||
|
|
||||||
int64_t tablet_id_;
|
int64_t tablet_id_;
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
#include "share/ob_define.h"
|
#include "share/ob_define.h"
|
||||||
#include "deps/oblib/src/lib/container/ob_array.h"
|
#include "deps/oblib/src/lib/container/ob_array.h"
|
||||||
#include "src/share/rc/ob_tenant_base.h"
|
#include "src/share/rc/ob_tenant_base.h"
|
||||||
|
#include "deps/oblib/src/lib/container/ob_2d_array.h"
|
||||||
|
|
||||||
namespace oceanbase
|
namespace oceanbase
|
||||||
{
|
{
|
||||||
@ -487,7 +488,7 @@ enum DominateRelation
|
|||||||
OBJ_UNCOMPARABLE
|
OBJ_UNCOMPARABLE
|
||||||
};
|
};
|
||||||
|
|
||||||
// for parallel precedence, refer to
|
// for parallel precedence, refer to
|
||||||
// https://docs.oracle.com/cd/E11882_01/server.112/e41573/hintsref.htm#PFGRF94937
|
// https://docs.oracle.com/cd/E11882_01/server.112/e41573/hintsref.htm#PFGRF94937
|
||||||
enum PXParallelRule
|
enum PXParallelRule
|
||||||
{
|
{
|
||||||
@ -624,6 +625,30 @@ ObTMArray<T, BlockAllocatorT, auto_free, CallBack, ItemEncode>::ObTMArray(int64_
|
|||||||
this->set_tenant_id(MTL_ID());
|
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 sql
|
||||||
} // namespace oceanbase
|
} // namespace oceanbase
|
||||||
#endif /* OCEANBASE_SQL_OB_SQL_DEFINE_H_ */
|
#endif /* OCEANBASE_SQL_OB_SQL_DEFINE_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user