fix compile warnings
This commit is contained in:
parent
ad8465b5ce
commit
8c4a2f26a6
19
deps/oblib/src/CMakeLists.txt
vendored
19
deps/oblib/src/CMakeLists.txt
vendored
@ -14,17 +14,16 @@ if (OB_USE_CLANG)
|
||||
target_compile_options(oblib_base_base
|
||||
INTERFACE
|
||||
-fmax-type-align=8
|
||||
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
|
||||
-D_NO_EXCEPTION -Wall -Wextra -Wformat -Wno-deprecated
|
||||
-fno-strict-aliasing -fno-omit-frame-pointer ${MARCH_CFLAGS} ${MTUNE_CFLAGS}
|
||||
-Wno-address-of-packed-member
|
||||
-Wno-sign-compare -Wno-sign-conversion -Wno-unused-parameter -Werror
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wno-tautological-pointer-compare -Wno-overloaded-virtual
|
||||
-Wno-inconsistent-missing-override -Wno-c++17-compat-mangling -Wno-unused-private-field
|
||||
-Wno-mismatched-tags -Wno-delete-non-virtual-dtor -Wno-dynamic-class-memaccess
|
||||
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_NO_EXCEPTION
|
||||
-Wall -Wextra -Wformat -Wno-deprecated
|
||||
-fno-omit-frame-pointer ${MARCH_CFLAGS} ${MTUNE_CFLAGS}
|
||||
-Wno-address-of-packed-member -Wno-sign-compare -Werror
|
||||
-Wno-inconsistent-missing-override -fno-delete-null-pointer-checks
|
||||
-Wno-delete-non-virtual-dtor -Wno-dynamic-class-memaccess
|
||||
-Wno-format-security -Wno-reserved-user-defined-literal -Wno-sometimes-uninitialized
|
||||
-Wno-unused-value -Wno-self-assign -Wno-unused-variable -Wno-invalid-offsetof
|
||||
-Wno-tautological-compare -Wno-psabi -Wno-c99-designator>)
|
||||
-Wno-unused-value -Wno-self-assign -Wno-overloaded-virtual
|
||||
-Wno-unused-private-field -Wno-mismatched-tags -Wno-unused-variable
|
||||
-Wno-invalid-offsetof -Wno-tautological-compare -Wno-psabi -Wno-c99-designator)
|
||||
else()
|
||||
target_compile_options(oblib_base_base
|
||||
INTERFACE
|
||||
|
109
deps/oblib/src/lib/allocator/page_arena.h
vendored
109
deps/oblib/src/lib/allocator/page_arena.h
vendored
@ -980,88 +980,41 @@ typedef PageArena<> CharArena;
|
||||
typedef PageArena<unsigned char> ByteArena;
|
||||
typedef PageArena<char, ModulePageAllocator> ModuleArena;
|
||||
|
||||
class ObArenaAllocator final : public ObIAllocator {
|
||||
public:
|
||||
ObArenaAllocator(const lib::ObLabel& label = ObModIds::OB_MODULE_PAGE_ALLOCATOR,
|
||||
const int64_t page_size = OB_MALLOC_NORMAL_BLOCK_SIZE, int64_t tenant_id = OB_SERVER_TENANT_ID,
|
||||
int64_t ctx_id = 0)
|
||||
: arena_(page_size, ModulePageAllocator(label, tenant_id, ctx_id)){};
|
||||
ObArenaAllocator(ObIAllocator& allocator, const int64_t page_size = OB_MALLOC_NORMAL_BLOCK_SIZE)
|
||||
: arena_(page_size, ModulePageAllocator(allocator)){};
|
||||
virtual ~ObArenaAllocator(){};
|
||||
|
||||
public:
|
||||
virtual void* alloc(const int64_t sz)
|
||||
{
|
||||
return arena_.alloc_aligned(sz);
|
||||
}
|
||||
void* alloc(const int64_t size, const ObMemAttr& attr)
|
||||
class ObArenaAllocator final : public ObIAllocator
|
||||
{
|
||||
public:
|
||||
ObArenaAllocator(const lib::ObLabel &label = ObModIds::OB_MODULE_PAGE_ALLOCATOR,
|
||||
const int64_t page_size = OB_MALLOC_NORMAL_BLOCK_SIZE,
|
||||
int64_t tenant_id = OB_SERVER_TENANT_ID,
|
||||
int64_t ctx_id = 0)
|
||||
: arena_(page_size, ModulePageAllocator(label, tenant_id, ctx_id)) {};
|
||||
ObArenaAllocator(ObIAllocator &allocator, const int64_t page_size = OB_MALLOC_NORMAL_BLOCK_SIZE)
|
||||
: arena_(page_size, ModulePageAllocator(allocator)) {};
|
||||
virtual ~ObArenaAllocator() {};
|
||||
public:
|
||||
virtual void *alloc(const int64_t sz) override{ return arena_.alloc_aligned(sz); }
|
||||
void *alloc(const int64_t size, const ObMemAttr &attr) override
|
||||
{
|
||||
UNUSED(attr);
|
||||
return alloc(size);
|
||||
}
|
||||
virtual void* alloc_aligned(const int64_t sz, const int64_t align)
|
||||
{
|
||||
return arena_.alloc_aligned(sz, align);
|
||||
}
|
||||
virtual void* realloc(void* ptr, const int64_t oldsz, const int64_t newsz)
|
||||
{
|
||||
return arena_.realloc(reinterpret_cast<char*>(ptr), oldsz, newsz);
|
||||
}
|
||||
virtual void free(void* ptr)
|
||||
{
|
||||
arena_.free(reinterpret_cast<char*>(ptr));
|
||||
ptr = NULL;
|
||||
}
|
||||
virtual void clear()
|
||||
{
|
||||
arena_.free();
|
||||
}
|
||||
int64_t used() const
|
||||
{
|
||||
return arena_.used();
|
||||
}
|
||||
int64_t total() const
|
||||
{
|
||||
return arena_.total();
|
||||
}
|
||||
void reset()
|
||||
{
|
||||
arena_.free();
|
||||
}
|
||||
void reset_remain_one_page()
|
||||
{
|
||||
arena_.free_remain_one_page();
|
||||
}
|
||||
void reuse() override
|
||||
{
|
||||
arena_.reuse();
|
||||
}
|
||||
virtual void set_label(const lib::ObLabel& label)
|
||||
{
|
||||
arena_.set_label(label);
|
||||
}
|
||||
virtual lib::ObLabel get_label() const
|
||||
{
|
||||
return arena_.get_label();
|
||||
}
|
||||
virtual void set_tenant_id(uint64_t tenant_id)
|
||||
{
|
||||
arena_.set_tenant_id(tenant_id);
|
||||
}
|
||||
bool set_tracer()
|
||||
{
|
||||
return arena_.set_tracer();
|
||||
}
|
||||
bool revert_tracer()
|
||||
{
|
||||
return arena_.revert_tracer();
|
||||
}
|
||||
void set_ctx_id(int64_t ctx_id)
|
||||
{
|
||||
arena_.set_ctx_id(ctx_id);
|
||||
}
|
||||
void set_attr(const ObMemAttr& attr) override
|
||||
virtual void *alloc_aligned(const int64_t sz, const int64_t align)
|
||||
{ return arena_.alloc_aligned(sz, align); }
|
||||
virtual void *realloc(void *ptr, const int64_t oldsz, const int64_t newsz) override { return arena_.realloc(reinterpret_cast<char*>(ptr), oldsz, newsz); }
|
||||
virtual void free(void *ptr) override { arena_.free(reinterpret_cast<char *>(ptr)); ptr = NULL; }
|
||||
virtual void clear() { arena_.free(); }
|
||||
int64_t used() const override { return arena_.used(); }
|
||||
int64_t total() const override { return arena_.total(); }
|
||||
void reset() override { arena_.free(); }
|
||||
void reset_remain_one_page() { arena_.free_remain_one_page(); }
|
||||
void reuse() override { arena_.reuse(); }
|
||||
virtual void set_label(const lib::ObLabel &label) { arena_.set_label(label); }
|
||||
virtual lib::ObLabel get_label() const { return arena_.get_label(); }
|
||||
virtual void set_tenant_id(uint64_t tenant_id) { arena_.set_tenant_id(tenant_id); }
|
||||
bool set_tracer() { return arena_.set_tracer(); }
|
||||
bool revert_tracer() { return arena_.revert_tracer(); }
|
||||
void set_ctx_id(int64_t ctx_id) { arena_.set_ctx_id(ctx_id); }
|
||||
void set_attr(const ObMemAttr &attr) override
|
||||
{
|
||||
arena_.set_tenant_id(attr.tenant_id_);
|
||||
arena_.set_ctx_id(attr.ctx_id_);
|
||||
|
10
deps/oblib/src/lib/charset/ob_ctype_bin.c
vendored
10
deps/oblib/src/lib/charset/ob_ctype_bin.c
vendored
@ -547,7 +547,8 @@ size_t ob_max_bytes_charpos_8bit(const ObCharsetInfo* cs __attribute__((unused))
|
||||
return max_bytes;
|
||||
}
|
||||
|
||||
size_t ob_well_formed_len_8bit(const char* str, size_t len, size_t nchars, int* error)
|
||||
size_t ob_well_formed_len_8bit(const char *str __attribute__((unused)),
|
||||
size_t len, size_t nchars, int *error)
|
||||
{
|
||||
size_t nbytes = len;
|
||||
*error = 0;
|
||||
@ -636,8 +637,11 @@ static int ob_strnncollsp_binary(const ObCharsetInfo* cs __attribute__((unused))
|
||||
return ob_strnncoll_binary(cs, s, slen, t, tlen);
|
||||
}
|
||||
|
||||
static size_t ob_strnxfrm_8bit_bin(const ObCharsetInfo* cs, unsigned char* dst, size_t dstlen, uint32_t nweights,
|
||||
const unsigned char* src, size_t srclen, int* is_valid_unicode)
|
||||
static size_t
|
||||
ob_strnxfrm_8bit_bin(const ObCharsetInfo *cs __attribute__((unused)),
|
||||
unsigned char * dst, size_t dstlen, uint32_t nweights,
|
||||
const unsigned char *src, size_t srclen,
|
||||
int *is_valid_unicode)
|
||||
{
|
||||
*is_valid_unicode = 1;
|
||||
srclen = (srclen < dstlen ? srclen : dstlen);
|
||||
|
91
deps/oblib/src/lib/container/ob_array.h
vendored
91
deps/oblib/src/lib/container/ob_array.h
vendored
@ -92,32 +92,17 @@ class ObArrayImpl : public ObIArray<T> {
|
||||
ObArrayImpl(int64_t block_size = OB_MALLOC_NORMAL_BLOCK_SIZE,
|
||||
const BlockAllocatorT& alloc = BlockAllocatorT(ObNewModIds::OB_COMMON_ARRAY));
|
||||
virtual ~ObArrayImpl() __attribute__((noinline));
|
||||
inline void set_label(const lib::ObLabel& label)
|
||||
{
|
||||
block_allocator_.set_label(label);
|
||||
}
|
||||
inline void set_block_size(const int64_t block_size)
|
||||
{
|
||||
block_size_ = block_size;
|
||||
}
|
||||
inline int64_t get_block_size() const
|
||||
{
|
||||
return block_size_;
|
||||
}
|
||||
inline void set_block_allocator(const BlockAllocatorT& alloc)
|
||||
{
|
||||
block_allocator_ = alloc;
|
||||
}
|
||||
inline const BlockAllocatorT& get_block_allocator() const
|
||||
{
|
||||
return block_allocator_;
|
||||
}
|
||||
int push_back(const T& obj);
|
||||
void pop_back();
|
||||
int pop_back(T& obj);
|
||||
int remove(const int64_t idx);
|
||||
inline void set_label(const lib::ObLabel &label) { block_allocator_.set_label(label); }
|
||||
inline void set_block_size(const int64_t block_size) { block_size_ = block_size; }
|
||||
inline int64_t get_block_size() const {return block_size_; }
|
||||
inline void set_block_allocator(const BlockAllocatorT &alloc) { block_allocator_ = alloc; }
|
||||
inline const BlockAllocatorT &get_block_allocator() const {return block_allocator_;}
|
||||
int push_back(const T &obj) override;
|
||||
void pop_back() override;
|
||||
int pop_back(T &obj) override;
|
||||
int remove(const int64_t idx) override;
|
||||
|
||||
inline int at(const int64_t idx, T& obj) const
|
||||
inline int at(const int64_t idx, T &obj) const override
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(OB_SUCCESS != error_)) {
|
||||
@ -138,20 +123,11 @@ class ObArrayImpl : public ObIArray<T> {
|
||||
OB_ASSERT(OB_SUCCESS == error_);
|
||||
}
|
||||
|
||||
inline T& operator[](const int64_t idx)
|
||||
{
|
||||
return at(idx);
|
||||
}
|
||||
inline const T& operator[](const int64_t idx) const
|
||||
{
|
||||
return at(idx);
|
||||
}
|
||||
T* alloc_place_holder();
|
||||
inline int64_t size() const
|
||||
{
|
||||
return count();
|
||||
}
|
||||
void reuse()
|
||||
inline T &operator[](const int64_t idx) {return at(idx);}
|
||||
inline const T &operator[](const int64_t idx) const {return at(idx);}
|
||||
T *alloc_place_holder() override;
|
||||
inline int64_t size() const { return count();}
|
||||
void reuse() override
|
||||
{
|
||||
CallBack cb;
|
||||
if (data_size_ <= block_size_) {
|
||||
@ -160,12 +136,9 @@ class ObArrayImpl : public ObIArray<T> {
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
inline void reset()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
void destroy();
|
||||
inline int reserve(int64_t capacity)
|
||||
inline void reset() override {destroy();}
|
||||
void destroy() override;
|
||||
inline int reserve(int64_t capacity) override
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (capacity > data_size_ / (int64_t)sizeof(T)) {
|
||||
@ -176,8 +149,8 @@ class ObArrayImpl : public ObIArray<T> {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
// prepare allocate can avoid declaring local data
|
||||
int prepare_allocate(int64_t capacity)
|
||||
//prepare allocate can avoid declaring local data
|
||||
int prepare_allocate(int64_t capacity) override
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ret = reserve(capacity);
|
||||
@ -192,19 +165,11 @@ class ObArrayImpl : public ObIArray<T> {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int64_t to_string(char* buffer, int64_t length) const;
|
||||
inline int64_t get_data_size() const
|
||||
{
|
||||
return data_size_;
|
||||
}
|
||||
inline bool error() const
|
||||
{
|
||||
return error_ != OB_SUCCESS;
|
||||
}
|
||||
inline int get_copy_assign_ret() const
|
||||
{
|
||||
return error_;
|
||||
}
|
||||
|
||||
int64_t to_string(char *buffer, int64_t length) const override;
|
||||
inline int64_t get_data_size() const {return data_size_;}
|
||||
inline bool error() const {return error_ != OB_SUCCESS;}
|
||||
inline int get_copy_assign_ret() const { return error_; }
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
iterator begin();
|
||||
@ -230,9 +195,9 @@ class ObArrayImpl : public ObIArray<T> {
|
||||
return ret;
|
||||
}
|
||||
// deep copy
|
||||
ObArrayImpl(const ObArrayImpl& other);
|
||||
ObArrayImpl& operator=(const ObArrayImpl& other);
|
||||
int assign(const ObIArray<T>& other);
|
||||
ObArrayImpl(const ObArrayImpl &other);
|
||||
ObArrayImpl &operator=(const ObArrayImpl &other);
|
||||
int assign(const ObIArray<T> &other) override;
|
||||
NEED_SERIALIZE_AND_DESERIALIZE;
|
||||
|
||||
static uint32_t data_offset_bits()
|
||||
|
6
deps/oblib/src/lib/coro/co_set_sched.h
vendored
6
deps/oblib/src/lib/coro/co_set_sched.h
vendored
@ -84,9 +84,9 @@ class CoSetSched : public CoBaseSched {
|
||||
|
||||
int create_routine(RoutineFunc start) override;
|
||||
|
||||
protected:
|
||||
int prepare();
|
||||
void postrun();
|
||||
protected:
|
||||
int prepare() override;
|
||||
void postrun() override;
|
||||
|
||||
private:
|
||||
void add_runnable(CoBaseSched::Worker& w) override;
|
||||
|
@ -26,13 +26,13 @@ namespace sqlclient {
|
||||
class ObSingleMySQLServerProvider : public ObMySQLServerProvider {
|
||||
public:
|
||||
ObSingleMySQLServerProvider();
|
||||
void init(const ObAddr& server);
|
||||
virtual int get_cluster_list(common::ObIArray<int64_t>& cluster_list);
|
||||
virtual int get_server(const int64_t cluster_id, const int64_t svr_idx, common::ObAddr& server);
|
||||
virtual int64_t get_cluster_count() const;
|
||||
virtual int64_t get_server_count() const;
|
||||
virtual int64_t get_server_count(const int64_t cluster_id) const;
|
||||
int refresh_server_list(void);
|
||||
void init(const ObAddr &server);
|
||||
virtual int get_cluster_list(common::ObIArray<int64_t> &cluster_list) override;
|
||||
virtual int get_server(const int64_t cluster_id, const int64_t svr_idx, common::ObAddr &server) override;
|
||||
virtual int64_t get_cluster_count() const override;
|
||||
virtual int64_t get_server_count() const override;
|
||||
virtual int64_t get_server_count(const int64_t cluster_id) const override;
|
||||
int refresh_server_list(void) override;
|
||||
int prepare_refresh() override;
|
||||
|
||||
private:
|
||||
|
5
deps/oblib/src/lib/regex/regex/regc_nfa.cpp
vendored
5
deps/oblib/src/lib/regex/regex/regc_nfa.cpp
vendored
@ -276,7 +276,10 @@ static void freestate(struct nfa* nfa, struct state* s)
|
||||
- destroystate - really get rid of an already-freed state
|
||||
^ static void destroystate(struct nfa *, struct state *);
|
||||
*/
|
||||
static void destroystate(struct nfa* nfa, struct state* s)
|
||||
static void
|
||||
destroystate(
|
||||
struct nfa *nfa __attribute__((unused)),
|
||||
struct state *s)
|
||||
{
|
||||
struct arcbatch* ab;
|
||||
struct arcbatch* abnext;
|
||||
|
10
deps/oblib/src/lib/regex/regex/regexec.cpp
vendored
10
deps/oblib/src/lib/regex/regex/regexec.cpp
vendored
@ -441,8 +441,14 @@ static int cfind(struct vars* v, struct cnfa* cnfa, struct colormap* cm)
|
||||
^ static int cfindloop(struct vars *, struct cnfa *, struct colormap *,
|
||||
^ struct dfa *, struct dfa *, chr **);
|
||||
*/
|
||||
static int cfindloop(struct vars* v, struct cnfa* cnfa, struct colormap* cm, struct dfa* d, struct dfa* s,
|
||||
chr** coldp) /* where to put coldstart pointer */
|
||||
static int
|
||||
cfindloop(
|
||||
struct vars *v,
|
||||
struct cnfa *cnfa __attribute__((unused)),
|
||||
struct colormap *cm __attribute__((unused)),
|
||||
struct dfa *d,
|
||||
struct dfa *s,
|
||||
chr **coldp) /* where to put coldstart pointer */
|
||||
{
|
||||
chr* begin;
|
||||
chr* end;
|
||||
|
@ -54,7 +54,7 @@ class ObDynamicThreadPool : public lib::ThreadPool {
|
||||
int add_task(ObDynamicThreadTask* task);
|
||||
|
||||
void run1() override;
|
||||
void stop();
|
||||
void stop() override;
|
||||
void destroy();
|
||||
void task_thread_idle();
|
||||
int64_t get_task_count() const
|
||||
|
@ -39987,6 +39987,5 @@ OB_SERIALIZE_MEMBER(ObIntervalYMValue, nmonth_);
|
||||
// Referenced by dereference pointer to avoid GCC reference packed filed error:
|
||||
// cannot bind packed field fractional_second_ to `int32_t &`
|
||||
OB_SERIALIZE_MEMBER(ObIntervalDSValue, (*(int64_t*)&nsecond_), (*(int32_t*)&fractional_second_));
|
||||
|
||||
} // namespace common
|
||||
} // namespace oceanbase
|
||||
|
@ -346,189 +346,344 @@ class ObLogRpcStat {
|
||||
|
||||
class ObLogEngine : public ObILogEngine, public share::ObThreadPool {
|
||||
// TODO private/public function
|
||||
friend class ObLogEngineAccessor; // for clog perf test
|
||||
public:
|
||||
ObLogEngine() : is_inited_(false), batch_rpc_(NULL), rpc_(NULL)
|
||||
{}
|
||||
virtual ~ObLogEngine()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
int init(const ObLogEnv::Config& cfg, const common::ObAddr& self_addr, obrpc::ObBatchRpc* batch_rpc,
|
||||
obrpc::ObLogRpcProxy* rpc, common::ObICallbackHandler* callback_handler,
|
||||
storage::ObPartitionService* partition_service);
|
||||
int start();
|
||||
void stop();
|
||||
void wait();
|
||||
friend class ObLogEngineAccessor;//for clog perf test
|
||||
public:
|
||||
ObLogEngine(): is_inited_(false),
|
||||
batch_rpc_(NULL),
|
||||
rpc_(NULL) {}
|
||||
virtual ~ObLogEngine() { destroy(); }
|
||||
int init(const ObLogEnv::Config &cfg,
|
||||
const common::ObAddr &self_addr,
|
||||
obrpc::ObBatchRpc *batch_rpc,
|
||||
obrpc::ObLogRpcProxy *rpc,
|
||||
common::ObICallbackHandler *callback_handler,
|
||||
storage::ObPartitionService *partition_service);
|
||||
int start() override;
|
||||
void stop() override;
|
||||
void wait() override;
|
||||
void destroy();
|
||||
void run1();
|
||||
ObIRawLogIterator* alloc_raw_log_iterator(
|
||||
const file_id_t start_file_id, const file_id_t end_file_id, const offset_t offset, const int64_t timeout);
|
||||
void revert_raw_log_iterator(ObIRawLogIterator* iter);
|
||||
int read_log_by_location(const ObReadParam& param, ObReadBuf& buf, ObLogEntry& entry);
|
||||
int read_log_by_location(const ObLogTask& log_task, ObReadBuf& buf, ObLogEntry& entry);
|
||||
int read_log_by_location(const ObReadParam& param, ObReadBuf& buf, ObLogEntry& entry, ObReadCost& cost);
|
||||
int get_clog_real_length(const ObReadParam& param, int64_t& real_length);
|
||||
void run1() override;
|
||||
ObIRawLogIterator *alloc_raw_log_iterator(const file_id_t start_file_id,
|
||||
const file_id_t end_file_id,
|
||||
const offset_t offset,
|
||||
const int64_t timeout) override;
|
||||
void revert_raw_log_iterator(ObIRawLogIterator *iter) override;
|
||||
int read_log_by_location(const ObReadParam ¶m,
|
||||
ObReadBuf &buf,
|
||||
ObLogEntry &entry) override;
|
||||
int read_log_by_location(const ObLogTask &log_task,
|
||||
ObReadBuf &buf,
|
||||
ObLogEntry &entry) override;
|
||||
int read_log_by_location(const ObReadParam ¶m,
|
||||
ObReadBuf &buf,
|
||||
ObLogEntry &entry,
|
||||
ObReadCost &cost) override;
|
||||
int get_clog_real_length(const ObReadParam ¶m, int64_t &real_length) override;
|
||||
// read clog from hot cache
|
||||
int read_data_from_hot_cache(
|
||||
const file_id_t want_file_id, const offset_t want_offset, const int64_t want_size, char* user_buf);
|
||||
int read_data_from_hot_cache(const file_id_t want_file_id,
|
||||
const offset_t want_offset,
|
||||
const int64_t want_size,
|
||||
char *user_buf) override;
|
||||
|
||||
// want_size refers to the length in clog, which may be the length after compression,
|
||||
// and the returned data is after decompression
|
||||
int read_uncompressed_data_from_hot_cache(const common::ObAddr& addr, const int64_t seq, const file_id_t want_file_id,
|
||||
const offset_t want_offset, const int64_t want_size, char* user_buf, const int64_t buf_size,
|
||||
int64_t& origin_data_len);
|
||||
int read_uncompressed_data_from_hot_cache(const common::ObAddr &addr,
|
||||
const int64_t seq,
|
||||
const file_id_t want_file_id,
|
||||
const offset_t want_offset,
|
||||
const int64_t want_size,
|
||||
char *user_buf,
|
||||
const int64_t buf_size,
|
||||
int64_t &origin_data_len) override;
|
||||
// read clog from disk directly
|
||||
int read_data_direct(const ObReadParam& param, ObReadBuf& rbuf, ObReadRes& res, ObReadCost& cost);
|
||||
int submit_flush_task(FlushTask* task);
|
||||
int submit_flush_task(ObBatchSubmitDiskTask* task);
|
||||
int submit_net_task(const share::ObCascadMemberList& mem_list, const common::ObPartitionKey& key,
|
||||
const ObPushLogMode push_mode, ObILogNetTask* task);
|
||||
int submit_fetch_log_resp(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& key, const int64_t network_limit, const ObPushLogMode push_mode,
|
||||
ObILogNetTask* task);
|
||||
int submit_push_ms_log_req(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& key, ObILogNetTask* task);
|
||||
int submit_fake_ack(const common::ObAddr& server, const common::ObPartitionKey& key, const uint64_t log_id,
|
||||
const ObProposalID proposal_id);
|
||||
int submit_fake_push_log_req(const common::ObMemberList& member_list, const common::ObPartitionKey& key,
|
||||
const uint64_t log_id, const ObProposalID proposal_id);
|
||||
int submit_log_ack(const common::ObAddr& server, const int64_t dst_cluster_id, const common::ObPartitionKey& key,
|
||||
const uint64_t log_id, const common::ObProposalID proposal_id);
|
||||
int standby_query_sync_start_id(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& key, const int64_t send_ts);
|
||||
int submit_sync_start_id_resp(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& key, const int64_t original_send_ts, const uint64_t sync_start_id);
|
||||
int submit_standby_log_ack(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& key, const uint64_t log_id, const ObProposalID proposal_id);
|
||||
int submit_renew_ms_log_ack(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& key, const uint64_t log_id, const int64_t submit_timestamp,
|
||||
const common::ObProposalID proposal_id);
|
||||
int read_data_direct(const ObReadParam ¶m,
|
||||
ObReadBuf &rbuf,
|
||||
ObReadRes &res,
|
||||
ObReadCost &cost) override;
|
||||
int submit_flush_task(FlushTask *task) override;
|
||||
int submit_flush_task(ObBatchSubmitDiskTask *task);
|
||||
int submit_net_task(
|
||||
const share::ObCascadMemberList &mem_list,
|
||||
const common::ObPartitionKey &key,
|
||||
const ObPushLogMode push_mode,
|
||||
ObILogNetTask *task) override;
|
||||
int submit_fetch_log_resp(
|
||||
const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const int64_t network_limit,
|
||||
const ObPushLogMode push_mode,
|
||||
ObILogNetTask *task) override;
|
||||
int submit_push_ms_log_req(
|
||||
const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
ObILogNetTask *task) override;
|
||||
int submit_fake_ack(
|
||||
const common::ObAddr &server,
|
||||
const common::ObPartitionKey &key,
|
||||
const uint64_t log_id,
|
||||
const ObProposalID proposal_id) override;
|
||||
int submit_fake_push_log_req(
|
||||
const common::ObMemberList &member_list,
|
||||
const common::ObPartitionKey &key,
|
||||
const uint64_t log_id,
|
||||
const ObProposalID proposal_id) override;
|
||||
int submit_log_ack(
|
||||
const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const uint64_t log_id,
|
||||
const common::ObProposalID proposal_id) override;
|
||||
int standby_query_sync_start_id(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const int64_t send_ts) override;
|
||||
int submit_sync_start_id_resp(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const int64_t original_send_ts,
|
||||
const uint64_t sync_start_id) override;
|
||||
int submit_standby_log_ack(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const uint64_t log_id,
|
||||
const ObProposalID proposal_id) override;
|
||||
int submit_renew_ms_log_ack(
|
||||
const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const uint64_t log_id,
|
||||
const int64_t submit_timestamp,
|
||||
const common::ObProposalID proposal_id) override;
|
||||
// send fetch log request to all followers
|
||||
int fetch_log_from_all_follower(const common::ObMemberList& mem_list, const common::ObPartitionKey& key,
|
||||
const uint64_t start_id, const uint64_t end_id, const common::ObProposalID proposal_id,
|
||||
const uint64_t max_confirmed_log_id);
|
||||
int fetch_log_from_leader(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& key, const ObFetchLogType fetch_type, const uint64_t start_id,
|
||||
const uint64_t end_id, const common::ObProposalID proposal_id, const common::ObReplicaType replica_type,
|
||||
const uint64_t max_confirmed_log_id);
|
||||
int fetch_log_from_all_follower(
|
||||
const common::ObMemberList &mem_list,
|
||||
const common::ObPartitionKey &key,
|
||||
const uint64_t start_id,
|
||||
const uint64_t end_id,
|
||||
const common::ObProposalID proposal_id,
|
||||
const uint64_t max_confirmed_log_id) override;
|
||||
int fetch_log_from_leader(
|
||||
const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const ObFetchLogType fetch_type,
|
||||
const uint64_t start_id,
|
||||
const uint64_t end_id,
|
||||
const common::ObProposalID proposal_id,
|
||||
const common::ObReplicaType replica_type,
|
||||
const uint64_t max_confirmed_log_id) override;
|
||||
int submit_check_rebuild_req(
|
||||
const common::ObAddr& server, const int64_t dst_cluster_id, const ObPartitionKey& key, const uint64_t start_id);
|
||||
int fetch_register_server(const common::ObAddr& server, const int64_t dst_cluster_id, const ObPartitionKey& key,
|
||||
const common::ObRegion& region, const common::ObIDC& idc, const common::ObReplicaType replica_type,
|
||||
const int64_t next_replay_log_ts, const bool is_request_leader, const bool is_need_force_register);
|
||||
int response_register_server(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& key, const bool is_assign_parent_succeed,
|
||||
const share::ObCascadMemberList& candidate_list, const int32_t msg_type);
|
||||
int request_replace_sick_child(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& key, const common::ObAddr& sick_child);
|
||||
int reject_server(const common::ObAddr& server, const int64_t dst_cluster_id, const common::ObPartitionKey& key,
|
||||
const int32_t msg_type);
|
||||
int notify_restore_log_finished(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& key, const uint64_t log_id);
|
||||
int notify_reregister(const common::ObAddr& server, const int64_t dst_cluster_id, const common::ObPartitionKey& key,
|
||||
const share::ObCascadMember& new_leader);
|
||||
const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const ObPartitionKey &key,
|
||||
const uint64_t start_id) override;
|
||||
int fetch_register_server(
|
||||
const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const ObPartitionKey &key,
|
||||
const common::ObRegion ®ion,
|
||||
const common::ObIDC &idc,
|
||||
const common::ObReplicaType replica_type,
|
||||
const int64_t next_replay_log_ts,
|
||||
const bool is_request_leader,
|
||||
const bool is_need_force_register) override;
|
||||
int response_register_server(
|
||||
const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const bool is_assign_parent_succeed,
|
||||
const share::ObCascadMemberList &candidate_list,
|
||||
const int32_t msg_type) override;
|
||||
int request_replace_sick_child(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const common::ObAddr &sick_child) override;
|
||||
int reject_server(
|
||||
const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const int32_t msg_type) override;
|
||||
int notify_restore_log_finished(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const uint64_t log_id) override;
|
||||
int notify_reregister(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &key,
|
||||
const share::ObCascadMember &new_leader) override;
|
||||
int submit_prepare_rqst(
|
||||
const common::ObMemberList& mem_list, const common::ObPartitionKey& key, const common::ObProposalID proposal_id);
|
||||
const common::ObMemberList &mem_list,
|
||||
const common::ObPartitionKey &key,
|
||||
const common::ObProposalID proposal_id) override;
|
||||
int submit_standby_prepare_rqst(
|
||||
const common::ObMemberList& mem_list, const common::ObPartitionKey& key, const common::ObProposalID proposal_id);
|
||||
int broadcast_info(const common::ObMemberList& mem_list, const common::ObPartitionKey& key,
|
||||
const common::ObReplicaType& replica_type, const uint64_t max_confirmed_log_id);
|
||||
const common::ObMemberList &mem_list,
|
||||
const common::ObPartitionKey &key,
|
||||
const common::ObProposalID proposal_id) override;
|
||||
int broadcast_info(
|
||||
const common::ObMemberList &mem_list,
|
||||
const common::ObPartitionKey &key,
|
||||
const common::ObReplicaType &replica_type,
|
||||
const uint64_t max_confirmed_log_id) override;
|
||||
// confirmed_info msg is special that no need compare proposal_id
|
||||
int submit_confirmed_info(const share::ObCascadMemberList& mem_list, const common::ObPartitionKey& key,
|
||||
const uint64_t log_id, const ObConfirmedInfo& confirmed_info, const bool batch_committed);
|
||||
int submit_renew_ms_confirmed_info(const share::ObCascadMemberList& mem_list, const common::ObPartitionKey& key,
|
||||
const uint64_t log_id, const common::ObProposalID& ms_proposal_id, const ObConfirmedInfo& confirmed_info);
|
||||
int prepare_response(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& partition_key, const common::ObProposalID proposal_id, const uint64_t max_log_id,
|
||||
const int64_t max_log_ts);
|
||||
int standby_prepare_response(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& partition_key, const ObProposalID proposal_id, const uint64_t ms_log_id,
|
||||
const int64_t membership_version, const common::ObMemberList& member_list);
|
||||
int send_keepalive_msg(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& partition_key, const uint64_t next_log_id, const int64_t next_log_ts_lb,
|
||||
const uint64_t deliver_cnt);
|
||||
int send_restore_alive_msg(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& partition_key, const uint64_t start_log_id);
|
||||
int send_restore_alive_req(const common::ObAddr& server, const common::ObPartitionKey& partition_key);
|
||||
int send_restore_alive_resp(
|
||||
const common::ObAddr& server, const int64_t dst_cluster_id, const common::ObPartitionKey& partition_key);
|
||||
int notify_restore_leader_takeover(const common::ObAddr& server, const common::ObPartitionKey& key) override;
|
||||
int send_leader_max_log_msg(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& partition_key, const int64_t switchover_epoch, const uint64_t max_log_id,
|
||||
const int64_t next_log_ts);
|
||||
int send_sync_log_archive_progress_msg(const common::ObAddr& server, const int64_t cluster_id,
|
||||
const common::ObPartitionKey& partition_key, const ObPGLogArchiveStatus& status);
|
||||
virtual int notify_follower_log_missing(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& partition_key, const uint64_t start_log_id, const bool is_in_member_list,
|
||||
const int32_t msg_type);
|
||||
virtual void update_clog_info(const int64_t max_submit_timestamp);
|
||||
virtual void update_clog_info(
|
||||
const common::ObPartitionKey& partition_key, const uint64_t log_id, const int64_t submit_timestamp);
|
||||
int reset_clog_info_block();
|
||||
int get_clog_info_handler(const file_id_t file_id, ObCommitInfoBlockHandler& handler);
|
||||
int get_remote_membership_status(const common::ObAddr& server, const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey& partition_key, int64_t& timestamp, uint64_t& max_confirmed_log_id,
|
||||
bool& remote_replica_is_normal);
|
||||
int get_remote_mc_ctx_array(
|
||||
const common::ObAddr& server, const common::ObPartitionArray& partition_array, McCtxArray& mc_ctx_array);
|
||||
int submit_confirmed_info(
|
||||
const share::ObCascadMemberList &mem_list,
|
||||
const common::ObPartitionKey &key,
|
||||
const uint64_t log_id,
|
||||
const ObConfirmedInfo &confirmed_info,
|
||||
const bool batch_committed) override;
|
||||
int submit_renew_ms_confirmed_info(const share::ObCascadMemberList &mem_list,
|
||||
const common::ObPartitionKey &key,
|
||||
const uint64_t log_id,
|
||||
const common::ObProposalID &ms_proposal_id,
|
||||
const ObConfirmedInfo &confirmed_info) override;
|
||||
int prepare_response(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &partition_key,
|
||||
const common::ObProposalID proposal_id,
|
||||
const uint64_t max_log_id,
|
||||
const int64_t max_log_ts) override;
|
||||
int standby_prepare_response(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &partition_key,
|
||||
const ObProposalID proposal_id,
|
||||
const uint64_t ms_log_id,
|
||||
const int64_t membership_version,
|
||||
const common::ObMemberList &member_list) override;
|
||||
int send_keepalive_msg(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &partition_key,
|
||||
const uint64_t next_log_id,
|
||||
const int64_t next_log_ts_lb,
|
||||
const uint64_t deliver_cnt) override;
|
||||
int send_restore_alive_msg(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &partition_key,
|
||||
const uint64_t start_log_id) override;
|
||||
int send_restore_alive_req(const common::ObAddr &server,
|
||||
const common::ObPartitionKey &partition_key) override;
|
||||
int send_restore_alive_resp(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &partition_key) override;
|
||||
int notify_restore_leader_takeover(const common::ObAddr &server,
|
||||
const common::ObPartitionKey &key) override;
|
||||
int send_leader_max_log_msg(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &partition_key,
|
||||
const int64_t switchover_epoch,
|
||||
const uint64_t max_log_id,
|
||||
const int64_t next_log_ts) override;
|
||||
int send_sync_log_archive_progress_msg(const common::ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const common::ObPartitionKey &partition_key,
|
||||
const ObPGLogArchiveStatus &status) override;
|
||||
virtual int notify_follower_log_missing(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &partition_key,
|
||||
const uint64_t start_log_id,
|
||||
const bool is_in_member_list,
|
||||
const int32_t msg_type) override;
|
||||
virtual void update_clog_info(const int64_t max_submit_timestamp) override;
|
||||
virtual void update_clog_info(const common::ObPartitionKey &partition_key,
|
||||
const uint64_t log_id,
|
||||
const int64_t submit_timestamp) override;
|
||||
int reset_clog_info_block() override;
|
||||
int get_clog_info_handler(const file_id_t file_id,
|
||||
ObCommitInfoBlockHandler &handler) override;
|
||||
int get_remote_membership_status(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const common::ObPartitionKey &partition_key,
|
||||
int64_t ×tamp,
|
||||
uint64_t &max_confirmed_log_id,
|
||||
bool &remote_replica_is_normal) override;
|
||||
int get_remote_mc_ctx_array(const common::ObAddr &server,
|
||||
const common::ObPartitionArray &partition_array,
|
||||
McCtxArray &mc_ctx_array);
|
||||
int update_min_using_file_id();
|
||||
uint32_t get_clog_min_using_file_id() const;
|
||||
uint32_t get_clog_min_file_id() const;
|
||||
uint32_t get_clog_max_file_id() const;
|
||||
int64_t get_free_quota() const;
|
||||
bool is_disk_space_enough() const;
|
||||
uint32_t get_clog_min_using_file_id() const override;
|
||||
uint32_t get_clog_min_file_id() const override;
|
||||
uint32_t get_clog_max_file_id() const override;
|
||||
int64_t get_free_quota() const override;
|
||||
bool is_disk_space_enough() const override;
|
||||
void try_recycle_file();
|
||||
int get_need_freeze_partition_array(NeedFreezePartitionArray& partition_array) const;
|
||||
virtual int submit_batch_log(const common::ObMemberList& member_list, const transaction::ObTransID& trans_id,
|
||||
const common::ObPartitionArray& partition_array, const ObLogInfoArray& log_info_array);
|
||||
virtual int submit_batch_ack(
|
||||
const common::ObAddr& leader, const transaction::ObTransID& trans_id, const ObBatchAckArray& batch_ack_array);
|
||||
int get_remote_priority_array(const common::ObAddr& server, const common::ObPartitionIArray& partition_array,
|
||||
election::PriorityArray& priority_array) const;
|
||||
virtual int query_remote_log(const common::ObAddr& server, const common::ObPartitionKey& partition_key,
|
||||
const uint64_t log_id, transaction::ObTransID& trans_id, int64_t& submit_timestamp);
|
||||
int get_clog_file_id_range(file_id_t& min_file_id, file_id_t& max_file_id);
|
||||
int get_need_freeze_partition_array(NeedFreezePartitionArray &partition_array) const;
|
||||
virtual int submit_batch_log(const common::ObMemberList &member_list,
|
||||
const transaction::ObTransID &trans_id,
|
||||
const common::ObPartitionArray &partition_array,
|
||||
const ObLogInfoArray &log_info_array) override;
|
||||
virtual int submit_batch_ack(const common::ObAddr &leader,
|
||||
const transaction::ObTransID &trans_id,
|
||||
const ObBatchAckArray &batch_ack_array) override;
|
||||
int get_remote_priority_array(const common::ObAddr &server,
|
||||
const common::ObPartitionIArray &partition_array,
|
||||
election::PriorityArray &priority_array) const;
|
||||
virtual int query_remote_log(const common::ObAddr &server,
|
||||
const common::ObPartitionKey &partition_key,
|
||||
const uint64_t log_id,
|
||||
transaction::ObTransID &trans_id,
|
||||
int64_t &submit_timestamp) override;
|
||||
int get_clog_file_id_range(file_id_t &min_file_id, file_id_t &max_file_id) override;
|
||||
int delete_all_clog_files();
|
||||
// ================== interface for ObIlogStorage begin====================
|
||||
int get_cursor_batch(const common::ObPartitionKey& pkey, const uint64_t query_log_id, ObGetCursorResult& result);
|
||||
int get_cursor_batch(const common::ObPartitionKey& pkey, const uint64_t query_log_id, ObLogCursorExt& log_cursor,
|
||||
ObGetCursorResult& result, uint64_t& cursor_start_log_id);
|
||||
int get_cursor_batch_from_file(
|
||||
const common::ObPartitionKey& pkey, const uint64_t query_log_id, ObGetCursorResult& result);
|
||||
int get_cursor(const common::ObPartitionKey& pkey, const uint64_t query_log_id, ObLogCursorExt& log_cursor);
|
||||
int submit_cursor(const common::ObPartitionKey& pkey, const uint64_t log_id, const ObLogCursorExt& log_cursor_ext);
|
||||
int submit_cursor(const common::ObPartitionKey& partition_key, const uint64_t log_id,
|
||||
const ObLogCursorExt& log_cursor_ext, const common::ObMemberList& memberlist, const int64_t replica_num,
|
||||
const int64_t memberlist_version);
|
||||
int query_max_ilog_id(const common::ObPartitionKey& pkey, uint64_t& ret_max_ilog_id);
|
||||
int query_max_flushed_ilog_id(const common::ObPartitionKey& pkey, uint64_t& ret_max_ilog_id);
|
||||
int get_ilog_memstore_min_log_id_and_ts(
|
||||
const common::ObPartitionKey& pkey, uint64_t& min_log_id, int64_t& min_log_ts);
|
||||
int get_ilog_file_id_range(file_id_t& min_file_id, file_id_t& max_file_id);
|
||||
int query_next_ilog_file_id(file_id_t& next_ilog_file_id);
|
||||
int locate_by_timestamp(const common::ObPartitionKey& pkey, const int64_t start_ts, uint64_t& target_log_id,
|
||||
int64_t& target_log_timestamp);
|
||||
int locate_ilog_file_by_log_id(
|
||||
const common::ObPartitionKey& pkey, const uint64_t start_log_id, uint64_t& end_log_id, file_id_t& ilog_id);
|
||||
int fill_file_id_cache();
|
||||
int ensure_log_continuous_in_file_id_cache(const common::ObPartitionKey& partition_key, const uint64_t log_id);
|
||||
int get_index_info_block_map(const file_id_t file_id, IndexInfoBlockMap& index_info_block_map);
|
||||
int check_need_block_log(bool& is_need) const;
|
||||
int get_cursor_batch(const common::ObPartitionKey &pkey,
|
||||
const uint64_t query_log_id,
|
||||
ObGetCursorResult &result) override;
|
||||
int get_cursor_batch(const common::ObPartitionKey &pkey,
|
||||
const uint64_t query_log_id,
|
||||
ObLogCursorExt &log_cursor,
|
||||
ObGetCursorResult &result,
|
||||
uint64_t &cursor_start_log_id) override;
|
||||
int get_cursor_batch_from_file(const common::ObPartitionKey &pkey,
|
||||
const uint64_t query_log_id,
|
||||
ObGetCursorResult &result) override;
|
||||
int get_cursor(const common::ObPartitionKey &pkey,
|
||||
const uint64_t query_log_id,
|
||||
ObLogCursorExt &log_cursor) override;
|
||||
int submit_cursor(const common::ObPartitionKey &pkey,
|
||||
const uint64_t log_id,
|
||||
const ObLogCursorExt &log_cursor_ext) override;
|
||||
int submit_cursor(const common::ObPartitionKey &partition_key,
|
||||
const uint64_t log_id,
|
||||
const ObLogCursorExt &log_cursor_ext,
|
||||
const common::ObMemberList &memberlist,
|
||||
const int64_t replica_num,
|
||||
const int64_t memberlist_version) override;
|
||||
int query_max_ilog_id(const common::ObPartitionKey &pkey,
|
||||
uint64_t &ret_max_ilog_id) override;
|
||||
int query_max_flushed_ilog_id(const common::ObPartitionKey &pkey,
|
||||
uint64_t &ret_max_ilog_id) override;
|
||||
int get_ilog_memstore_min_log_id_and_ts(const common::ObPartitionKey &pkey,
|
||||
uint64_t &min_log_id,
|
||||
int64_t &min_log_ts) override;
|
||||
int get_ilog_file_id_range(file_id_t &min_file_id, file_id_t &max_file_id) override;
|
||||
int query_next_ilog_file_id(file_id_t &next_ilog_file_id) override;
|
||||
int locate_by_timestamp(const common::ObPartitionKey &pkey,
|
||||
const int64_t start_ts,
|
||||
uint64_t &target_log_id,
|
||||
int64_t &target_log_timestamp) override;
|
||||
int locate_ilog_file_by_log_id(const common::ObPartitionKey &pkey,
|
||||
const uint64_t start_log_id,
|
||||
uint64_t &end_log_id,
|
||||
file_id_t &ilog_id) override;
|
||||
int fill_file_id_cache() override;
|
||||
int ensure_log_continuous_in_file_id_cache(const common::ObPartitionKey &partition_key,
|
||||
const uint64_t log_id) override;
|
||||
int get_index_info_block_map(const file_id_t file_id,
|
||||
IndexInfoBlockMap &index_info_block_map) override;
|
||||
int check_need_block_log(bool &is_need) const override;
|
||||
int delete_all_ilog_files();
|
||||
ObLogCache* get_ilog_log_cache()
|
||||
{
|
||||
return is_inited_ ? &ilog_log_cache_ : NULL;
|
||||
}
|
||||
ObLogCache *get_ilog_log_cache() override {return is_inited_ ? &ilog_log_cache_ : NULL;}
|
||||
|
||||
int check_is_clog_obsoleted(const common::ObPartitionKey& partition_key, const file_id_t file_id,
|
||||
const offset_t offset, bool& is_obsoleted) const;
|
||||
int check_is_clog_obsoleted(const common::ObPartitionKey &partition_key,
|
||||
const file_id_t file_id,
|
||||
const offset_t offset,
|
||||
bool &is_obsoleted) const override;
|
||||
// ================== interface for ObIlogStorage end ====================
|
||||
int get_clog_using_disk_space(int64_t& space) const;
|
||||
int get_ilog_using_disk_space(int64_t& space) const;
|
||||
bool is_clog_disk_error() const;
|
||||
|
||||
private:
|
||||
bool is_clog_disk_error() const override;
|
||||
private:
|
||||
int fetch_log_from_server(
|
||||
const common::ObAddr& server, const common::ObPartitionKey& key, const uint64_t start_id, const uint64_t end_id);
|
||||
template <typename Req>
|
||||
|
@ -98,71 +98,92 @@ class ObLogMembershipMgr : public ObILogMembershipMgr, public ObISubmitLogCb {
|
||||
public:
|
||||
// When creating Partition,membership_timestamp is 0,membership_log_id is 0
|
||||
// When observer is restarted, the value is obtained from BaseStorageInfo
|
||||
int init(const common::ObMemberList& member_list, const int64_t membership_timestamp,
|
||||
const uint64_t membership_log_id, const common::ObProposalID& ms_proposal_id,
|
||||
const common::ObReplicaType replica_type, const common::ObReplicaProperty replica_property,
|
||||
const int64_t replica_num, const bool need_skip_mlist_check, const common::ObAddr& self,
|
||||
const common::ObPartitionKey& partition_key, ObILogSWForMS* sw, ObLogMembershipTaskMgr* ms_task_mgr,
|
||||
ObILogStateMgrForMS* state_mgr, ObLogCascadingMgr* cascading_mgr, ObILogCallbackEngine* cb_engine,
|
||||
storage::ObPartitionService* partition_service, common::ObILogAllocator* alloc_mgr);
|
||||
virtual bool is_state_changed();
|
||||
virtual int switch_state();
|
||||
virtual int add_member(const common::ObMember& member, const int64_t quorum, obrpc::ObMCLogInfo& log_info);
|
||||
virtual int remove_member(const common::ObMember& member, const int64_t quorum, obrpc::ObMCLogInfo& log_info);
|
||||
virtual int change_quorum(const common::ObMemberList& curr_member_list, const int64_t curr_quorum,
|
||||
const int64_t new_quorum, obrpc::ObMCLogInfo& log_info);
|
||||
virtual int64_t get_replica_num() const;
|
||||
virtual common::ObReplicaType get_replica_type() const;
|
||||
int init(const common::ObMemberList &member_list,
|
||||
const int64_t membership_timestamp,
|
||||
const uint64_t membership_log_id,
|
||||
const common::ObProposalID &ms_proposal_id,
|
||||
const common::ObReplicaType replica_type,
|
||||
const common::ObReplicaProperty replica_property,
|
||||
const int64_t replica_num,
|
||||
const bool need_skip_mlist_check,
|
||||
const common::ObAddr &self,
|
||||
const common::ObPartitionKey &partition_key,
|
||||
ObILogSWForMS *sw,
|
||||
ObLogMembershipTaskMgr *ms_task_mgr,
|
||||
ObILogStateMgrForMS *state_mgr,
|
||||
ObLogCascadingMgr *cascading_mgr,
|
||||
ObILogCallbackEngine *cb_engine,
|
||||
storage::ObPartitionService *partition_service,
|
||||
common::ObILogAllocator *alloc_mgr);
|
||||
virtual bool is_state_changed() override;
|
||||
virtual int switch_state() override;
|
||||
virtual int add_member(const common::ObMember &member, const int64_t quorum, obrpc::ObMCLogInfo &log_info) override;
|
||||
virtual int remove_member(const common::ObMember &member, const int64_t quorum, obrpc::ObMCLogInfo &log_info) override;
|
||||
virtual int change_quorum(const common::ObMemberList &curr_member_list,
|
||||
const int64_t curr_quorum,
|
||||
const int64_t new_quorum,
|
||||
obrpc::ObMCLogInfo &log_info) override;
|
||||
virtual int64_t get_replica_num() const override;
|
||||
virtual common::ObReplicaType get_replica_type() const override;
|
||||
virtual common::ObReplicaProperty get_replica_property() const override;
|
||||
virtual const common::ObMemberList& get_curr_member_list() const;
|
||||
virtual int receive_log(const ObLogEntry& log_entry, const common::ObAddr& server, const int64_t cluster_id,
|
||||
const ReceiveLogType rl_type);
|
||||
virtual int receive_recovery_log(const ObLogEntry& log_entry, const bool is_confirmed, const int64_t accum_checksum,
|
||||
const bool is_batch_committed);
|
||||
virtual int append_disk_log(const ObLogEntry& log_entry, const ObLogCursor& log_cursor, const int64_t accum_checksum,
|
||||
const bool batch_committed);
|
||||
virtual int force_set_member_list(const common::ObMemberList& member_list, const int64_t replica_num);
|
||||
virtual int set_membership_info(const common::ObMemberList& member_list, const int64_t membership_timestamp,
|
||||
const uint64_t membership_log_id, const int64_t replica_num, const common::ObProposalID& ms_proposal_id);
|
||||
virtual int64_t get_timestamp() const;
|
||||
virtual uint64_t get_log_id() const
|
||||
{
|
||||
return membership_log_id_;
|
||||
}
|
||||
virtual void reset_status();
|
||||
virtual int write_start_membership(const ObLogType& log_type);
|
||||
virtual int on_success(const common::ObPartitionKey& partition_key, const clog::ObLogType log_type,
|
||||
const uint64_t log_id, const int64_t version, const bool batch_committed, const bool batch_last_succeed);
|
||||
bool is_inited() const
|
||||
{
|
||||
return is_inited_;
|
||||
}
|
||||
virtual bool is_state_init() const;
|
||||
virtual void reset_follower_pending_entry();
|
||||
virtual void submit_success_cb_task(const ObLogType& log_type, const uint64_t log_id, const char* log_buf,
|
||||
const int64_t log_buf_len, const common::ObProposalID& proposal_id);
|
||||
virtual void reconfirm_update_status(const ObLogEntry& log_entry);
|
||||
virtual int force_set_as_single_replica();
|
||||
virtual int force_set_replica_num(const int64_t replica_num);
|
||||
virtual const common::ObMemberList &get_curr_member_list() const override;
|
||||
virtual int receive_log(const ObLogEntry &log_entry,
|
||||
const common::ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const ReceiveLogType rl_type) override;
|
||||
virtual int receive_recovery_log(const ObLogEntry &log_entry,
|
||||
const bool is_confirmed,
|
||||
const int64_t accum_checksum,
|
||||
const bool is_batch_committed) override;
|
||||
virtual int append_disk_log(const ObLogEntry &log_entry,
|
||||
const ObLogCursor &log_cursor,
|
||||
const int64_t accum_checksum,
|
||||
const bool batch_committed) override;
|
||||
virtual int force_set_member_list(const common::ObMemberList &member_list,
|
||||
const int64_t replica_num);
|
||||
virtual int set_membership_info(const common::ObMemberList &member_list,
|
||||
const int64_t membership_timestamp,
|
||||
const uint64_t membership_log_id,
|
||||
const int64_t replica_num,
|
||||
const common::ObProposalID &ms_proposal_id);
|
||||
virtual int64_t get_timestamp() const override;
|
||||
virtual uint64_t get_log_id() const override { return membership_log_id_; }
|
||||
virtual void reset_status() override;
|
||||
virtual int write_start_membership(const ObLogType &log_type) override;
|
||||
virtual int on_success(const common::ObPartitionKey &partition_key,
|
||||
const clog::ObLogType log_type,
|
||||
const uint64_t log_id,
|
||||
const int64_t version,
|
||||
const bool batch_committed,
|
||||
const bool batch_last_succeed) override;
|
||||
bool is_inited() const { return is_inited_; }
|
||||
virtual bool is_state_init() const override;
|
||||
virtual void reset_follower_pending_entry() override;
|
||||
virtual void submit_success_cb_task(const ObLogType &log_type,
|
||||
const uint64_t log_id,
|
||||
const char *log_buf,
|
||||
const int64_t log_buf_len,
|
||||
const common::ObProposalID &proposal_id) override;
|
||||
virtual void reconfirm_update_status(const ObLogEntry &log_entry) override;
|
||||
virtual int force_set_as_single_replica() override;
|
||||
virtual int force_set_replica_num(const int64_t replica_num) override;
|
||||
// Only keep members existing in server_list in member_list
|
||||
// Used to force a member list
|
||||
virtual int force_set_server_list(const obrpc::ObServerList& server_list, const int64_t replica_num);
|
||||
void destroy();
|
||||
virtual int set_replica_type(const enum ObReplicaType replica_type);
|
||||
virtual int set_replica_type(const enum ObReplicaType replica_type) override;
|
||||
virtual int change_member_list_to_self(const int64_t new_membership_version) override;
|
||||
common::ObProposalID get_ms_proposal_id() const override
|
||||
common::ObProposalID get_ms_proposal_id() const override { return ms_proposal_id_; }
|
||||
int update_ms_proposal_id(const common::ObProposalID &ms_proposal_id) override;
|
||||
int check_follower_has_pending_entry(bool &has_pending);
|
||||
int get_curr_ms_log_body(ObLogEntryHeader &log_entry_header,
|
||||
char *buffer, const int64_t buf_len) const override;
|
||||
int reset_renew_ms_log_task() override;
|
||||
bool is_renew_ms_log_majority_success() const override;
|
||||
int check_renew_ms_log_sync_state() const override;
|
||||
private:
|
||||
enum ObMsState
|
||||
{
|
||||
return ms_proposal_id_;
|
||||
}
|
||||
int update_ms_proposal_id(const common::ObProposalID& ms_proposal_id) override;
|
||||
int check_follower_has_pending_entry(bool& has_pending);
|
||||
int get_curr_ms_log_body(ObLogEntryHeader& log_entry_header, char* buffer, const int64_t buf_len) const;
|
||||
int reset_renew_ms_log_task();
|
||||
bool is_renew_ms_log_majority_success() const;
|
||||
int check_renew_ms_log_sync_state() const;
|
||||
|
||||
private:
|
||||
enum ObMsState {
|
||||
MS_INIT,
|
||||
MS_PENDING,
|
||||
MS_CHANGING,
|
||||
|
@ -378,40 +378,59 @@ class ObLogSlidingWindow : public ObILogSWForCasMgr,
|
||||
void set_next_replay_log_id_info(const uint64_t log_id, const int64_t log_ts);
|
||||
void try_update_next_replay_log_info(const uint64_t log_id, const int64_t log_ts, const bool is_nop_log = false);
|
||||
void try_update_next_replay_log_info_on_leader(const int64_t log_ts);
|
||||
uint64_t get_start_id() const;
|
||||
void get_max_log_id_info(uint64_t& max_log_id, int64_t& max_log_ts) const;
|
||||
uint64_t get_max_log_id() const;
|
||||
int get_switchover_info(int64_t& switchover_epoch, uint64_t& leader_max_log_id, int64_t& leader_next_log_ts) const;
|
||||
uint64_t get_start_id() const override;
|
||||
void get_max_log_id_info(uint64_t &max_log_id,
|
||||
int64_t &max_log_ts) const;
|
||||
uint64_t get_max_log_id() const override;
|
||||
int get_switchover_info(int64_t &switchover_epoch, uint64_t &leader_max_log_id, int64_t &leader_next_log_ts) const;
|
||||
uint64_t get_max_timestamp() const;
|
||||
int64_t get_epoch_id() const;
|
||||
int try_update_max_log_id(const uint64_t log_id);
|
||||
int submit_log(const ObLogType& log_type, const char* buff, const int64_t size, const int64_t base_timestamp,
|
||||
const bool is_trans_log, ObISubmitLogCb* cb, uint64_t& log_id, int64_t& log_timestamp);
|
||||
int submit_aggre_log(ObAggreBuffer* buffer, const int64_t base_timestamp);
|
||||
int submit_log(const ObLogEntryHeader& header, const char* buff, ObISubmitLogCb* cb);
|
||||
int append_disk_log(
|
||||
const ObLogEntry& log, const ObLogCursor& log_cursor, const int64_t accum_checksum, const bool batch_committed);
|
||||
int receive_log(
|
||||
const ObLogEntry& log_entry, const common::ObAddr& server, const int64_t cluster_id, const ReceiveLogType type);
|
||||
int receive_recovery_log(
|
||||
const ObLogEntry& log_entry, const bool is_confirmed, const int64_t accum_checksum, const bool is_batch_commited);
|
||||
int ack_log(const uint64_t log_id, const common::ObAddr& server, bool& majority);
|
||||
int standby_ack_log(const uint64_t log_id, const ObAddr& server, bool& majority);
|
||||
int fake_ack_log(const uint64_t log_id, const common::ObAddr& server, const int64_t receive_ts);
|
||||
bool is_fake_info_need_revoke(const uint64_t log_id, const int64_t current_time);
|
||||
int restore_leader_try_confirm_log();
|
||||
void start_fetch_log_from_leader(bool& is_fetched) override;
|
||||
int get_log_task(const uint64_t log_id, ObLogTask*& log_task, const int64_t*& ref) const;
|
||||
int check_left_bound_empty(bool& is_empty);
|
||||
int revert_log_task(const int64_t* ref);
|
||||
int get_log(const uint64_t log_id, const uint32_t log_attr, bool& log_confirmed, ObLogCursor& cursor,
|
||||
int64_t& accum_checksum, bool& batch_committed);
|
||||
int clean_log();
|
||||
int64_t get_epoch_id() const override;
|
||||
int try_update_max_log_id(const uint64_t log_id) override;
|
||||
int submit_log(const ObLogType &log_type,
|
||||
const char *buff,
|
||||
const int64_t size,
|
||||
const int64_t base_timestamp,
|
||||
const bool is_trans_log,
|
||||
ObISubmitLogCb *cb,
|
||||
uint64_t &log_id,
|
||||
int64_t &log_timestamp) override;
|
||||
int submit_aggre_log(ObAggreBuffer *buffer,
|
||||
const int64_t base_timestamp);
|
||||
int submit_log(const ObLogEntryHeader &header, const char *buff,
|
||||
ObISubmitLogCb *cb) override;
|
||||
int append_disk_log(const ObLogEntry &log, const ObLogCursor &log_cursor,
|
||||
const int64_t accum_checksum,
|
||||
const bool batch_committed) override;
|
||||
int receive_log(const ObLogEntry &log_entry, const common::ObAddr &server,
|
||||
const int64_t cluster_id, const ReceiveLogType type) override;
|
||||
int receive_recovery_log(const ObLogEntry &log_entry,
|
||||
const bool is_confirmed,
|
||||
const int64_t accum_checksum,
|
||||
const bool is_batch_commited) override;
|
||||
int ack_log(const uint64_t log_id, const common::ObAddr &server, bool &majority);
|
||||
int standby_ack_log(const uint64_t log_id, const ObAddr &server, bool &majority);
|
||||
int fake_ack_log(const uint64_t log_id, const common::ObAddr &server, const int64_t receive_ts);
|
||||
bool is_fake_info_need_revoke(const uint64_t log_id, const int64_t current_time) override;
|
||||
int restore_leader_try_confirm_log() override;
|
||||
void start_fetch_log_from_leader(bool &is_fetched) override;
|
||||
int get_log_task(const uint64_t log_id, ObLogTask *&log_task, const int64_t *&ref) const override;
|
||||
int check_left_bound_empty(bool &is_empty);
|
||||
int revert_log_task(const int64_t *ref) override;
|
||||
int get_log(const uint64_t log_id,
|
||||
const uint32_t log_attr,
|
||||
bool &log_confirmed,
|
||||
ObLogCursor &cursor,
|
||||
int64_t &accum_checksum,
|
||||
bool &batch_committed);
|
||||
int clean_log() override;
|
||||
int process_sync_standby_max_confirmed_id(const uint64_t standby_max_confirmed_id, const uint64_t reconfirm_next_id);
|
||||
int set_log_flushed_succ(const uint64_t log_id, const common::ObProposalID proposal_id, const ObLogCursor& log_cursor,
|
||||
const int64_t after_consume_timestamp, bool& majority);
|
||||
int set_log_confirmed(const uint64_t log_id, const bool batch_committed);
|
||||
int receive_confirmed_info(const uint64_t log_id, const ObConfirmedInfo& confirmed_info, const bool batch_committed);
|
||||
int set_log_flushed_succ(const uint64_t log_id, const common::ObProposalID proposal_id,
|
||||
const ObLogCursor &log_cursor,
|
||||
const int64_t after_consume_timestamp,
|
||||
bool &majority);
|
||||
int set_log_confirmed(const uint64_t log_id, const bool batch_committed) override;
|
||||
int receive_confirmed_info(const uint64_t log_id, const ObConfirmedInfo &confirmed_info,
|
||||
const bool batch_committed);
|
||||
int majority_cb(const uint64_t log_id, const bool batch_committed, const bool batch_first_participant);
|
||||
inline void advance_leader_ts(const int64_t ts)
|
||||
{
|
||||
@ -420,43 +439,31 @@ class ObLogSlidingWindow : public ObILogSWForCasMgr,
|
||||
ATOMIC_STORE(&leader_ts_, ts);
|
||||
}
|
||||
}
|
||||
int sliding_cb(const int64_t sn, const ObILogExtRingBufferData* data);
|
||||
uint64_t get_next_index_log_id() const
|
||||
{
|
||||
return ATOMIC_LOAD(&next_index_log_id_);
|
||||
}
|
||||
int64_t get_next_index_log_ts()
|
||||
{
|
||||
return ATOMIC_LOAD(&next_index_log_ts_);
|
||||
}
|
||||
int submit_replay_task(const bool need_async, bool& is_replayed, bool& is_replay_failed);
|
||||
int sliding_cb(const int64_t sn, const ObILogExtRingBufferData *data) override;
|
||||
uint64_t get_next_index_log_id() const override { return ATOMIC_LOAD(&next_index_log_id_); }
|
||||
int64_t get_next_index_log_ts() override { return ATOMIC_LOAD(&next_index_log_ts_); }
|
||||
int submit_replay_task(const bool need_async, bool &is_replayed, bool &is_replay_failed) override;
|
||||
void destroy();
|
||||
int alloc_log_id(const int64_t base_timestamp, uint64_t& log_id, int64_t& submit_timestamp);
|
||||
int get_next_timestamp(const uint64_t last_log_id, int64_t& res_ts);
|
||||
int get_next_served_log_info_by_next_replay_log_info(uint64_t& next_served_log_id, int64_t& next_served_log_ts);
|
||||
bool is_inited() const
|
||||
{
|
||||
return is_inited_;
|
||||
}
|
||||
bool is_empty() const;
|
||||
int alloc_log_id(const int64_t base_timestamp, uint64_t &log_id, int64_t &submit_timestamp) override;
|
||||
int get_next_timestamp(const uint64_t last_log_id, int64_t &res_ts);
|
||||
int get_next_served_log_info_by_next_replay_log_info(uint64_t &next_served_log_id,
|
||||
int64_t &next_served_log_ts);
|
||||
bool is_inited() const { return is_inited_; }
|
||||
bool is_empty() const override;
|
||||
int set_next_index_log_id(const uint64_t log_id, const int64_t accum_checksum);
|
||||
uint64_t get_max_confirmed_log_id() const;
|
||||
uint64_t get_max_confirmed_log_id() const override;
|
||||
bool check_can_receive_larger_log(const uint64_t log_id);
|
||||
int truncate_first_stage(const common::ObBaseStorageInfo& base_storage_info);
|
||||
int truncate_second_stage(const common::ObBaseStorageInfo& base_storage_info);
|
||||
int64_t get_last_submit_timestamp() const
|
||||
{
|
||||
return last_replay_log_.get_ts();
|
||||
}
|
||||
void get_last_replay_log(uint64_t& log_id, int64_t& ts)
|
||||
{
|
||||
last_replay_log_.get(log_id, ts);
|
||||
}
|
||||
int get_next_replay_log_timestamp(int64_t& next_replay_log_timestamp) const;
|
||||
void get_next_replay_log_id_info(uint64_t& next_log_id, int64_t& next_log_ts) const;
|
||||
int follower_update_leader_next_log_info(const uint64_t leader_next_log_id, const int64_t leader_next_log_ts);
|
||||
int follower_update_leader_max_log_info(
|
||||
const int64_t switchover_epoch, const uint64_t leader_max_log_id, const int64_t leader_next_log_ts);
|
||||
int truncate_first_stage(const common::ObBaseStorageInfo &base_storage_info);
|
||||
int truncate_second_stage(const common::ObBaseStorageInfo &base_storage_info);
|
||||
int64_t get_last_submit_timestamp() const override { return last_replay_log_.get_ts(); }
|
||||
void get_last_replay_log(uint64_t &log_id, int64_t &ts) { last_replay_log_.get(log_id, ts); }
|
||||
int get_next_replay_log_timestamp(int64_t &next_replay_log_timestamp) const override;
|
||||
void get_next_replay_log_id_info(uint64_t &next_log_id, int64_t &next_log_ts) const override;
|
||||
int follower_update_leader_next_log_info(const uint64_t leader_next_log_id,
|
||||
const int64_t leader_next_log_ts);
|
||||
int follower_update_leader_max_log_info(const int64_t switchover_epoch,
|
||||
const uint64_t leader_max_log_id,
|
||||
const int64_t leader_next_log_ts);
|
||||
void set_last_replay_log(const uint64_t last_replay_log_id, const int64_t last_submit_timestamp)
|
||||
{
|
||||
last_replay_log_.set(last_replay_log_id, last_submit_timestamp);
|
||||
@ -495,9 +502,9 @@ class ObLogSlidingWindow : public ObILogSWForCasMgr,
|
||||
ATOMIC_STORE(&has_pop_task_, false);
|
||||
return common::OB_SUCCESS;
|
||||
}
|
||||
int leader_active();
|
||||
int leader_takeover();
|
||||
int leader_revoke();
|
||||
int leader_active() override;
|
||||
int leader_takeover() override;
|
||||
int leader_revoke() override;
|
||||
int get_replica_replay_type(ObReplicaReplayType &replay_type) const;
|
||||
//is_meta_log: log type that need been replayed by D replica and log replica
|
||||
int get_log_meta_info(uint64_t log_id,
|
||||
@ -552,11 +559,17 @@ class ObLogSlidingWindow : public ObILogSWForCasMgr,
|
||||
const int64_t submit_timestamp, ObISubmitLogCb* cb);
|
||||
int try_freeze_aggre_buffer_(const uint64_t log_id);
|
||||
int submit_freeze_aggre_buffer_task_(const uint64_t log_id);
|
||||
int submit_aggre_log_(ObAggreBuffer* buffer, const uint64_t log_id, const int64_t submit_timestamp);
|
||||
int try_update_submit_timestamp(const int64_t base_ts);
|
||||
bool is_confirm_match_(const uint64_t log_id, const int64_t log_data_checksum, const int64_t log_epoch_id,
|
||||
const int64_t confirmed_info_data_checksum, const int64_t confirmed_info_epoch_id);
|
||||
int receive_log_(const ObLogEntry& log_entry, const common::ObAddr& server, const int64_t cluster_id);
|
||||
int submit_aggre_log_(ObAggreBuffer *buffer,
|
||||
const uint64_t log_id,
|
||||
const int64_t submit_timestamp);
|
||||
int try_update_submit_timestamp(const int64_t base_ts) override;
|
||||
bool is_confirm_match_(const uint64_t log_id,
|
||||
const int64_t log_data_checksum,
|
||||
const int64_t log_epoch_id,
|
||||
const int64_t confirmed_info_data_checksum,
|
||||
const int64_t confirmed_info_epoch_id);
|
||||
int receive_log_(const ObLogEntry &log_entry, const common::ObAddr &server,
|
||||
const int64_t cluster_id);
|
||||
void update_max_log_id_(const uint64_t log_id);
|
||||
int submit_to_sliding_window_(const ObLogEntryHeader& header, const char* buff, ObISubmitLogCb* cb,
|
||||
const bool need_replay, const bool send_slave, const common::ObAddr& server, const int64_t cluster_id,
|
||||
|
@ -272,261 +272,177 @@ class ObLogStateMgr : public ObILogStateMgrForService,
|
||||
|
||||
public:
|
||||
ObLogStateMgr();
|
||||
virtual ~ObLogStateMgr()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
|
||||
public:
|
||||
int init(ObILogSWForStateMgr* sw, ObILogReconfirm* reconfirm, ObILogEngine* log_engine, ObILogMembershipMgr* mm,
|
||||
ObLogCascadingMgr* cascading_mgr, ObLogRestoreMgr* restore_mgr, election::ObIElection* election,
|
||||
ObLogReplayEngineWrapper* replay_engine, storage::ObPartitionService* partition_service,
|
||||
common::ObILogAllocator* alloc_mgr, const common::ObAddr& self, const common::ObProposalID& proposal_id,
|
||||
const common::ObVersion& freeze_version, const common::ObPartitionKey& partition_key,
|
||||
const ObCreatePlsType& create_pls_type);
|
||||
virtual bool can_submit_log() const
|
||||
virtual ~ObLogStateMgr() { destroy(); }
|
||||
public:
|
||||
int init(ObILogSWForStateMgr *sw,
|
||||
ObILogReconfirm *reconfirm,
|
||||
ObILogEngine *log_engine,
|
||||
ObILogMembershipMgr *mm,
|
||||
ObLogCascadingMgr *cascading_mgr,
|
||||
ObLogRestoreMgr *restore_mgr,
|
||||
election::ObIElection *election,
|
||||
ObLogReplayEngineWrapper *replay_engine,
|
||||
storage::ObPartitionService *partition_service,
|
||||
common::ObILogAllocator *alloc_mgr,
|
||||
const common::ObAddr &self,
|
||||
const common::ObProposalID &proposal_id,
|
||||
const common::ObVersion &freeze_version,
|
||||
const common::ObPartitionKey &partition_key,
|
||||
const ObCreatePlsType &create_pls_type);
|
||||
virtual bool can_submit_log() const override
|
||||
{
|
||||
bool bool_ret = (is_leader_active_() && !is_offline() &&
|
||||
share::ObMultiClusterUtil::is_cluster_allow_submit_log(partition_key_.get_table_id()));
|
||||
return bool_ret;
|
||||
}
|
||||
virtual bool can_submit_with_assigned_id() const
|
||||
virtual bool can_submit_with_assigned_id() const override
|
||||
{
|
||||
bool bool_ret = (is_leader_active_() || is_standby_leader_active_()) && !is_offline();
|
||||
return bool_ret;
|
||||
}
|
||||
virtual bool can_submit_start_working_log() const;
|
||||
virtual bool is_cluster_allow_handle_prepare() const;
|
||||
virtual bool can_submit_start_working_log() const override;
|
||||
virtual bool is_cluster_allow_handle_prepare() const override;
|
||||
virtual bool is_switching_cluster_replica(const uint64_t table_id) const
|
||||
{
|
||||
return (GCTX.is_in_standby_switching_state() && !share::ObMultiClusterUtil::is_cluster_private_table(table_id));
|
||||
}
|
||||
virtual bool can_append_disk_log() const;
|
||||
virtual bool can_receive_recovery_log() const;
|
||||
virtual bool can_majority_cb(const common::ObProposalID& proposal_id) const;
|
||||
virtual bool can_standby_majority_cb(const common::ObProposalID& proposal_id) const;
|
||||
virtual bool can_majority_cb_for_renew_ms_log(const common::ObProposalID& ms_proposal_id) const override;
|
||||
virtual bool can_receive_log_ack(const common::ObProposalID& proposal_id) const;
|
||||
virtual bool can_send_log_ack(const common::ObProposalID& proposal_id) const;
|
||||
virtual bool can_send_standby_log_ack(const common::ObProposalID& proposal_id) const;
|
||||
virtual bool can_receive_max_log_id(const common::ObProposalID& proposal_id) const;
|
||||
virtual bool can_receive_renew_ms_log_ack(const common::ObProposalID& ms_proposal_id) const override;
|
||||
virtual bool can_send_renew_ms_log_ack(const common::ObProposalID& proposal_id) const override;
|
||||
virtual bool can_handle_standby_prepare_resp(const common::ObProposalID& proposal_id) const;
|
||||
virtual bool can_append_disk_log() const override;
|
||||
virtual bool can_receive_recovery_log() const override;
|
||||
virtual bool can_majority_cb(const common::ObProposalID &proposal_id) const override;
|
||||
virtual bool can_standby_majority_cb(const common::ObProposalID &proposal_id) const override;
|
||||
virtual bool can_majority_cb_for_renew_ms_log(const common::ObProposalID &ms_proposal_id) const override;
|
||||
virtual bool can_receive_log_ack(const common::ObProposalID &proposal_id) const override;
|
||||
virtual bool can_send_log_ack(const common::ObProposalID &proposal_id) const override;
|
||||
virtual bool can_send_standby_log_ack(const common::ObProposalID &proposal_id) const override;
|
||||
virtual bool can_receive_max_log_id(const common::ObProposalID &proposal_id) const override;
|
||||
virtual bool can_receive_renew_ms_log_ack(const common::ObProposalID &ms_proposal_id) const override;
|
||||
virtual bool can_send_renew_ms_log_ack(const common::ObProposalID &proposal_id) const override;
|
||||
virtual bool can_handle_standby_prepare_resp(const common::ObProposalID &proposal_id) const override;
|
||||
bool is_diff_cluster_req_in_disabled_state(const int64_t cluster_id) const;
|
||||
virtual bool can_get_log(const int64_t cluster_id) const;
|
||||
virtual bool can_get_log_for_reconfirm(const common::ObProposalID& proposal_id) const;
|
||||
virtual bool can_receive_log(const common::ObProposalID& proposal_id, const common::ObProposalID& proposal_id_in_log,
|
||||
const int64_t cluster_id) const;
|
||||
virtual bool can_receive_renew_ms_log(const common::ObProposalID& proposal_id_in_req,
|
||||
const common::ObProposalID& proposal_id_in_log, const int64_t cluster_id) const;
|
||||
virtual bool can_change_member() const;
|
||||
virtual bool can_change_leader() const;
|
||||
virtual bool can_get_leader_curr_member_list() const;
|
||||
virtual bool can_handle_prepare_rqst(const common::ObProposalID& proposal_id, const int64_t cluster_id) const;
|
||||
virtual bool can_handle_standby_prepare_rqst(const common::ObProposalID& proposal_id, const int64_t cluster_id) const;
|
||||
virtual bool can_slide_sw() const;
|
||||
virtual bool is_standby_leader_can_receive_log_id(const uint32_t log_id) const;
|
||||
virtual bool can_receive_confirmed_info(const int64_t src_cluster_id) const;
|
||||
virtual bool can_receive_renew_ms_log_confirmed_info() const;
|
||||
virtual bool can_get_log(const int64_t cluster_id) const override;
|
||||
virtual bool can_get_log_for_reconfirm(const common::ObProposalID &proposal_id) const override;
|
||||
virtual bool can_receive_log(const common::ObProposalID &proposal_id,
|
||||
const common::ObProposalID &proposal_id_in_log,
|
||||
const int64_t cluster_id) const override;
|
||||
virtual bool can_receive_renew_ms_log(const common::ObProposalID &proposal_id_in_req,
|
||||
const common::ObProposalID &proposal_id_in_log,
|
||||
const int64_t cluster_id) const override;
|
||||
virtual bool can_change_member() const override;
|
||||
virtual bool can_change_leader() const override;
|
||||
virtual bool can_get_leader_curr_member_list() const override;
|
||||
virtual bool can_handle_prepare_rqst(const common::ObProposalID &proposal_id, const int64_t cluster_id) const override;
|
||||
virtual bool can_handle_standby_prepare_rqst(const common::ObProposalID &proposal_id, const int64_t cluster_id) const override;
|
||||
virtual bool can_slide_sw() const override;
|
||||
virtual bool is_standby_leader_can_receive_log_id(const uint32_t log_id) const override;
|
||||
virtual bool can_receive_confirmed_info(const int64_t src_cluster_id) const override;
|
||||
virtual bool can_receive_renew_ms_log_confirmed_info() const override;
|
||||
virtual bool can_set_offline() const;
|
||||
virtual bool can_set_replica_type() const;
|
||||
bool can_backfill_log(const bool is_leader, const common::ObProposalID& proposal_id) const;
|
||||
bool can_backfill_confirmed(const common::ObProposalID& proposal_id) const;
|
||||
|
||||
virtual common::ObProposalID get_proposal_id() const
|
||||
{
|
||||
return curr_proposal_id_;
|
||||
}
|
||||
virtual int switch_state(bool& need_retry);
|
||||
virtual bool check_sliding_window_state();
|
||||
virtual bool is_state_changed(bool& need_retry);
|
||||
virtual int set_scan_disk_log_finished();
|
||||
virtual bool is_scan_disk_log_finished() const
|
||||
{
|
||||
return scan_disk_log_finished_;
|
||||
}
|
||||
virtual int16_t get_state() const
|
||||
{
|
||||
return state_;
|
||||
}
|
||||
virtual common::ObRole get_role() const
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
virtual common::ObAddr get_leader() const
|
||||
{
|
||||
return leader_.get_server();
|
||||
}
|
||||
virtual share::ObCascadMember get_leader_member() const
|
||||
{
|
||||
return leader_;
|
||||
}
|
||||
virtual common::ObAddr get_primary_leader_addr() const
|
||||
{
|
||||
return primary_leader_.get_server();
|
||||
}
|
||||
virtual share::ObCascadMember get_primary_leader() const
|
||||
{
|
||||
return primary_leader_;
|
||||
}
|
||||
virtual share::ObCascadMember get_prepared_primary_leader() const
|
||||
{
|
||||
return prepared_primary_leader_;
|
||||
}
|
||||
virtual int get_cascad_leader(share::ObCascadMember& cascad_leader_member) const;
|
||||
virtual common::ObAddr get_previous_leader() const
|
||||
{
|
||||
return previous_leader_;
|
||||
}
|
||||
virtual const common::ObRegion& get_region() const;
|
||||
virtual const common::ObIDC& get_idc() const;
|
||||
virtual int set_region(const common::ObRegion& region, bool& is_changed);
|
||||
virtual int set_idc(const common::ObIDC& idc, bool& is_changed);
|
||||
virtual int64_t get_leader_epoch() const
|
||||
{
|
||||
return leader_epoch_;
|
||||
}
|
||||
virtual common::ObVersion get_freeze_version() const;
|
||||
virtual int64_t get_last_leader_active_time() const
|
||||
{
|
||||
return last_leader_active_time_;
|
||||
}
|
||||
virtual int update_freeze_version(const common::ObVersion& freeze_version);
|
||||
virtual int handle_prepare_rqst(
|
||||
const common::ObProposalID& proposal_id, const common::ObAddr& new_leader, const int64_t cluster_id);
|
||||
virtual int handle_standby_prepare_rqst(
|
||||
const common::ObProposalID& proposal_id, const common::ObAddr& new_leader, const int64_t cluster_id);
|
||||
virtual int update_proposal_id(const common::ObProposalID& proposal_id);
|
||||
virtual int start_election();
|
||||
virtual int stop_election();
|
||||
virtual int set_election_leader(const common::ObAddr& leader, const int64_t lease_start);
|
||||
virtual common::ObProposalID get_proposal_id() const override { return curr_proposal_id_; }
|
||||
virtual int switch_state(bool &need_retry) override;
|
||||
virtual bool check_sliding_window_state() override;
|
||||
virtual bool is_state_changed(bool &need_retry) override;
|
||||
virtual int set_scan_disk_log_finished() override;
|
||||
virtual bool is_scan_disk_log_finished() const { return scan_disk_log_finished_; }
|
||||
virtual int16_t get_state() const override { return state_; }
|
||||
virtual common::ObRole get_role() const override { return role_; }
|
||||
virtual common::ObAddr get_leader() const override { return leader_.get_server(); }
|
||||
virtual share::ObCascadMember get_leader_member() const override { return leader_; }
|
||||
virtual common::ObAddr get_primary_leader_addr() const override { return primary_leader_.get_server(); }
|
||||
virtual share::ObCascadMember get_primary_leader() const override { return primary_leader_; }
|
||||
virtual share::ObCascadMember get_prepared_primary_leader() const { return prepared_primary_leader_; }
|
||||
virtual int get_cascad_leader(share::ObCascadMember &cascad_leader_member) const override;
|
||||
virtual common::ObAddr get_previous_leader() const override { return previous_leader_; }
|
||||
virtual const common::ObRegion &get_region() const override;
|
||||
virtual const common::ObIDC &get_idc() const override;
|
||||
virtual int set_region(const common::ObRegion ®ion, bool &is_changed) override;
|
||||
virtual int set_idc(const common::ObIDC &idc, bool &is_changed) override;
|
||||
virtual int64_t get_leader_epoch() const { return leader_epoch_; }
|
||||
virtual common::ObVersion get_freeze_version() const override;
|
||||
virtual int64_t get_last_leader_active_time() const override { return last_leader_active_time_; }
|
||||
virtual int update_freeze_version(const common::ObVersion &freeze_version);
|
||||
virtual int handle_prepare_rqst(const common::ObProposalID &proposal_id,
|
||||
const common::ObAddr &new_leader,
|
||||
const int64_t cluster_id) override;
|
||||
virtual int handle_standby_prepare_rqst(const common::ObProposalID &proposal_id,
|
||||
const common::ObAddr &new_leader,
|
||||
const int64_t cluster_id) override;
|
||||
virtual int update_proposal_id(const common::ObProposalID &proposal_id) override;
|
||||
virtual int start_election() override;
|
||||
virtual int stop_election() override;
|
||||
virtual int set_election_leader(const common::ObAddr &leader, const int64_t lease_start) override;
|
||||
virtual void set_offline();
|
||||
virtual void set_online();
|
||||
virtual bool is_offline() const
|
||||
{
|
||||
return true == ATOMIC_LOAD(&is_offline_);
|
||||
}
|
||||
virtual bool is_offline() const override { return true == ATOMIC_LOAD(&is_offline_); }
|
||||
virtual bool is_changing_leader() const;
|
||||
virtual int change_leader_async(const common::ObPartitionKey& partition_key, const common::ObAddr& leader,
|
||||
common::ObTsWindows& changing_leader_windows);
|
||||
virtual bool is_leader_active() const
|
||||
{
|
||||
return is_leader_active_();
|
||||
}
|
||||
virtual bool is_standby_leader_active() const
|
||||
{
|
||||
return is_standby_leader_active_();
|
||||
}
|
||||
virtual bool is_leader_taking_over() const override
|
||||
{
|
||||
return is_leader_taking_over_();
|
||||
}
|
||||
virtual bool is_leader_reconfirm() const
|
||||
{
|
||||
return is_leader_reconfirm_();
|
||||
}
|
||||
virtual bool is_follower_active() const
|
||||
{
|
||||
return is_follower_active_();
|
||||
}
|
||||
virtual int change_leader_async(const common::ObPartitionKey &partition_key,
|
||||
const common::ObAddr &leader,
|
||||
common::ObTsWindows &changing_leader_windows);
|
||||
virtual bool is_leader_active() const override { return is_leader_active_(); }
|
||||
virtual bool is_standby_leader_active() const override { return is_standby_leader_active_(); }
|
||||
virtual bool is_leader_taking_over() const override { return is_leader_taking_over_(); }
|
||||
virtual bool is_leader_reconfirm() const override { return is_leader_reconfirm_(); }
|
||||
virtual bool is_follower_active() const override { return is_follower_active_(); }
|
||||
virtual int set_follower_active();
|
||||
void set_pre_member_changing()
|
||||
{
|
||||
ATOMIC_STORE(&is_pre_member_changing_, true);
|
||||
}
|
||||
void reset_pre_member_changing()
|
||||
{
|
||||
ATOMIC_STORE(&is_pre_member_changing_, false);
|
||||
}
|
||||
bool is_pre_member_changing() const
|
||||
{
|
||||
return ATOMIC_LOAD(&is_pre_member_changing_);
|
||||
}
|
||||
bool is_inited() const
|
||||
{
|
||||
return is_inited_;
|
||||
}
|
||||
bool is_restoring() const
|
||||
{
|
||||
return ATOMIC_LOAD(&is_restoring_);
|
||||
}
|
||||
bool set_restoring()
|
||||
{
|
||||
return ATOMIC_BCAS(&is_restoring_, false, true);
|
||||
}
|
||||
void reset_restoring()
|
||||
{
|
||||
return ATOMIC_STORE(&is_restoring_, false);
|
||||
}
|
||||
bool is_write_disabled() const override
|
||||
{
|
||||
return ATOMIC_LOAD(&is_write_disabled_);
|
||||
}
|
||||
void disable_write_authority()
|
||||
{
|
||||
return ATOMIC_STORE(&is_write_disabled_, true);
|
||||
}
|
||||
void enable_write_authority()
|
||||
{
|
||||
return ATOMIC_STORE(&is_write_disabled_, false);
|
||||
}
|
||||
bool is_archive_restoring() const;
|
||||
bool is_archive_restore_leader() const;
|
||||
bool is_archive_restoring_log() const;
|
||||
void set_pre_member_changing() { ATOMIC_STORE(&is_pre_member_changing_, true); }
|
||||
void reset_pre_member_changing() { ATOMIC_STORE(&is_pre_member_changing_, false); }
|
||||
bool is_pre_member_changing() const { return ATOMIC_LOAD(&is_pre_member_changing_); }
|
||||
bool is_inited() const { return is_inited_; }
|
||||
bool is_restoring() const { return ATOMIC_LOAD(&is_restoring_); }
|
||||
bool set_restoring() { return ATOMIC_BCAS(&is_restoring_, false, true); }
|
||||
void reset_restoring() { return ATOMIC_STORE(&is_restoring_, false); }
|
||||
bool is_write_disabled() const override { return ATOMIC_LOAD(&is_write_disabled_); }
|
||||
void disable_write_authority() { return ATOMIC_STORE(&is_write_disabled_, true); }
|
||||
void enable_write_authority() { return ATOMIC_STORE(&is_write_disabled_, false); }
|
||||
bool is_archive_restoring() const override;
|
||||
bool is_archive_restore_leader() const override;
|
||||
bool is_archive_restoring_log() const override;
|
||||
int check_role_leader_and_state() const;
|
||||
int check_role_elect_leader_and_state() const;
|
||||
int try_update_leader_from_loc_cache();
|
||||
virtual int async_get_dst_cluster_leader_from_loc_cache(
|
||||
const bool is_need_renew, const int64_t cluster_id, ObAddr& leader) override;
|
||||
int64_t get_self_cluster_id() const;
|
||||
int64_t get_leader_cluster_id() const;
|
||||
virtual int64_t get_reconfirm_start_time() const
|
||||
{
|
||||
return reconfirm_start_time_;
|
||||
}
|
||||
int try_update_leader_from_loc_cache() override;
|
||||
virtual int async_get_dst_cluster_leader_from_loc_cache(const bool is_need_renew,
|
||||
const int64_t cluster_id,
|
||||
ObAddr &leader) override;
|
||||
int64_t get_self_cluster_id() const override;
|
||||
int64_t get_leader_cluster_id() const override;
|
||||
virtual int64_t get_reconfirm_start_time() const override { return reconfirm_start_time_; }
|
||||
void destroy();
|
||||
virtual bool is_new_created_leader() const
|
||||
{
|
||||
return is_new_created_leader_;
|
||||
}
|
||||
void set_need_rebuild()
|
||||
{
|
||||
ATOMIC_STORE(&need_rebuild_, true);
|
||||
}
|
||||
void reset_need_rebuild()
|
||||
{
|
||||
ATOMIC_STORE(&need_rebuild_, false);
|
||||
}
|
||||
bool is_need_rebuild() const
|
||||
{
|
||||
return ATOMIC_LOAD(&need_rebuild_);
|
||||
}
|
||||
virtual bool is_new_created_leader() const override { return is_new_created_leader_; }
|
||||
void set_need_rebuild() { ATOMIC_STORE(&need_rebuild_, true); }
|
||||
void reset_need_rebuild() override { ATOMIC_STORE(&need_rebuild_, false); }
|
||||
bool is_need_rebuild() const override { return ATOMIC_LOAD(&need_rebuild_); }
|
||||
bool is_replaying() const;
|
||||
int enable_replay();
|
||||
int disable_replay();
|
||||
bool is_replay_enabled() const;
|
||||
int set_election_candidates(
|
||||
const int64_t replica_num, const ObMemberList& member_list, const int64_t membership_timestamp);
|
||||
int set_election_replica_num(const int64_t replica_num);
|
||||
int inc_election_replica_num();
|
||||
int dec_election_replica_num();
|
||||
int get_election_valid_candidates(ObMemberList& valid_candidate_list) const;
|
||||
int get_election_leader(ObAddr& leader, int64_t& leader_epoch, common::ObTsWindows& changing_leader_windows) const;
|
||||
int get_election_leader(ObAddr& leader, int64_t& leader_epoch) const;
|
||||
bool is_replay_enabled() const override;
|
||||
int set_election_candidates(const int64_t replica_num,
|
||||
const ObMemberList &member_list,
|
||||
const int64_t membership_timestamp) override;
|
||||
int set_election_replica_num(const int64_t replica_num) override;
|
||||
int inc_election_replica_num() override;
|
||||
int dec_election_replica_num() override;
|
||||
int get_election_valid_candidates(ObMemberList &valid_candidate_list) const override;
|
||||
int get_election_leader(ObAddr &leader, int64_t &leader_epoch,
|
||||
common::ObTsWindows &changing_leader_windows) const override;
|
||||
int get_election_leader(ObAddr &leader, int64_t &leader_epoch) const override;
|
||||
bool is_leader_revoke_recently() const;
|
||||
void report_start_id_trace(const uint64_t start_id);
|
||||
int standby_set_election_leader(const common::ObAddr& leader, const int64_t lease_start);
|
||||
bool is_cluster_allow_vote() const;
|
||||
bool is_can_elect_standby_leader() const;
|
||||
bool has_valid_member_list() const;
|
||||
virtual int try_renew_sync_standby_location();
|
||||
void report_start_id_trace(const uint64_t start_id) override;
|
||||
int standby_set_election_leader(const common::ObAddr &leader, const int64_t lease_start);
|
||||
bool is_cluster_allow_vote() const override;
|
||||
bool is_can_elect_standby_leader() const override;
|
||||
bool has_valid_member_list() const override;
|
||||
virtual int try_renew_sync_standby_location() override;
|
||||
int standby_update_protection_level();
|
||||
int standby_leader_check_protection_level();
|
||||
int handle_sync_start_id_resp(
|
||||
const ObAddr& server, const int64_t cluster_id, const int64_t original_send_ts, const uint64_t sync_start_id);
|
||||
int get_standby_protection_level(uint32_t& protection_level) const;
|
||||
virtual int get_pls_epoch(int64_t& pls_epoch) const;
|
||||
int handle_sync_start_id_resp(const ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const int64_t original_send_ts,
|
||||
const uint64_t sync_start_id);
|
||||
int get_standby_protection_level(uint32_t &protection_level) const;
|
||||
virtual int get_pls_epoch(int64_t &pls_epoch) const override;
|
||||
int primary_process_protect_mode_switch();
|
||||
|
||||
// The following two functions cooperate to achieve congestion control of clog
|
||||
|
@ -504,242 +504,348 @@ class ObPartitionLogService : public ObIPartitionLogService {
|
||||
archive::ObArchiveMgr* archive_mgr, archive::ObArchiveRestoreEngine* archive_restore_engine,
|
||||
const enum ObCreatePlsType& create_pls_type) override;
|
||||
|
||||
virtual int get_log_id_timestamp(const int64_t base_timestamp, ObLogMeta& log_meta);
|
||||
virtual int submit_aggre_log(ObAggreBuffer* buffer, const int64_t base_timestamp);
|
||||
virtual int submit_log(const char* buff, const int64_t size, const int64_t base_timestamp, ObISubmitLogCb* cb,
|
||||
const bool is_trans_log, uint64_t& log_id, int64_t& log_timestamp);
|
||||
virtual int add_member(const common::ObMember& member, const int64_t quorum, obrpc::ObMCLogInfo& log_info);
|
||||
virtual int remove_member(const common::ObMember& member, const int64_t quorum, obrpc::ObMCLogInfo& log_info);
|
||||
virtual int change_quorum(const common::ObMemberList& curr_member_list, const int64_t curr_quorum,
|
||||
const int64_t new_quorum, obrpc::ObMCLogInfo& log_info);
|
||||
virtual int is_member_change_done(const obrpc::ObMCLogInfo& log_info);
|
||||
virtual int get_base_storage_info(
|
||||
common::ObBaseStorageInfo& base_storage_info, uint64_t& sw_last_replay_log_id) override;
|
||||
virtual common::ObPartitionKey get_partition_key() const;
|
||||
virtual int get_saved_base_storage_info(common::ObBaseStorageInfo& base_storage_info) const;
|
||||
virtual int get_leader(common::ObAddr& addr) const;
|
||||
virtual int get_clog_parent(common::ObAddr& parent, int64_t& cluster_id) const;
|
||||
virtual int change_leader(const common::ObAddr& leader, common::ObTsWindows& changing_leader_windows);
|
||||
virtual int change_restore_leader(const common::ObAddr& leader);
|
||||
virtual int check_and_set_restore_progress();
|
||||
virtual int set_restore_fetch_log_finished(ObArchiveFetchLogResult fetch_log_result);
|
||||
virtual int process_restore_takeover_msg(const int64_t send_ts);
|
||||
virtual int try_update_next_replay_log_ts_in_restore(const int64_t new_ts);
|
||||
virtual int get_role(common::ObRole& role) const;
|
||||
virtual int get_role_for_partition_table(common::ObRole& role) const;
|
||||
virtual int get_role_unsafe(int64_t& leader_epoch, common::ObTsWindows& changing_leader_windows) const;
|
||||
virtual int get_role_unlock(int64_t& leader_epoch, common::ObTsWindows& changing_leader_windows) const;
|
||||
virtual int get_role_for_partition_table_unlock(
|
||||
int64_t& leader_epoch, common::ObTsWindows& changing_leader_windows) const;
|
||||
virtual int get_role_and_last_leader_active_time(common::ObRole& role, int64_t& timestamp) const;
|
||||
virtual int get_role_and_leader_epoch(common::ObRole& role, int64_t& leader_epoch);
|
||||
virtual int get_role_and_leader_epoch(common::ObRole& role, int64_t& leader_epoch, int64_t& takeover_time);
|
||||
virtual int set_election_leader(const common::ObAddr& leader, const int64_t lease_start);
|
||||
virtual int get_leader_curr_member_list(common::ObMemberList& member_list) const;
|
||||
virtual int get_curr_member_list(common::ObMemberList& member_list) const;
|
||||
virtual int get_curr_member_list_for_report(common::ObMemberList& member_list) const;
|
||||
virtual int try_get_curr_member_list(common::ObMemberList& member_list) const;
|
||||
virtual int get_replica_num(int64_t& replica_num) const;
|
||||
virtual int try_get_replica_num(int64_t& replica_num) const;
|
||||
virtual int receive_log(const ObLogEntry& log_entry, const common::ObAddr& server, const int64_t cluster_id,
|
||||
const common::ObProposalID& proposal_id, const ObPushLogMode push_mode, const ReceiveLogType type);
|
||||
virtual int receive_renew_ms_log(const ObLogEntry& log_entry, const ObAddr& server, const int64_t cluster_id,
|
||||
const ObProposalID& proposal_id, const ReceiveLogType type);
|
||||
virtual int receive_archive_log(const ObLogEntry& log_entry, const bool is_batch_committed);
|
||||
virtual int ack_log(const common::ObAddr& server, const uint64_t log_id, const common::ObProposalID& proposal_id);
|
||||
virtual int standby_ack_log(
|
||||
const ObAddr& server, const int64_t cluster_id, const uint64_t log_id, const ObProposalID& proposal_id);
|
||||
virtual int fake_ack_log(const ObAddr& server, const uint64_t log_id, const ObProposalID& proposal_id);
|
||||
virtual int ack_renew_ms_log(const ObAddr& server, const uint64_t log_id, const int64_t submit_timestamp,
|
||||
const ObProposalID& ms_proposal_id) override;
|
||||
virtual int fake_receive_log(const ObAddr& server, const uint64_t log_id, const ObProposalID& proposal_id);
|
||||
virtual int get_log(const common::ObAddr& server, const uint64_t log_id, const int64_t log_num,
|
||||
const ObFetchLogType fetch_type, const common::ObProposalID& proposal_id, const int64_t cluster_id,
|
||||
const common::ObReplicaType replica_type, const int64_t network_limit, const uint64_t max_confirmed_log_id);
|
||||
virtual int async_get_log(const common::ObAddr& server, const int64_t cluster_id, const uint64_t start_log_id,
|
||||
const uint64_t end_log_id, const ObFetchLogType fetch_type, const common::ObProposalID& proposal_id,
|
||||
const int64_t network_limit);
|
||||
virtual int get_max_log_id(
|
||||
const common::ObAddr& server, const int64_t cluster_id, const common::ObProposalID& proposal_id);
|
||||
virtual int handle_standby_prepare_req(
|
||||
const ObAddr& server, const int64_t cluster_id, const ObProposalID& proposal_id);
|
||||
virtual int handle_standby_prepare_resp(const ObAddr& server, const ObProposalID& proposal_id,
|
||||
const uint64_t ms_log_id, const int64_t membership_version, const ObMemberList& member_list);
|
||||
virtual int handle_query_sync_start_id_req(const ObAddr& server, const int64_t cluster_id, const int64_t send_ts);
|
||||
virtual int handle_sync_start_id_resp(
|
||||
const ObAddr& server, const int64_t cluster_id, const int64_t original_send_ts, const uint64_t sync_start_id);
|
||||
virtual int receive_max_log_id(const common::ObAddr& server, const uint64_t max_log_id,
|
||||
const ObProposalID& proposal_id, const int64_t max_log_ts);
|
||||
virtual int receive_confirmed_info(const common::ObAddr& server, const int64_t src_cluster_id, const uint64_t log_id,
|
||||
const ObConfirmedInfo& confirmed_info, const bool batch_committed);
|
||||
virtual int receive_renew_ms_log_confirmed_info(const common::ObAddr& server, const uint64_t log_id,
|
||||
const common::ObProposalID& ms_proposal_id, const ObConfirmedInfo& confirmed_info) override;
|
||||
virtual int append_disk_log(
|
||||
const ObLogEntry& log, const ObLogCursor& log_cursor, const int64_t accum_checksum, const bool batch_committed);
|
||||
virtual int is_offline(bool& is_offline);
|
||||
virtual int stop_election();
|
||||
virtual int set_offline();
|
||||
virtual int set_online(
|
||||
const common::ObBaseStorageInfo& base_storage_info, const common::ObVersion& memstore_version) override;
|
||||
virtual int on_election_role_change();
|
||||
virtual int set_scan_disk_log_finished();
|
||||
virtual int switch_state();
|
||||
virtual int switch_state(bool& need_retry);
|
||||
virtual int check_mc_and_sliding_window_state();
|
||||
virtual int leader_send_max_log_info();
|
||||
virtual int leader_keepalive(const int64_t keepalive_interval);
|
||||
virtual int sync_log_archive_progress();
|
||||
virtual int get_log_archive_status(ObPGLogArchiveStatus& status);
|
||||
virtual int check_cascading_state();
|
||||
virtual int archive_checkpoint(const int64_t interval);
|
||||
virtual int set_next_index_log_id(const uint64_t log_id, const int64_t accum_checksum);
|
||||
virtual int is_in_sync(bool& is_sync) const override;
|
||||
virtual int is_log_sync_with_leader(bool& is_sync) const override;
|
||||
virtual int is_log_sync_with_primary(const int64_t switchover_epoch, bool& is_sync) const;
|
||||
virtual int is_need_rebuild(bool& need_rebuild) const;
|
||||
virtual bool is_leader_active() const;
|
||||
virtual int get_log_id_timestamp(const int64_t base_timestamp, ObLogMeta &log_meta) override;
|
||||
virtual int submit_aggre_log(ObAggreBuffer *buffer,
|
||||
const int64_t base_timestamp) override;
|
||||
virtual int submit_log(const char *buff,
|
||||
const int64_t size,
|
||||
const int64_t base_timestamp,
|
||||
ObISubmitLogCb *cb,
|
||||
const bool is_trans_log,
|
||||
uint64_t &log_id,
|
||||
int64_t &log_timestamp) override;
|
||||
virtual int add_member(const common::ObMember &member,
|
||||
const int64_t quorum,
|
||||
obrpc::ObMCLogInfo &log_info) override;
|
||||
virtual int remove_member(const common::ObMember &member,
|
||||
const int64_t quorum,
|
||||
obrpc::ObMCLogInfo &log_info) override;
|
||||
virtual int change_quorum(const common::ObMemberList &curr_member_list,
|
||||
const int64_t curr_quorum,
|
||||
const int64_t new_quorum,
|
||||
obrpc::ObMCLogInfo &log_info) override;
|
||||
virtual int is_member_change_done(const obrpc::ObMCLogInfo &log_info) override;
|
||||
virtual int get_base_storage_info(common::ObBaseStorageInfo &base_storage_info,
|
||||
uint64_t &sw_last_replay_log_id) override;
|
||||
virtual common::ObPartitionKey get_partition_key() const override;
|
||||
virtual int get_saved_base_storage_info(common::ObBaseStorageInfo &base_storage_info) const override;
|
||||
virtual int get_leader(common::ObAddr &addr) const override;
|
||||
virtual int get_clog_parent(common::ObAddr &parent, int64_t &cluster_id) const override;
|
||||
virtual int change_leader(const common::ObAddr &leader, common::ObTsWindows &changing_leader_windows) override;
|
||||
virtual int change_restore_leader(const common::ObAddr &leader) override;
|
||||
virtual int check_and_set_restore_progress() override;
|
||||
virtual int set_restore_fetch_log_finished(ObArchiveFetchLogResult fetch_log_result) override;
|
||||
virtual int process_restore_takeover_msg(const int64_t send_ts) override;
|
||||
virtual int try_update_next_replay_log_ts_in_restore(const int64_t new_ts) override;
|
||||
virtual int get_role(common::ObRole &role) const override;
|
||||
virtual int get_role_for_partition_table(common::ObRole &role) const override;
|
||||
virtual int get_role_unsafe(int64_t &leader_epoch,
|
||||
common::ObTsWindows &changing_leader_windows) const override;
|
||||
virtual int get_role_unlock(int64_t &leader_epoch,
|
||||
common::ObTsWindows &changing_leader_windows) const override;
|
||||
virtual int get_role_for_partition_table_unlock(int64_t &leader_epoch,
|
||||
common::ObTsWindows &changing_leader_windows) const;
|
||||
virtual int get_role_and_last_leader_active_time(common::ObRole &role, int64_t ×tamp) const override;
|
||||
virtual int get_role_and_leader_epoch(common::ObRole &role, int64_t &leader_epoch) override;
|
||||
virtual int get_role_and_leader_epoch(common::ObRole &role, int64_t &leader_epoch,
|
||||
int64_t &takeover_time) override;
|
||||
virtual int set_election_leader(const common::ObAddr &leader, const int64_t lease_start) override;
|
||||
virtual int get_leader_curr_member_list(common::ObMemberList &member_list) const override;
|
||||
virtual int get_curr_member_list(common::ObMemberList &member_list) const override;
|
||||
virtual int get_curr_member_list_for_report(common::ObMemberList &member_list) const override;
|
||||
virtual int try_get_curr_member_list(common::ObMemberList &member_list) const override;
|
||||
virtual int get_replica_num(int64_t &replica_num) const override;
|
||||
virtual int try_get_replica_num(int64_t &replica_num) const override;
|
||||
virtual int receive_log(const ObLogEntry &log_entry,
|
||||
const common::ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const common::ObProposalID &proposal_id,
|
||||
const ObPushLogMode push_mode,
|
||||
const ReceiveLogType type) override;
|
||||
virtual int receive_renew_ms_log(const ObLogEntry &log_entry,
|
||||
const ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const ObProposalID &proposal_id,
|
||||
const ReceiveLogType type) override;
|
||||
virtual int receive_archive_log(const ObLogEntry &log_entry,
|
||||
const bool is_batch_committed) override;
|
||||
virtual int ack_log(const common::ObAddr &server,
|
||||
const uint64_t log_id,
|
||||
const common::ObProposalID &proposal_id) override;
|
||||
virtual int standby_ack_log(const ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const uint64_t log_id,
|
||||
const ObProposalID &proposal_id) override;
|
||||
virtual int fake_ack_log(const ObAddr &server,
|
||||
const uint64_t log_id,
|
||||
const ObProposalID &proposal_id) override;
|
||||
virtual int ack_renew_ms_log(const ObAddr &server,
|
||||
const uint64_t log_id,
|
||||
const int64_t submit_timestamp,
|
||||
const ObProposalID &ms_proposal_id) override;
|
||||
virtual int fake_receive_log(const ObAddr &server,
|
||||
const uint64_t log_id,
|
||||
const ObProposalID &proposal_id) override;
|
||||
virtual int get_log(const common::ObAddr &server,
|
||||
const uint64_t log_id,
|
||||
const int64_t log_num,
|
||||
const ObFetchLogType fetch_type,
|
||||
const common::ObProposalID &proposal_id,
|
||||
const int64_t cluster_id,
|
||||
const common::ObReplicaType replica_type,
|
||||
const int64_t network_limit,
|
||||
const uint64_t max_confirmed_log_id) override;
|
||||
virtual int async_get_log(const common::ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const uint64_t start_log_id,
|
||||
const uint64_t end_log_id,
|
||||
const ObFetchLogType fetch_type,
|
||||
const common::ObProposalID &proposal_id,
|
||||
const int64_t network_limit) override;
|
||||
virtual int get_max_log_id(const common::ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const common::ObProposalID &proposal_id) override;
|
||||
virtual int handle_standby_prepare_req(const ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const ObProposalID &proposal_id) override;
|
||||
virtual int handle_standby_prepare_resp(const ObAddr &server,
|
||||
const ObProposalID &proposal_id,
|
||||
const uint64_t ms_log_id,
|
||||
const int64_t membership_version,
|
||||
const ObMemberList &member_list) override;
|
||||
virtual int handle_query_sync_start_id_req(const ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const int64_t send_ts) override;
|
||||
virtual int handle_sync_start_id_resp(const ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const int64_t original_send_ts,
|
||||
const uint64_t sync_start_id) override;
|
||||
virtual int receive_max_log_id(const common::ObAddr &server,
|
||||
const uint64_t max_log_id,
|
||||
const ObProposalID &proposal_id,
|
||||
const int64_t max_log_ts) override;
|
||||
virtual int receive_confirmed_info(const common::ObAddr &server,
|
||||
const int64_t src_cluster_id,
|
||||
const uint64_t log_id,
|
||||
const ObConfirmedInfo &confirmed_info,
|
||||
const bool batch_committed) override;
|
||||
virtual int receive_renew_ms_log_confirmed_info(const common::ObAddr &server,
|
||||
const uint64_t log_id,
|
||||
const common::ObProposalID &ms_proposal_id,
|
||||
const ObConfirmedInfo &confirmed_info) override;
|
||||
virtual int append_disk_log(const ObLogEntry &log,
|
||||
const ObLogCursor &log_cursor,
|
||||
const int64_t accum_checksum,
|
||||
const bool batch_committed) override;
|
||||
virtual int is_offline(bool &is_offline) override;
|
||||
virtual int stop_election() override;
|
||||
virtual int set_offline() override;
|
||||
virtual int set_online(const common::ObBaseStorageInfo &base_storage_info,
|
||||
const common::ObVersion &memstore_version) override;
|
||||
virtual int on_election_role_change() override;
|
||||
virtual int set_scan_disk_log_finished() override;
|
||||
virtual int switch_state() override;
|
||||
virtual int switch_state(bool &need_retry) override;
|
||||
virtual int check_mc_and_sliding_window_state() override;
|
||||
virtual int leader_send_max_log_info() override;
|
||||
virtual int leader_keepalive(const int64_t keepalive_interval) override;
|
||||
virtual int sync_log_archive_progress() override;
|
||||
virtual int get_log_archive_status(ObPGLogArchiveStatus &status) override;
|
||||
virtual int check_cascading_state() override;
|
||||
virtual int archive_checkpoint(const int64_t interval) override;
|
||||
virtual int set_next_index_log_id(const uint64_t log_id, const int64_t accum_checksum) override;
|
||||
virtual int is_in_sync(bool &is_sync) const override;
|
||||
virtual int is_log_sync_with_leader(bool &is_sync) const override;
|
||||
virtual int is_log_sync_with_primary(const int64_t switchover_epoch, bool &is_sync) const override;
|
||||
virtual int is_need_rebuild(bool &need_rebuild) const override;
|
||||
virtual bool is_leader_active() const override;
|
||||
virtual int check_self_is_election_leader_() const;
|
||||
virtual int get_next_replay_log_info(uint64_t& next_replay_log_id, int64_t& next_replay_log_timestamp);
|
||||
virtual int get_follower_log_delay(int64_t& log_delay);
|
||||
virtual int process_keepalive_msg(const common::ObAddr& server, const int64_t cluster_id, const uint64_t next_log_id,
|
||||
const int64_t next_log_ts_lb, const uint64_t deliver_cnt);
|
||||
virtual int process_archive_checkpoint(const uint64_t next_log_id, const int64_t next_log_ts);
|
||||
virtual int get_restore_leader_info(bool& is_restore_leader, int64_t& leader_takeover_ts);
|
||||
virtual int process_leader_max_log_msg(const common::ObAddr& server, const int64_t switchover_epoch,
|
||||
const uint64_t leader_max_log_id, const int64_t leader_next_log_ts);
|
||||
virtual int process_sync_log_archive_progress_msg(
|
||||
const common::ObAddr& server, const int64_t cluster_id, const ObPGLogArchiveStatus& status);
|
||||
virtual int notify_log_missing(const common::ObAddr& src_server, const uint64_t start_log_id,
|
||||
const bool is_in_member_list, const int32_t msg_type);
|
||||
virtual int fetch_register_server(const common::ObAddr& server, const common::ObReplicaType replica_type,
|
||||
const int64_t next_replay_log_ts, const bool is_request_leader, const bool is_need_force_register,
|
||||
const common::ObRegion& region, const int64_t cluster_id, const common::ObIDC& idc);
|
||||
virtual int fetch_register_server_resp_v2(const common::ObAddr& sender, const bool is_assign_parent_succeed,
|
||||
const share::ObCascadMemberList& candidate_list, const int32_t msg_type);
|
||||
virtual int replace_sick_child(
|
||||
const common::ObAddr& sender, const int64_t cluster_id, const common::ObAddr& sick_child);
|
||||
virtual int get_curr_leader_and_memberlist(common::ObAddr& leader, common::ObRole& role,
|
||||
common::ObMemberList& curr_member_list, common::ObChildReplicaList& children_list) const;
|
||||
virtual int migrate_set_base_storage_info(const common::ObBaseStorageInfo& base_storage_info);
|
||||
virtual int restore_replayed_log(const common::ObBaseStorageInfo& base_storage_info);
|
||||
inline virtual uint64_t get_last_replay_log_id() const
|
||||
virtual int get_next_replay_log_info(uint64_t &next_replay_log_id, int64_t &next_replay_log_timestamp) override;
|
||||
virtual int get_follower_log_delay(int64_t &log_delay) override;
|
||||
virtual int process_keepalive_msg(const common::ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const uint64_t next_log_id,
|
||||
const int64_t next_log_ts_lb,
|
||||
const uint64_t deliver_cnt) override;
|
||||
virtual int process_archive_checkpoint(const uint64_t next_log_id,
|
||||
const int64_t next_log_ts) override;
|
||||
virtual int get_restore_leader_info(bool &is_restore_leader,
|
||||
int64_t &leader_takeover_ts) override;
|
||||
virtual int process_leader_max_log_msg(const common::ObAddr &server,
|
||||
const int64_t switchover_epoch,
|
||||
const uint64_t leader_max_log_id,
|
||||
const int64_t leader_next_log_ts) override;
|
||||
virtual int process_sync_log_archive_progress_msg(const common::ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const ObPGLogArchiveStatus &status) override;
|
||||
virtual int notify_log_missing(const common::ObAddr &src_server,
|
||||
const uint64_t start_log_id,
|
||||
const bool is_in_member_list,
|
||||
const int32_t msg_type) override;
|
||||
virtual int fetch_register_server(const common::ObAddr &server,
|
||||
const common::ObReplicaType replica_type,
|
||||
const int64_t next_replay_log_ts,
|
||||
const bool is_request_leader,
|
||||
const bool is_need_force_register,
|
||||
const common::ObRegion ®ion,
|
||||
const int64_t cluster_id,
|
||||
const common::ObIDC &idc) override;
|
||||
virtual int fetch_register_server_resp_v2(const common::ObAddr &sender,
|
||||
const bool is_assign_parent_succeed,
|
||||
const share::ObCascadMemberList &candidate_list,
|
||||
const int32_t msg_type) override;
|
||||
virtual int replace_sick_child(const common::ObAddr &sender,
|
||||
const int64_t cluster_id,
|
||||
const common::ObAddr &sick_child) override;
|
||||
virtual int get_curr_leader_and_memberlist(common::ObAddr &leader,
|
||||
common::ObRole &role,
|
||||
common::ObMemberList &curr_member_list,
|
||||
common::ObChildReplicaList &children_list) const override;
|
||||
virtual int migrate_set_base_storage_info(const common::ObBaseStorageInfo &base_storage_info) override;
|
||||
virtual int restore_replayed_log(const common::ObBaseStorageInfo &base_storage_info) override;
|
||||
inline virtual uint64_t get_last_replay_log_id() const override
|
||||
{
|
||||
return saved_base_storage_info_.get_last_replay_log_id();
|
||||
}
|
||||
virtual void get_last_replay_log(uint64_t& log_id, int64_t& ts);
|
||||
virtual int64_t get_last_submit_timestamp() const;
|
||||
virtual int remove_election();
|
||||
virtual int standby_update_protection_level();
|
||||
virtual int get_standby_leader_protection_level(uint32_t& protection_level);
|
||||
virtual int primary_process_protect_mode_switch();
|
||||
virtual int64_t get_membership_timestamp() const;
|
||||
virtual int try_replay(const bool need_async, bool& is_replayed, bool& is_replay_failed);
|
||||
virtual bool is_svr_in_member_list(const ObAddr& server) const;
|
||||
virtual int get_dst_leader_candidate(common::ObMemberList& member_list) const;
|
||||
virtual int get_max_data_version(ObVersion& max_data_version) const;
|
||||
virtual int set_follower_active();
|
||||
virtual uint64_t get_last_slide_log_id();
|
||||
virtual uint64_t get_start_log_id();
|
||||
virtual uint64_t get_start_log_id_unsafe();
|
||||
virtual int get_log_id_range(uint64_t& start_log_id, int64_t& start_ts, uint64_t& end_log_id, int64_t& end_ts);
|
||||
virtual int get_sw_max_log_id_info(uint64_t& sw_max_log_id, int64_t& sw_max_log_ts);
|
||||
int get_sw_max_log_id(uint64_t& sw_max_log_id);
|
||||
virtual ObClogVirtualStat* alloc_clog_virtual_stat();
|
||||
virtual int revert_clog_virtual_stat(ObClogVirtualStat* virtual_stat);
|
||||
virtual int force_set_as_single_replica();
|
||||
virtual int force_set_replica_num(const int64_t replica_num);
|
||||
virtual int force_set_parent(const common::ObAddr& new_parent);
|
||||
virtual int force_reset_parent();
|
||||
virtual int force_set_server_list(const obrpc::ObServerList& server_list, const int64_t replica_num);
|
||||
virtual int renew_ms_log_flush_cb(const storage::ObMsInfoTask& task);
|
||||
virtual void get_last_replay_log(uint64_t &log_id, int64_t &ts) override;
|
||||
virtual int64_t get_last_submit_timestamp() const override;
|
||||
virtual int remove_election() override;
|
||||
virtual int standby_update_protection_level() override;
|
||||
virtual int get_standby_leader_protection_level(uint32_t &protection_level) override;
|
||||
virtual int primary_process_protect_mode_switch() override;
|
||||
virtual int64_t get_membership_timestamp() const override;
|
||||
virtual int try_replay(const bool need_async, bool &is_replayed, bool &is_replay_failed) override;
|
||||
virtual bool is_svr_in_member_list(const ObAddr &server) const override;
|
||||
virtual int get_dst_leader_candidate(common::ObMemberList &member_list) const override;
|
||||
virtual int get_max_data_version(ObVersion &max_data_version) const override;
|
||||
virtual int set_follower_active() override;
|
||||
virtual uint64_t get_last_slide_log_id() override;
|
||||
virtual uint64_t get_start_log_id() override;
|
||||
virtual uint64_t get_start_log_id_unsafe() override;
|
||||
virtual int get_log_id_range(uint64_t &start_log_id,
|
||||
int64_t &start_ts,
|
||||
uint64_t &end_log_id,
|
||||
int64_t &end_ts) override;
|
||||
virtual int get_sw_max_log_id_info(uint64_t &sw_max_log_id, int64_t &sw_max_log_ts) override;
|
||||
int get_sw_max_log_id(uint64_t &sw_max_log_id) override;
|
||||
virtual ObClogVirtualStat *alloc_clog_virtual_stat() override;
|
||||
virtual int revert_clog_virtual_stat(ObClogVirtualStat *virtual_stat) override;
|
||||
virtual int force_set_as_single_replica() override;
|
||||
virtual int force_set_replica_num(const int64_t replica_num) override;
|
||||
virtual int force_set_parent(const common::ObAddr &new_parent) override;
|
||||
virtual int force_reset_parent() override;
|
||||
virtual int force_set_server_list(const obrpc::ObServerList &server_list,
|
||||
const int64_t replica_num) override;
|
||||
virtual int renew_ms_log_flush_cb(const storage::ObMsInfoTask &task) override;
|
||||
virtual int try_update_leader_from_loc_cache() override;
|
||||
virtual int flush_cb(const ObLogFlushCbArg& arg);
|
||||
virtual int on_get_election_priority(election::ObElectionPriority& priority);
|
||||
virtual int on_change_leader_retry(const common::ObAddr& server, ObTsWindows& changing_leader_windows);
|
||||
virtual int get_next_timestamp(const uint64_t last_log_id, int64_t& res_ts);
|
||||
virtual int get_next_served_log_info_for_leader(uint64_t& next_served_log_id, int64_t& next_served_log_ts);
|
||||
virtual uint64_t get_next_index_log_id() const
|
||||
virtual int flush_cb(const ObLogFlushCbArg &arg) override;
|
||||
virtual int on_get_election_priority(election::ObElectionPriority &priority) override;
|
||||
virtual int on_change_leader_retry(const common::ObAddr &server,
|
||||
ObTsWindows &changing_leader_windows) override;
|
||||
virtual int get_next_timestamp(const uint64_t last_log_id, int64_t &res_ts) override;
|
||||
virtual int get_next_served_log_info_for_leader(uint64_t &next_served_log_id,
|
||||
int64_t &next_served_log_ts) override;
|
||||
virtual uint64_t get_next_index_log_id() const override
|
||||
{
|
||||
return sw_.get_next_index_log_id();
|
||||
}
|
||||
|
||||
virtual int64_t get_scan_confirmed_log_cnt() const
|
||||
virtual int64_t get_scan_confirmed_log_cnt() const override
|
||||
{
|
||||
return ATOMIC_LOAD(&scan_confirmed_log_cnt_);
|
||||
}
|
||||
virtual int get_pls_epoch(int64_t& pls_epoch) const;
|
||||
virtual int allow_gc(bool& allowed);
|
||||
virtual int query_max_flushed_ilog_id(uint64_t& ret_max_ilog_id) override;
|
||||
virtual void set_zone_priority(const uint64_t zone_priority);
|
||||
virtual int set_region(const common::ObRegion& region);
|
||||
virtual int set_idc(const common::ObIDC& idc);
|
||||
virtual const common::ObRegion& get_region() const;
|
||||
virtual const common::ObIDC& get_idc() const;
|
||||
virtual enum ObReplicaType get_replica_type();
|
||||
virtual int set_replica_type(const enum ObReplicaType replica_type);
|
||||
virtual int check_is_normal_partition(bool& is_normal_partition) const;
|
||||
|
||||
public:
|
||||
virtual bool need_skip_when_check_start_service() const;
|
||||
virtual int broadcast_info();
|
||||
virtual int update_broadcast_info(
|
||||
const common::ObAddr& server, const common::ObReplicaType& replica_type, const uint64_t max_confirmed_log_id);
|
||||
virtual int get_recyclable_log_id(uint64_t& log_id) const;
|
||||
virtual int is_valid_member(const common::ObAddr& addr, bool& is_valid) const;
|
||||
virtual bool has_valid_next_replay_log_ts() const;
|
||||
virtual bool has_valid_member_list() const;
|
||||
virtual int process_check_rebuild_req(
|
||||
const common::ObAddr& server, const uint64_t start_log_id, const int64_t cluster_id);
|
||||
virtual void get_max_majority_log(uint64_t& log_id, int64_t& log_ts) const override;
|
||||
virtual int get_pls_epoch(int64_t &pls_epoch) const override;
|
||||
virtual int allow_gc(bool &allowed) override;
|
||||
virtual int query_max_flushed_ilog_id(uint64_t &ret_max_ilog_id) override;
|
||||
virtual void set_zone_priority(const uint64_t zone_priority) override;
|
||||
virtual int set_region(const common::ObRegion ®ion) override;
|
||||
virtual int set_idc(const common::ObIDC &idc) override;
|
||||
virtual const common::ObRegion &get_region() const;
|
||||
virtual const common::ObIDC &get_idc() const;
|
||||
virtual enum ObReplicaType get_replica_type() override;
|
||||
virtual int set_replica_type(const enum ObReplicaType replica_type) override;
|
||||
virtual int check_is_normal_partition(bool &is_normal_partition) const override;
|
||||
public:
|
||||
virtual bool need_skip_when_check_start_service() const override;
|
||||
virtual int broadcast_info() override;
|
||||
virtual int update_broadcast_info(const common::ObAddr &server,
|
||||
const common::ObReplicaType &replica_type,
|
||||
const uint64_t max_confirmed_log_id) override;
|
||||
virtual int get_recyclable_log_id(uint64_t &log_id) const override;
|
||||
virtual int is_valid_member(const common::ObAddr &addr, bool &is_valid) const override;
|
||||
virtual bool has_valid_next_replay_log_ts() const override;
|
||||
virtual bool has_valid_member_list() const override;
|
||||
virtual int process_check_rebuild_req(const common::ObAddr &server,
|
||||
const uint64_t start_log_id,
|
||||
const int64_t cluster_id) override;
|
||||
virtual void get_max_majority_log(uint64_t &log_id, int64_t &log_ts) const override;
|
||||
virtual uint64_t get_max_confirmed_log_id() const override;
|
||||
public:
|
||||
//==================== batch change member begin ====================
|
||||
virtual int pre_change_member(const int64_t quorum,
|
||||
const bool is_add_member,
|
||||
int64_t &mc_timestamp,
|
||||
ObMemberList &member_list,
|
||||
ObProposalID &proposal_id) override;
|
||||
virtual int set_member_changing() override;
|
||||
virtual int reset_member_changing() override;
|
||||
virtual int wait_log_confirmed(const int64_t begin_time,
|
||||
const int64_t max_wait_time) override;
|
||||
virtual int batch_change_member(const common::ObMember &member,
|
||||
const int64_t quorum,
|
||||
const int64_t mc_timestamp,
|
||||
const common::ObProposalID &proposal_id,
|
||||
const bool is_add_member,
|
||||
obrpc::ObMCLogInfo &mc_log_info) override;
|
||||
virtual int get_partition_max_log_id(uint64_t &partition_max_log_id) override;
|
||||
//==================== batch change member end ====================
|
||||
|
||||
public:
|
||||
//==================== batch change member begin ====================
|
||||
virtual int pre_change_member(const int64_t quorum, const bool is_add_member, int64_t& mc_timestamp,
|
||||
ObMemberList& member_list, ObProposalID& proposal_id);
|
||||
virtual int set_member_changing();
|
||||
virtual int reset_member_changing();
|
||||
virtual int wait_log_confirmed(const int64_t begin_time, const int64_t max_wait_time);
|
||||
virtual int batch_change_member(const common::ObMember& member, const int64_t quorum, const int64_t mc_timestamp,
|
||||
const common::ObProposalID& proposal_id, const bool is_add_member, obrpc::ObMCLogInfo& mc_log_info);
|
||||
virtual int get_partition_max_log_id(uint64_t& partition_max_log_id);
|
||||
//==================== batch change member end ====================
|
||||
//=================== one phase commit begin ================
|
||||
virtual int get_candidate_info(ObCandidateInfo &info) override;
|
||||
|
||||
//=================== one phase commit begin ================
|
||||
virtual int get_candidate_info(ObCandidateInfo& info);
|
||||
|
||||
virtual int query_confirmed_log(const uint64_t log_id, transaction::ObTransID& trans_id, int64_t& submit_timestamp);
|
||||
virtual int backfill_log(
|
||||
const ObLogInfo& log_info, const ObLogCursor& log_cursor, const bool is_leader, ObISubmitLogCb* submit_cb);
|
||||
virtual int backfill_confirmed(const ObLogInfo& log_info, const bool batch_first_participant);
|
||||
virtual int resubmit_log(const ObLogInfo& log_info, ObISubmitLogCb* submit_cb);
|
||||
virtual int backfill_nop_log(const ObLogMeta& log_meta);
|
||||
//=================== one phase commit end ================
|
||||
virtual bool need_add_event_task();
|
||||
virtual void reset_has_event_task();
|
||||
virtual int check_can_receive_batch_log(const uint64_t log_id);
|
||||
virtual int update_max_flushed_ilog_id(const uint64_t log_id);
|
||||
virtual int get_cursor_with_cache(const int64_t scan_thread_index, const uint64_t log_id, ObLogCursorExt& log_cursor);
|
||||
virtual int reset_has_pop_task();
|
||||
virtual int set_member_list(const ObMemberList& member_list, const int64_t replica_num,
|
||||
const common::ObAddr& assigned_leader, const int64_t lease_start);
|
||||
int get_last_archived_log_id(const int64_t incarnartion, const int64_t archive_round, uint64_t& last_archived_log_id);
|
||||
virtual int try_freeze_aggre_buffer();
|
||||
int set_archive_restore_state(const int16_t archive_restore_state);
|
||||
virtual int query_confirmed_log(const uint64_t log_id,
|
||||
transaction::ObTransID &trans_id,
|
||||
int64_t &submit_timestamp) override;
|
||||
virtual int backfill_log(const ObLogInfo &log_info,
|
||||
const ObLogCursor &log_cursor,
|
||||
const bool is_leader,
|
||||
ObISubmitLogCb *submit_cb) override;
|
||||
virtual int backfill_confirmed(const ObLogInfo &log_info, const bool batch_first_participant) override;
|
||||
virtual int resubmit_log(const ObLogInfo &log_info,
|
||||
ObISubmitLogCb *submit_cb) override;
|
||||
virtual int backfill_nop_log(const ObLogMeta &log_meta) override;
|
||||
//=================== one phase commit end ================
|
||||
virtual bool need_add_event_task() override;
|
||||
virtual void reset_has_event_task() override;
|
||||
virtual int check_can_receive_batch_log(const uint64_t log_id) override;
|
||||
virtual int update_max_flushed_ilog_id(const uint64_t log_id) override;
|
||||
virtual int get_cursor_with_cache(const int64_t scan_thread_index,
|
||||
const uint64_t log_id,
|
||||
ObLogCursorExt &log_cursor) override;
|
||||
virtual int reset_has_pop_task() override;
|
||||
virtual int set_member_list(const ObMemberList &member_list,
|
||||
const int64_t replica_num,
|
||||
const common::ObAddr &assigned_leader,
|
||||
const int64_t lease_start) override;
|
||||
int get_last_archived_log_id(const int64_t incarnartion,
|
||||
const int64_t archive_round,
|
||||
uint64_t &last_archived_log_id) override;
|
||||
virtual int try_freeze_aggre_buffer() override;
|
||||
int set_archive_restore_state(const int16_t archive_restore_state) override;
|
||||
/*return values:
|
||||
* OB_SUCCESS
|
||||
* OB_EAGAIN: start log has slide out, need retry
|
||||
* other code
|
||||
* */
|
||||
virtual int check_if_start_log_task_empty(bool& is_empty);
|
||||
bool is_archive_restoring() const;
|
||||
common::ObAddr get_restore_leader() const;
|
||||
virtual int restore_leader_try_confirm_log();
|
||||
virtual bool is_standby_restore_state() const;
|
||||
virtual int check_and_try_leader_revoke(const election::ObElection::RevokeType& revoke_type);
|
||||
|
||||
private:
|
||||
enum { DEFAULT_TIMEOUT = 10 * 1000 * 1000 };
|
||||
virtual int check_if_start_log_task_empty(bool &is_empty) override;
|
||||
bool is_archive_restoring() const override;
|
||||
common::ObAddr get_restore_leader() const override;
|
||||
virtual int restore_leader_try_confirm_log() override;
|
||||
virtual bool is_standby_restore_state() const override;
|
||||
virtual int check_and_try_leader_revoke(const election::ObElection::RevokeType &revoke_type) override;
|
||||
private:
|
||||
enum { DEFAULT_TIMEOUT = 10 * 1000 * 1000};
|
||||
virtual void destroy();
|
||||
int majority_cb_(const uint64_t log_id);
|
||||
int standby_majority_cb_(const common::ObAddr& server, const int64_t cluster_id,
|
||||
@ -778,33 +884,51 @@ class ObPartitionLogService : public ObIPartitionLogService {
|
||||
int64_t get_zone_priority() const;
|
||||
int response_sliding_window_info_(const common::ObAddr& server, const bool is_leader);
|
||||
int process_replica_type_change_();
|
||||
int process_reject_msg(const common::ObAddr& server, const int32_t msg_type, const int64_t timestamp);
|
||||
int process_reregister_msg(
|
||||
const common::ObAddr& src_server, const share::ObCascadMember& new_leader, const int64_t send_ts);
|
||||
int process_restore_alive_msg(const common::ObAddr& server, const uint64_t start_log_id);
|
||||
int process_restore_alive_req(const common::ObAddr& server, const int64_t dst_cluster_id, const int64_t send_ts);
|
||||
int process_restore_alive_resp(const common::ObAddr& server, const int64_t send_ts);
|
||||
int process_restore_log_finish_msg(const common::ObAddr& src_server, const uint64_t log_id);
|
||||
int resp_sw_info_when_get_log_(const common::ObAddr& server, const int64_t cluster_id);
|
||||
int internal_fetch_log_(const uint64_t start_log_id, const uint64_t end_log_id, const ObFetchLogType& fetch_type,
|
||||
const ObProposalID& proposal_id, const common::ObAddr& server, const int64_t cluster_id, const uint32_t log_attr,
|
||||
const bool need_send_confirm_info, const int64_t network_limit);
|
||||
int fetch_log_from_sw_(const uint64_t log_id, const ObFetchLogType& fetch_type, const ObProposalID& proposal_id,
|
||||
const common::ObAddr& server, const int64_t cluster_id, const uint32_t log_attr,
|
||||
const bool need_send_confirm_info, const int64_t network_limit);
|
||||
int fetch_log_from_ilog_storage_(const uint64_t log_id, const ObFetchLogType& fetch_type,
|
||||
const ObProposalID& proposal_id, const common::ObAddr& server, const int64_t cluster_id,
|
||||
const bool need_send_confirm_info, const int64_t network_limit, ObGetCursorResult& result,
|
||||
uint64_t& cursor_start_log_id);
|
||||
int send_keepalive_msg_to_children_(
|
||||
const uint64_t next_log_id, const int64_t next_log_ts_lb, const uint64_t deliver_cnt) const;
|
||||
int send_keepalive_msg_to_mlist_(
|
||||
const uint64_t next_log_id, const int64_t next_log_ts_lb, const uint64_t deliver_cnt) const;
|
||||
int send_archive_progress_msg_to_children_(const ObPGLogArchiveStatus& status) const;
|
||||
int send_max_log_msg_to_children_(
|
||||
const int64_t switchover_epoch, const uint64_t leader_max_log_id, const int64_t leader_next_log_ts) const;
|
||||
int send_max_log_msg_to_mlist_(
|
||||
const int64_t switchover_epoch, const uint64_t leader_max_log_id, const int64_t leader_next_log_ts) const;
|
||||
int process_reject_msg(const common::ObAddr &server, const int32_t msg_type, const int64_t timestamp) override;
|
||||
int process_reregister_msg(const common::ObAddr &src_server,
|
||||
const share::ObCascadMember &new_leader,
|
||||
const int64_t send_ts) override;
|
||||
int process_restore_alive_msg(const common::ObAddr &server,
|
||||
const uint64_t start_log_id) override;
|
||||
int process_restore_alive_req(const common::ObAddr &server,
|
||||
const int64_t dst_cluster_id,
|
||||
const int64_t send_ts) override;
|
||||
int process_restore_alive_resp(const common::ObAddr &server,
|
||||
const int64_t send_ts) override;
|
||||
int process_restore_log_finish_msg(const common::ObAddr &src_server,
|
||||
const uint64_t log_id) override;
|
||||
int resp_sw_info_when_get_log_(const common::ObAddr &server, const int64_t cluster_id);
|
||||
int internal_fetch_log_(const uint64_t start_log_id,
|
||||
const uint64_t end_log_id,
|
||||
const ObFetchLogType &fetch_type,
|
||||
const ObProposalID &proposal_id,
|
||||
const common::ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const uint32_t log_attr,
|
||||
const bool need_send_confirm_info,
|
||||
const int64_t network_limit);
|
||||
int fetch_log_from_sw_(const uint64_t log_id,
|
||||
const ObFetchLogType &fetch_type,
|
||||
const ObProposalID &proposal_id,
|
||||
const common::ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const uint32_t log_attr,
|
||||
const bool need_send_confirm_info,
|
||||
const int64_t network_limit);
|
||||
int fetch_log_from_ilog_storage_(const uint64_t log_id,
|
||||
const ObFetchLogType &fetch_type,
|
||||
const ObProposalID &proposal_id,
|
||||
const common::ObAddr &server,
|
||||
const int64_t cluster_id,
|
||||
const bool need_send_confirm_info,
|
||||
const int64_t network_limit,
|
||||
ObGetCursorResult &result,
|
||||
uint64_t &cursor_start_log_id);
|
||||
int send_keepalive_msg_to_children_(const uint64_t next_log_id, const int64_t next_log_ts_lb, const uint64_t deliver_cnt) const;
|
||||
int send_keepalive_msg_to_mlist_(const uint64_t next_log_id, const int64_t next_log_ts_lb, const uint64_t deliver_cnt) const;
|
||||
int send_archive_progress_msg_to_children_(const ObPGLogArchiveStatus &status) const;
|
||||
int send_max_log_msg_to_children_(const int64_t switchover_epoch, const uint64_t leader_max_log_id, const int64_t leader_next_log_ts) const;
|
||||
int send_max_log_msg_to_mlist_(const int64_t switchover_epoch, const uint64_t leader_max_log_id, const int64_t leader_next_log_ts) const;
|
||||
bool is_paxos_offline_replica_() const;
|
||||
bool is_no_update_next_replay_log_id_info_too_long_() const;
|
||||
int check_state_();
|
||||
|
@ -135,104 +135,77 @@ class ObIElectionTimerP {
|
||||
|
||||
class ObElection : public ObIElection, public ObIElectionTimerP, public ObElectionInfo {
|
||||
typedef ObElectionEventHistory::EventType EventType;
|
||||
|
||||
public:
|
||||
ObElection() : lock_(common::ObLatchIds::ELECTION_LOCK)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
~ObElection()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
int init(const common::ObPartitionKey& partition, const common::ObAddr& self, ObIElectionRpc* rpc,
|
||||
common::ObTimeWheel* tw, const int64_t replica_num, ObIElectionCallback* election_cb, ObIElectionGroupMgr* eg_mgr,
|
||||
ObElectionEventHistoryArray* event_history_array);
|
||||
void destroy();
|
||||
public:
|
||||
ObElection()
|
||||
: lock_(common::ObLatchIds::ELECTION_LOCK)
|
||||
{ reset(); }
|
||||
~ObElection() { destroy(); }
|
||||
int init(const common::ObPartitionKey &partition, const common::ObAddr &self,
|
||||
ObIElectionRpc *rpc, common::ObTimeWheel *tw, const int64_t replica_num,
|
||||
ObIElectionCallback *election_cb, ObIElectionGroupMgr *eg_mgr,
|
||||
ObElectionEventHistoryArray *event_history_array) override;
|
||||
void destroy() override;
|
||||
void reset();
|
||||
int start();
|
||||
int stop();
|
||||
|
||||
public:
|
||||
int handle_devote_prepare(const ObElectionMsgDEPrepare& msg, obrpc::ObElectionRpcResult& result);
|
||||
int handle_devote_vote(const ObElectionMsgDEVote& msg, obrpc::ObElectionRpcResult& result);
|
||||
int handle_devote_success(const ObElectionMsgDESuccess& msg, obrpc::ObElectionRpcResult& result);
|
||||
int handle_vote_prepare(const ObElectionMsgPrepare& msg, obrpc::ObElectionRpcResult& result);
|
||||
int handle_vote_vote(const ObElectionMsgVote& msg, obrpc::ObElectionRpcResult& result);
|
||||
int handle_vote_success(const ObElectionMsgSuccess& msg, obrpc::ObElectionRpcResult& result);
|
||||
int handle_query_leader(const ObElectionQueryLeader& msg, obrpc::ObElectionRpcResult& result);
|
||||
int handle_query_leader_response(const ObElectionQueryLeaderResponse& msg, obrpc::ObElectionRpcResult& result);
|
||||
|
||||
public:
|
||||
int set_candidate(
|
||||
const int64_t replica_num, const common::ObMemberList& curr_mlist, const int64_t membership_version);
|
||||
int change_leader_async(const common::ObAddr& leader, common::ObTsWindows& changing_leader_windows);
|
||||
int start() override;
|
||||
int stop() override;
|
||||
public:
|
||||
int handle_devote_prepare(const ObElectionMsgDEPrepare &msg, obrpc::ObElectionRpcResult &result) override;
|
||||
int handle_devote_vote(const ObElectionMsgDEVote &msg, obrpc::ObElectionRpcResult &result) override;
|
||||
int handle_devote_success(const ObElectionMsgDESuccess &msg, obrpc::ObElectionRpcResult &result) override;
|
||||
int handle_vote_prepare(const ObElectionMsgPrepare &msg, obrpc::ObElectionRpcResult &result) override;
|
||||
int handle_vote_vote(const ObElectionMsgVote &msg, obrpc::ObElectionRpcResult &result) override;
|
||||
int handle_vote_success(const ObElectionMsgSuccess &msg, obrpc::ObElectionRpcResult &result) override;
|
||||
int handle_query_leader(const ObElectionQueryLeader &msg, obrpc::ObElectionRpcResult &result) override;
|
||||
int handle_query_leader_response(const ObElectionQueryLeaderResponse &msg,obrpc::ObElectionRpcResult &result) override;
|
||||
public:
|
||||
int set_candidate(const int64_t replica_num, const common::ObMemberList &curr_mlist, const int64_t membership_version) override;
|
||||
int change_leader_async(const common::ObAddr &leader, common::ObTsWindows &changing_leader_windows) override;
|
||||
int change_leader_to_self_async() override;
|
||||
int force_leader_async();
|
||||
int get_curr_candidate(common::ObMemberList& mlist) const;
|
||||
int get_valid_candidate(common::ObMemberList& mlist) const;
|
||||
int get_leader(common::ObAddr& leader, common::ObAddr& previous_leader, int64_t& leader_epoch,
|
||||
bool& is_elected_by_changing_leader) const;
|
||||
int get_leader(common::ObAddr& leader, int64_t& leader_epoch, bool& is_elected_by_changing_leader,
|
||||
common::ObTsWindows& changing_leader_windows) const;
|
||||
int get_current_leader(common::ObAddr& leader) const;
|
||||
int get_election_info(ObElectionInfo& election_info) const;
|
||||
void leader_revoke(const uint32_t revoke_type);
|
||||
int inc_replica_num();
|
||||
int dec_replica_num();
|
||||
int set_replica_num(const int64_t replica_num);
|
||||
int64_t get_election_time_offset() const
|
||||
{
|
||||
return get_election_time_offset_();
|
||||
}
|
||||
static bool is_valid_leader_epoch(const int64_t leader_epoch)
|
||||
{
|
||||
return leader_epoch > 0;
|
||||
}
|
||||
|
||||
public:
|
||||
int leader_takeover(const common::ObAddr& leader, const int64_t lease_start, int64_t& leader_epoch);
|
||||
int64_t get_current_ts() const;
|
||||
int get_priority(ObElectionPriority& priority) const;
|
||||
int get_timestamp(int64_t& gts, common::ObAddr& leader) const;
|
||||
int move_out_election_group(const ObElectionGroupId& eg_id);
|
||||
int move_into_election_group(const ObElectionGroupId& eg_id);
|
||||
int64_t get_replica_num() const
|
||||
{
|
||||
return replica_num_;
|
||||
}
|
||||
uint64_t get_eg_id_hash() const
|
||||
{
|
||||
return eg_id_.hash();
|
||||
}
|
||||
const lease_t& get_leader_lease() const
|
||||
{
|
||||
return leader_lease_;
|
||||
}
|
||||
uint64_t hash() const;
|
||||
int64_t get_last_leader_revoke_time() const
|
||||
{
|
||||
return ATOMIC_LOAD(&last_leader_revoke_time_);
|
||||
}
|
||||
int force_leader_async() override;
|
||||
int get_curr_candidate(common::ObMemberList &mlist) const override;
|
||||
int get_valid_candidate(common::ObMemberList &mlist) const override;
|
||||
int get_leader(common::ObAddr &leader, common::ObAddr &previous_leader,
|
||||
int64_t &leader_epoch, bool &is_elected_by_changing_leader) const override;
|
||||
int get_leader(common::ObAddr &leader, int64_t &leader_epoch,
|
||||
bool &is_elected_by_changing_leader, common::ObTsWindows &changing_leader_windows) const override;
|
||||
int get_current_leader(common::ObAddr &leader) const override;
|
||||
int get_election_info(ObElectionInfo &election_info) const override;
|
||||
void leader_revoke(const uint32_t revoke_type) override;
|
||||
int inc_replica_num() override;
|
||||
int dec_replica_num() override;
|
||||
int set_replica_num(const int64_t replica_num) override;
|
||||
int64_t get_election_time_offset() const override { return get_election_time_offset_(); }
|
||||
static bool is_valid_leader_epoch(const int64_t leader_epoch) { return leader_epoch > 0; }
|
||||
public:
|
||||
int leader_takeover(const common::ObAddr &leader, const int64_t lease_start, int64_t &leader_epoch) override;
|
||||
int64_t get_current_ts() const override;
|
||||
int get_priority(ObElectionPriority &priority) const override;
|
||||
int get_timestamp(int64_t >s, common::ObAddr &leader) const override;
|
||||
int move_out_election_group(const ObElectionGroupId &eg_id) override;
|
||||
int move_into_election_group(const ObElectionGroupId &eg_id) override;
|
||||
int64_t get_replica_num() const override { return replica_num_; }
|
||||
uint64_t get_eg_id_hash() const override { return eg_id_.hash(); }
|
||||
const lease_t &get_leader_lease() const override { return leader_lease_; }
|
||||
uint64_t hash() const override;
|
||||
int64_t get_last_leader_revoke_time() const override { return ATOMIC_LOAD(&last_leader_revoke_time_); }
|
||||
|
||||
public:
|
||||
TO_STRING_AND_YSON(Y_(partition), Y_(is_running), Y_(is_changing_leader), Y_(self), Y_(proposal_leader),
|
||||
OB_ID(cur_leader), current_leader_, Y_(curr_candidates), Y_(curr_membership_version), Y_(leader_lease),
|
||||
Y_(election_time_offset), Y_(active_timestamp), Y_(T1_timestamp), Y_(leader_epoch), Y_(state), Y_(role),
|
||||
Y_(stage), Y_(type), Y_(replica_num), Y_(unconfirmed_leader), Y_(unconfirmed_leader_lease),
|
||||
Y_(takeover_t1_timestamp), Y_(is_need_query), Y_(valid_candidates), Y_(change_leader_timestamp), Y_(ignore_log),
|
||||
Y_(leader_revoke_timestamp), Y_(vote_period), Y_(lease_time), Y_(move_out_timestamp), OB_ID(eg_part_array_idx),
|
||||
eg_part_array_idx_, OB_ID(eg_id_hash), eg_id_.hash());
|
||||
|
||||
public:
|
||||
void run_gt1_task(const int64_t expect_ts);
|
||||
void run_gt2_task(const int64_t expect_ts);
|
||||
void run_gt3_task(const int64_t expect_ts);
|
||||
void run_gt4_task(const int64_t expect_ts);
|
||||
void run_change_leader_task(const int64_t expect_ts);
|
||||
|
||||
public:
|
||||
/**********should removed after a barrier version bigger than 3.1**********/
|
||||
OB_ID(cur_leader), current_leader_, Y_(curr_candidates), Y_(curr_membership_version),
|
||||
Y_(leader_lease), Y_(election_time_offset), Y_(active_timestamp), Y_(T1_timestamp),
|
||||
Y_(leader_epoch), Y_(state), Y_(role), Y_(stage), Y_(type), Y_(replica_num),
|
||||
Y_(unconfirmed_leader), Y_(unconfirmed_leader_lease), Y_(takeover_t1_timestamp), Y_(is_need_query),
|
||||
Y_(valid_candidates), Y_(change_leader_timestamp), Y_(ignore_log),
|
||||
Y_(leader_revoke_timestamp), Y_(vote_period), Y_(lease_time), Y_(move_out_timestamp),
|
||||
OB_ID(eg_part_array_idx), eg_part_array_idx_, OB_ID(eg_id_hash), eg_id_.hash());
|
||||
public:
|
||||
void run_gt1_task(const int64_t expect_ts) override;
|
||||
void run_gt2_task(const int64_t expect_ts) override;
|
||||
void run_gt3_task(const int64_t expect_ts) override;
|
||||
void run_gt4_task(const int64_t expect_ts) override;
|
||||
void run_change_leader_task(const int64_t expect_ts) override;
|
||||
public:
|
||||
/**********should removed after a barrier version bigger than 3.1**********/
|
||||
static bool IS_CLUSTER_MIN_VSERDION_LESS_THAN_3_1;
|
||||
/**************************************************************************************************/
|
||||
enum RevokeType {
|
||||
|
@ -24,8 +24,8 @@ static int ez2ob_addr(ObAddr& addr, easy_addr_t ez_addr)
|
||||
int ret = OB_SUCCESS;
|
||||
addr.reset();
|
||||
if (AF_INET == ez_addr.family) {
|
||||
(void*)addr.set_ipv4_addr(ntohl(ez_addr.u.addr), ntohs(ez_addr.port));
|
||||
} else if (AF_INET6 == ez_addr.family) { // ipv6
|
||||
addr.set_ipv4_addr(ntohl(ez_addr.u.addr), ntohs(ez_addr.port));
|
||||
} else if (AF_INET6 == ez_addr.family) { // ipv6
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
}
|
||||
return ret;
|
||||
|
@ -55,23 +55,23 @@ class ObThWorker : public share::ObWorker, public lib::CoKThread {
|
||||
void worker(int64_t& tenant_id, int64_t& req_recv_timestamp, int32_t& worker_level);
|
||||
inline void set_group(ObResourceGroup* group);
|
||||
|
||||
void run(int64_t idx);
|
||||
void run(int64_t idx) override;
|
||||
|
||||
void resume();
|
||||
void resume() override;
|
||||
void pause();
|
||||
|
||||
Status check_qtime_throttle();
|
||||
Status check_throttle();
|
||||
Status check_rate_limiter();
|
||||
virtual ObThWorker::Status check_wait();
|
||||
virtual ObThWorker::Status check_wait() override;
|
||||
virtual int check_status() override;
|
||||
virtual int check_large_query_quota();
|
||||
virtual int check_large_query_quota() override;
|
||||
|
||||
// retry relating
|
||||
virtual bool need_retry() const;
|
||||
virtual void disable_retry();
|
||||
virtual bool set_retry_flag();
|
||||
virtual void reset_retry_flag();
|
||||
virtual bool need_retry() const override;
|
||||
virtual void disable_retry() override;
|
||||
virtual bool set_retry_flag() override;
|
||||
virtual void reset_retry_flag() override;
|
||||
|
||||
// active relating
|
||||
void wait_active();
|
||||
|
@ -1093,7 +1093,7 @@ int ObCreateTableReplicaByLocality::alloc_non_part_multiple_zone_paxos_replica(c
|
||||
int64_t tmp = 0;
|
||||
int64_t leader_id = 0;
|
||||
const int64_t zone_list_count = alive_zone_list.count();
|
||||
for (tmp; tmp < alive_zone_list.count() && OB_SUCC(ret); ++tmp) {
|
||||
for (; tmp < alive_zone_list.count() && OB_SUCC(ret); ++tmp) {
|
||||
// Find the first replica that can become the leader
|
||||
if (curr_part_task_array_.at(tmp).replica_type_ == REPLICA_TYPE_FULL &&
|
||||
curr_part_task_array_.at(tmp).memstore_percent_ != 0) {
|
||||
|
@ -22286,8 +22286,8 @@ int ObDDLService::get_tenant_primary_zone_entity_count(
|
||||
LOG_WARN("database schema is null", K(ret));
|
||||
} else if (tablegroup_schema->get_primary_zone().empty()) {
|
||||
// go on next
|
||||
} else {
|
||||
pz_entity_count;
|
||||
}else {
|
||||
++pz_entity_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -208,14 +208,17 @@ class ObGlobalIndexBuilder : public ObRsReentrantThread, public sql::ObIndexSSTa
|
||||
|
||||
public:
|
||||
virtual void run3() override;
|
||||
virtual int blocking_run()
|
||||
{
|
||||
BLOCKING_RUN_IMPLEMENT();
|
||||
}
|
||||
int init(obrpc::ObSrvRpcProxy* rpc_proxy, common::ObMySQLProxy* mysql_proxy, rootserver::ObServerManager* server_mgr,
|
||||
share::ObPartitionTableOperator* pt_operator, rootserver::ObRebalanceTaskMgr* rebalance_task_mgr,
|
||||
rootserver::ObDDLService* ddl_service, share::schema::ObMultiVersionSchemaService* schema_service,
|
||||
rootserver::ObZoneManager* zone_mgr, rootserver::ObFreezeInfoManager* freeze_info_manager);
|
||||
virtual int blocking_run() override { BLOCKING_RUN_IMPLEMENT(); }
|
||||
int init(
|
||||
obrpc::ObSrvRpcProxy *rpc_proxy,
|
||||
common::ObMySQLProxy *mysql_proxy,
|
||||
rootserver::ObServerManager *server_mgr,
|
||||
share::ObPartitionTableOperator *pt_operator,
|
||||
rootserver::ObRebalanceTaskMgr *rebalance_task_mgr,
|
||||
rootserver::ObDDLService *ddl_service,
|
||||
share::schema::ObMultiVersionSchemaService *schema_service,
|
||||
rootserver::ObZoneManager *zone_mgr,
|
||||
rootserver::ObFreezeInfoManager *freeze_info_manager);
|
||||
int reload_building_indexes();
|
||||
int on_build_single_replica_reply(const uint64_t index_table_id, int64_t snapshot, int ret_code);
|
||||
int on_col_checksum_calculation_reply(
|
||||
@ -223,18 +226,22 @@ class ObGlobalIndexBuilder : public ObRsReentrantThread, public sql::ObIndexSSTa
|
||||
int on_check_unique_index_reply(const common::ObPartitionKey& pkey, const int ret_code, const bool is_unique);
|
||||
int on_copy_multi_replica_reply(const ObRebalanceTask& rebalance_task);
|
||||
virtual int pick_data_replica(
|
||||
const common::ObPartitionKey& pkey, const common::ObIArray<common::ObAddr>& previous, common::ObAddr& server);
|
||||
const common::ObPartitionKey &pkey,
|
||||
const common::ObIArray<common::ObAddr> &previous,
|
||||
common::ObAddr &server) override;
|
||||
virtual int pick_index_replica(
|
||||
const common::ObPartitionKey& pkey, const common::ObIArray<common::ObAddr>& previous, common::ObAddr& server);
|
||||
int submit_build_global_index_task(const share::schema::ObTableSchema* index_schema);
|
||||
void stop();
|
||||
|
||||
private:
|
||||
static const int64_t BUILD_SINGLE_REPLICA_TIMEOUT = 2LL * 3600LL * 1000000LL; // 2h
|
||||
static const int64_t COPY_MULTI_REPLICA_TIMEOUT = 2LL * 3600LL * 1000000LL; // 2h
|
||||
static const int64_t UNIQUE_INDEX_CHECK_TIMEOUT = 2LL * 3600LL * 1000000LL; // 2h
|
||||
static const int64_t UNIQUE_INDEX_CALC_CHECKSUM_TIMEOUT = 2LL * 3600LL * 1000000LL; // 2h
|
||||
static const int64_t TASK_RETRY_TIME_INTERVAL_US = 10LL * 1000000LL; // 10s
|
||||
const common::ObPartitionKey &pkey,
|
||||
const common::ObIArray<common::ObAddr> &previous,
|
||||
common::ObAddr &server) override;
|
||||
int submit_build_global_index_task(
|
||||
const share::schema::ObTableSchema *index_schema);
|
||||
void stop() override;
|
||||
private:
|
||||
static const int64_t BUILD_SINGLE_REPLICA_TIMEOUT = 2LL * 3600LL * 1000000LL; // 2h
|
||||
static const int64_t COPY_MULTI_REPLICA_TIMEOUT = 2LL * 3600LL * 1000000LL; // 2h
|
||||
static const int64_t UNIQUE_INDEX_CHECK_TIMEOUT = 2LL * 3600LL * 1000000LL; // 2h
|
||||
static const int64_t UNIQUE_INDEX_CALC_CHECKSUM_TIMEOUT = 2LL * 3600LL * 1000000LL; // 2h
|
||||
static const int64_t TASK_RETRY_TIME_INTERVAL_US = 10LL * 1000000LL; // 10s
|
||||
static const int64_t COPY_MULTI_REPLICA_RETRY_UPPER_LMT = 3;
|
||||
static const int64_t THREAD_CNT = 1;
|
||||
static const int64_t TASK_MAP_BUCKET_NUM = 256;
|
||||
|
@ -64,20 +64,14 @@ class ObLogArchiveScheduler final : public ObRsReentrantThread, public ObIBackup
|
||||
obrpc::ObSrvRpcProxy& rpc_proxy, common::ObMySQLProxy& sql_proxy,
|
||||
share::ObIBackupLeaseService& backup_lease_info);
|
||||
void set_active();
|
||||
void stop();
|
||||
void stop() override;
|
||||
void wakeup();
|
||||
|
||||
int handle_enable_log_archive(const bool is_enable);
|
||||
virtual void run3() override;
|
||||
virtual int blocking_run() override
|
||||
{
|
||||
BLOCKING_RUN_IMPLEMENT();
|
||||
}
|
||||
int start();
|
||||
virtual bool is_working() const
|
||||
{
|
||||
return is_working_;
|
||||
}
|
||||
virtual int blocking_run() override { BLOCKING_RUN_IMPLEMENT(); }
|
||||
int start() override;
|
||||
virtual bool is_working() const override { return is_working_; }
|
||||
|
||||
private:
|
||||
void cleanup_();
|
||||
|
@ -37,20 +37,14 @@ class ObRsReentrantThread : public share::ObReentrantThread {
|
||||
}
|
||||
virtual void run3() = 0;
|
||||
|
||||
// Set RS thread properties
|
||||
virtual int before_blocking_run()
|
||||
{
|
||||
common::ObThreadFlags::set_rs_flag();
|
||||
return common::OB_SUCCESS;
|
||||
}
|
||||
//Set RS thread properties
|
||||
virtual int before_blocking_run() override
|
||||
{ common::ObThreadFlags::set_rs_flag(); return common::OB_SUCCESS; }
|
||||
|
||||
virtual int after_blocking_run()
|
||||
{
|
||||
common::ObThreadFlags::cancel_rs_flag();
|
||||
return common::OB_SUCCESS;
|
||||
}
|
||||
|
||||
// check thread
|
||||
virtual int after_blocking_run() override
|
||||
{ common::ObThreadFlags::cancel_rs_flag(); return common::OB_SUCCESS; }
|
||||
|
||||
//check thread
|
||||
static CheckThreadSet check_thread_set_;
|
||||
static void check_alert(const ObRsReentrantThread& thread);
|
||||
|
||||
@ -65,8 +59,8 @@ class ObRsReentrantThread : public share::ObReentrantThread {
|
||||
|
||||
int create(const int64_t thread_cnt, const char* name = nullptr);
|
||||
int destroy();
|
||||
void stop();
|
||||
void wait();
|
||||
void stop() override;
|
||||
void wait() override;
|
||||
TO_STRING_KV("name", get_thread_name());
|
||||
|
||||
private:
|
||||
|
@ -25,10 +25,7 @@ class ObRsThreadChecker : public ObRsReentrantThread {
|
||||
virtual ~ObRsThreadChecker();
|
||||
|
||||
virtual void run3() override;
|
||||
virtual int blocking_run()
|
||||
{
|
||||
BLOCKING_RUN_IMPLEMENT();
|
||||
}
|
||||
virtual int blocking_run() override { BLOCKING_RUN_IMPLEMENT(); }
|
||||
|
||||
int init();
|
||||
void check_loop();
|
||||
|
@ -212,14 +212,10 @@ class ObHeartbeatChecker : public ObRsReentrantThread {
|
||||
virtual ~ObHeartbeatChecker();
|
||||
|
||||
virtual void run3() override;
|
||||
virtual int blocking_run()
|
||||
{
|
||||
BLOCKING_RUN_IMPLEMENT();
|
||||
}
|
||||
int64_t get_schedule_interval() const;
|
||||
|
||||
private:
|
||||
static const int64_t CHECK_INTERVAL_US = 100 * 1000L; // 100ms
|
||||
virtual int blocking_run() override { BLOCKING_RUN_IMPLEMENT(); }
|
||||
int64_t get_schedule_interval() const override;
|
||||
private:
|
||||
static const int64_t CHECK_INTERVAL_US = 100 * 1000L; //100ms
|
||||
bool inited_;
|
||||
ObServerManager* server_manager_;
|
||||
};
|
||||
|
@ -171,53 +171,49 @@ class ObZoneManager : public ObZoneManagerBase {
|
||||
ObZoneManager();
|
||||
virtual ~ObZoneManager();
|
||||
|
||||
int init(common::ObMySQLProxy& proxy, ObILeaderCoordinator& leader_coordinator);
|
||||
virtual int reload();
|
||||
virtual int add_zone(const common::ObZone& zone, const common::ObRegion& region, const common::ObIDC& idc,
|
||||
const common::ObZoneType& zone_type);
|
||||
virtual int delete_zone(const common::ObZone& zone);
|
||||
virtual int start_zone(const common::ObZone& zone);
|
||||
virtual int stop_zone(const common::ObZone& zone);
|
||||
virtual int alter_zone(const obrpc::ObAdminZoneArg& arg) override;
|
||||
int init(common::ObMySQLProxy &proxy,
|
||||
ObILeaderCoordinator &leader_coordinator);
|
||||
virtual int reload() override;
|
||||
virtual int add_zone(const common::ObZone &zone, const common::ObRegion ®ion,
|
||||
const common::ObIDC &idc, const common::ObZoneType &zone_type) override;
|
||||
virtual int delete_zone(const common::ObZone &zone) override;
|
||||
virtual int start_zone(const common::ObZone &zone) override;
|
||||
virtual int stop_zone(const common::ObZone &zone) override;
|
||||
virtual int alter_zone(const obrpc::ObAdminZoneArg &arg) override;
|
||||
|
||||
virtual int set_merge_error(const int64_t merge_error);
|
||||
virtual int try_update_global_last_merged_version();
|
||||
virtual int generate_next_global_broadcast_version();
|
||||
virtual int set_merge_error(const int64_t merge_error) override;
|
||||
virtual int try_update_global_last_merged_version() override;
|
||||
virtual int generate_next_global_broadcast_version() override;
|
||||
|
||||
virtual int set_zone_merging(const common::ObZone& zone);
|
||||
virtual int inc_start_merge_fail_times(const common::ObZone& zone);
|
||||
virtual int clear_zone_merging(const common::ObZone& zone);
|
||||
virtual int start_zone_merge(const common::ObZone& zone);
|
||||
virtual int finish_zone_merge(
|
||||
const common::ObZone& zone, const int64_t merged_version, const int64_t all_merged_version);
|
||||
virtual int set_zone_merge_timeout(const common::ObZone& zone);
|
||||
virtual int set_zone_merging(const common::ObZone &zone) override;
|
||||
virtual int inc_start_merge_fail_times(const common::ObZone &zone) override;
|
||||
virtual int clear_zone_merging(const common::ObZone &zone) override;
|
||||
virtual int start_zone_merge(const common::ObZone &zone) override;
|
||||
virtual int finish_zone_merge(const common::ObZone &zone,
|
||||
const int64_t merged_version, const int64_t all_merged_version) override;
|
||||
virtual int set_zone_merge_timeout(const common::ObZone &zone) override;
|
||||
|
||||
virtual int update_privilege_version(const int64_t privilege_version);
|
||||
virtual int update_config_version(const int64_t config_version);
|
||||
virtual int update_privilege_version(const int64_t privilege_version) override;
|
||||
virtual int update_config_version(const int64_t config_version) override;
|
||||
|
||||
virtual int update_proposal_frozen_version(const int64_t proposal_frozen_version);
|
||||
virtual int set_frozen_info(const int64_t frozen_version, const int64_t frozen_time);
|
||||
virtual int set_frozen_info(
|
||||
common::ObISQLClient& sql_client, const int64_t frozen_version, const int64_t frozen_time);
|
||||
virtual int set_try_frozen_version(const int64_t try_frozen_version);
|
||||
virtual int update_proposal_frozen_version(const int64_t proposal_frozen_version) override;
|
||||
virtual int set_frozen_info(const int64_t frozen_version, const int64_t frozen_time) override;
|
||||
virtual int set_frozen_info(common::ObISQLClient &sql_client, const int64_t frozen_version, const int64_t frozen_time) override;
|
||||
virtual int set_try_frozen_version(const int64_t try_frozen_version) override;
|
||||
|
||||
virtual int check_merge_order(const common::ObString& list_str);
|
||||
virtual int check_merge_order(const common::ObIArray<common::ObZone>& merge_list);
|
||||
virtual int check_merge_order(const common::ObString &list_str) override;
|
||||
virtual int check_merge_order(const common::ObIArray<common::ObZone> &merge_list) override;
|
||||
|
||||
virtual int suspend_merge(const common::ObZone& zone);
|
||||
virtual int resume_merge(const common::ObZone& zone);
|
||||
virtual int suspend_merge(const common::ObZone &zone) override;
|
||||
virtual int resume_merge(const common::ObZone &zone) override;
|
||||
|
||||
virtual int reset_global_merge_status();
|
||||
virtual int set_warm_up_start_time(const int64_t time_ts);
|
||||
std::default_random_engine& get_random_engine()
|
||||
{
|
||||
return random_;
|
||||
}
|
||||
virtual int renew_snapshot_gc_ts();
|
||||
virtual int reset_global_merge_status() override;
|
||||
virtual int set_warm_up_start_time(const int64_t time_ts) override;
|
||||
std::default_random_engine &get_random_engine() { return random_; }
|
||||
virtual int renew_snapshot_gc_ts() override;
|
||||
|
||||
virtual int set_storage_format_version(const int64_t version);
|
||||
|
||||
public:
|
||||
virtual int set_storage_format_version(const int64_t version) override;
|
||||
public:
|
||||
class ObZoneManagerShadowGuard {
|
||||
public:
|
||||
ObZoneManagerShadowGuard(
|
||||
|
40
src/share/cache/ob_kv_storecache.h
vendored
40
src/share/cache/ob_kv_storecache.h
vendored
@ -54,14 +54,23 @@ class ObKVCache : public ObIKVCache<Key, Value> {
|
||||
int init(const char* cache_name, const int64_t priority = 1);
|
||||
void destroy();
|
||||
int set_priority(const int64_t priority);
|
||||
virtual int put(const Key& key, const Value& value, bool overwrite = true);
|
||||
virtual int put(const Key &key, const Value &value, bool overwrite = true) override;
|
||||
virtual int put_and_fetch(
|
||||
const Key& key, const Value& value, const Value*& pvalue, ObKVCacheHandle& handle, bool overwrite = true);
|
||||
virtual int get(const Key& key, const Value*& pvalue, ObKVCacheHandle& handle);
|
||||
int get_iterator(ObKVCacheIterator& iter);
|
||||
virtual int erase(const Key& key);
|
||||
virtual int alloc(const uint64_t tenant_id, const int64_t key_size, const int64_t value_size, ObKVCachePair*& kvpair,
|
||||
ObKVCacheHandle& handle, ObKVCacheInstHandle& inst_handle) override;
|
||||
const Key &key,
|
||||
const Value &value,
|
||||
const Value *&pvalue,
|
||||
ObKVCacheHandle &handle,
|
||||
bool overwrite = true) override;
|
||||
virtual int get(const Key &key, const Value *&pvalue, ObKVCacheHandle &handle) override;
|
||||
int get_iterator(ObKVCacheIterator &iter);
|
||||
virtual int erase(const Key &key) override;
|
||||
virtual int alloc(
|
||||
const uint64_t tenant_id,
|
||||
const int64_t key_size,
|
||||
const int64_t value_size,
|
||||
ObKVCachePair *&kvpair,
|
||||
ObKVCacheHandle &handle,
|
||||
ObKVCacheInstHandle &inst_handle) override;
|
||||
int64_t size(const uint64_t tenant_id = OB_SYS_TENANT_ID) const;
|
||||
int64_t count(const uint64_t tenant_id = OB_SYS_TENANT_ID) const;
|
||||
int64_t get_hit_cnt(const uint64_t tenant_id = OB_SYS_TENANT_ID) const;
|
||||
@ -98,14 +107,15 @@ class ObCacheWorkingSet : public ObIKVCache<Key, Value> {
|
||||
{
|
||||
return working_set_->get_used();
|
||||
}
|
||||
int64_t get_limit() const
|
||||
{
|
||||
return working_set_->get_limit();
|
||||
}
|
||||
virtual int alloc(const uint64_t tenant_id, const int64_t key_size, const int64_t value_size, ObKVCachePair*& kvpair,
|
||||
ObKVCacheHandle& handle, ObKVCacheInstHandle& inst_handle) override;
|
||||
|
||||
private:
|
||||
int64_t get_limit() const { return working_set_->get_limit(); }
|
||||
virtual int alloc(
|
||||
const uint64_t tenant_id,
|
||||
const int64_t key_size,
|
||||
const int64_t value_size,
|
||||
ObKVCachePair *&kvpair,
|
||||
ObKVCacheHandle &handle,
|
||||
ObKVCacheInstHandle &inst_handle) override;
|
||||
private:
|
||||
bool inited_;
|
||||
uint64_t tenant_id_;
|
||||
ObKVCache<Key, Value>* cache_;
|
||||
|
@ -34,17 +34,18 @@ class ObInnerConfigRootAddr : public ObRootAddrAgent {
|
||||
|
||||
int init(common::ObMySQLProxy& sql_proxy, common::ObServerConfig& config);
|
||||
|
||||
virtual int store(const ObIAddrList& addr_list, const ObIAddrList& readonly_addr_list, const bool force,
|
||||
const common::ObClusterType cluster_type, const int64_t timestamp);
|
||||
virtual int fetch(ObIAddrList& add_list, ObIAddrList& readonly_addr_list, common::ObClusterType& cluster_typ);
|
||||
// innerconfig does not need to support delete cluster operations
|
||||
virtual int delete_cluster(const int64_t cluster_id)
|
||||
{
|
||||
UNUSED(cluster_id);
|
||||
return common::OB_SUCCESS;
|
||||
}
|
||||
virtual int fetch_remote_rslist(const int64_t cluster_id, ObIAddrList& addr_list, ObIAddrList& readonly_addr_list,
|
||||
common::ObClusterType& cluster_type) override;
|
||||
|
||||
virtual int store(const ObIAddrList &addr_list, const ObIAddrList &readonly_addr_list,
|
||||
const bool force, const common::ObClusterType cluster_type,
|
||||
const int64_t timestamp) override;
|
||||
virtual int fetch(ObIAddrList &add_list, ObIAddrList &readonly_addr_list,
|
||||
common::ObClusterType &cluster_typ) override;
|
||||
//innerconfig does not need to support delete cluster operations
|
||||
virtual int delete_cluster(const int64_t cluster_id) override { UNUSED(cluster_id); return common::OB_SUCCESS; }
|
||||
virtual int fetch_remote_rslist(const int64_t cluster_id,
|
||||
ObIAddrList &addr_list,
|
||||
ObIAddrList &readonly_addr_list,
|
||||
common::ObClusterType &cluster_type) override;
|
||||
|
||||
static int format_rootservice_list(const ObIAddrList& addr_list, common::ObSqlString& str);
|
||||
|
||||
|
@ -62,16 +62,18 @@ class ObRemoteServerProvider : public common::sqlclient::ObMySQLServerProvider {
|
||||
public:
|
||||
ObRemoteServerProvider();
|
||||
virtual ~ObRemoteServerProvider();
|
||||
int init(obrpc::ObCommonRpcProxy& rpc_proxy, common::ObMySQLProxy& sql_proxy);
|
||||
virtual int get_cluster_list(common::ObIArray<int64_t>& cluster_list);
|
||||
virtual int get_server(const int64_t cluster_id, const int64_t svr_idx, common::ObAddr& server);
|
||||
virtual int64_t get_cluster_count() const;
|
||||
virtual int64_t get_server_count() const;
|
||||
virtual int64_t get_server_count(const int64_t cluster_id) const;
|
||||
virtual int refresh_server_list(void);
|
||||
int init(obrpc::ObCommonRpcProxy &rpc_proxy, common::ObMySQLProxy &sql_proxy);
|
||||
virtual int get_cluster_list(common::ObIArray<int64_t> &cluster_list) override;
|
||||
virtual int get_server(const int64_t cluster_id,
|
||||
const int64_t svr_idx,
|
||||
common::ObAddr &server) override;
|
||||
virtual int64_t get_cluster_count() const override;
|
||||
virtual int64_t get_server_count() const override;
|
||||
virtual int64_t get_server_count(const int64_t cluster_id) const override;
|
||||
virtual int refresh_server_list(void) override;
|
||||
virtual int prepare_refresh() override;
|
||||
int64_t get_primary_cluster_id() const;
|
||||
bool need_refresh();
|
||||
bool need_refresh() override;
|
||||
};
|
||||
} // namespace share
|
||||
} // namespace oceanbase
|
||||
|
@ -27,15 +27,13 @@ class ObRemoteSqlProxy : public ObISQLClient {
|
||||
int init(ObRemoteServerProvider* server_provider);
|
||||
int set_login_info(const char* usr_info, const char* passwd);
|
||||
void destroy();
|
||||
virtual int escape(const char* from, const int64_t from_size, char* to, const int64_t to_size, int64_t& out_size);
|
||||
void signal_refresh()
|
||||
{
|
||||
connection_pool_.signal_refresh();
|
||||
}
|
||||
virtual int read(ReadResult& res, const uint64_t tenant_id, const char* sql) override;
|
||||
virtual int read(ReadResult& res, const int64_t cluster_id, const uint64_t tenant_id, const char* sql) override;
|
||||
virtual int write(const uint64_t tenant_id, const char* sql, int64_t& affected_rows) override;
|
||||
virtual sqlclient::ObISQLConnectionPool* get_pool();
|
||||
virtual int escape(const char *from, const int64_t from_size,
|
||||
char *to, const int64_t to_size, int64_t &out_size) override;
|
||||
void signal_refresh() {connection_pool_.signal_refresh(); }
|
||||
virtual int read(ReadResult &res, const uint64_t tenant_id, const char *sql) override;
|
||||
virtual int read(ReadResult &res, const int64_t cluster_id, const uint64_t tenant_id, const char *sql) override;
|
||||
virtual int write(const uint64_t tenant_id, const char *sql, int64_t &affected_rows) override;
|
||||
virtual sqlclient::ObISQLConnectionPool *get_pool() override;
|
||||
|
||||
virtual bool is_oracle_mode() const override
|
||||
{
|
||||
|
@ -38,21 +38,28 @@ class IHeartBeatProcess;
|
||||
class ObUnifiedAddrAgent : public ObRootAddrAgent {
|
||||
public:
|
||||
ObUnifiedAddrAgent();
|
||||
int init(common::ObMySQLProxy& sql_proxy, common::ObServerConfig& config);
|
||||
virtual int store(const ObIAddrList& addr_list, const ObIAddrList& readonly_addr_list, const bool force,
|
||||
const common::ObClusterType cluster_type, const int64_t timestamp);
|
||||
virtual int fetch(ObIAddrList& addr_list, ObIAddrList& readonly_addr_list, common::ObClusterType& cluster_typ);
|
||||
virtual int fetch_remote_rslist(const int64_t cluster_id, ObIAddrList& addr_list, ObIAddrList& readonly_addr_list,
|
||||
common::ObClusterType& cluster_type) override;
|
||||
int fetch_rslist_by_agent_idx(const int64_t index, const int64_t cluster_id, ObIAddrList& addr_list,
|
||||
ObIAddrList& readonly_addr_list, common::ObClusterType& cluster_type);
|
||||
int init(common::ObMySQLProxy &sql_proxy, common::ObServerConfig &config);
|
||||
virtual int store(const ObIAddrList &addr_list, const ObIAddrList &readonly_addr_list,
|
||||
const bool force, const common::ObClusterType cluster_type,
|
||||
const int64_t timestamp) override;
|
||||
virtual int fetch(ObIAddrList &addr_list, ObIAddrList &readonly_addr_list,
|
||||
common::ObClusterType &cluster_typ) override;
|
||||
virtual int fetch_remote_rslist(const int64_t cluster_id,
|
||||
ObIAddrList &addr_list,
|
||||
ObIAddrList &readonly_addr_list,
|
||||
common::ObClusterType &cluster_type) override;
|
||||
int fetch_rslist_by_agent_idx(const int64_t index,
|
||||
const int64_t cluster_id,
|
||||
ObIAddrList &addr_list,
|
||||
ObIAddrList &readonly_addr_list,
|
||||
common::ObClusterType &cluster_type);
|
||||
int64_t get_agent_num() const
|
||||
{
|
||||
return AGENT_NUM;
|
||||
}
|
||||
virtual int delete_cluster(const int64_t cluster_id);
|
||||
virtual int delete_cluster(const int64_t cluster_id) override;
|
||||
int reload();
|
||||
bool is_valid();
|
||||
bool is_valid() override;
|
||||
|
||||
private:
|
||||
const static int64_t AGENT_NUM = 3;
|
||||
|
@ -50,15 +50,9 @@ class ObTG<TGType::OB_THREAD_POOL> : public ITG {
|
||||
public:
|
||||
ObTG(lib::ThreadCountPair pair) : thread_cnt_(pair.get_thread_cnt())
|
||||
{}
|
||||
~ObTG()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
int64_t thread_cnt() override
|
||||
{
|
||||
return thread_cnt_;
|
||||
}
|
||||
int set_runnable(lib::TGRunnable& runnable)
|
||||
~ObTG() { destroy(); }
|
||||
int64_t thread_cnt() override { return thread_cnt_; }
|
||||
int set_runnable(lib::TGRunnable &runnable) override
|
||||
{
|
||||
int ret = common::OB_SUCCESS;
|
||||
if (th_ != nullptr) {
|
||||
|
@ -37,24 +37,23 @@ class ObVirtualTableIterator : public ObNewRowIterator {
|
||||
|
||||
public:
|
||||
ObVirtualTableIterator()
|
||||
: allocator_(NULL),
|
||||
output_column_ids_(),
|
||||
reserved_column_cnt_(0),
|
||||
schema_guard_(NULL),
|
||||
table_schema_(NULL),
|
||||
index_schema_(NULL),
|
||||
cur_row_(),
|
||||
session_(NULL),
|
||||
convert_alloc_(),
|
||||
cast_ctx_(),
|
||||
convert_row_(),
|
||||
need_convert_(false),
|
||||
scan_param_(NULL)
|
||||
{}
|
||||
virtual ~ObVirtualTableIterator()
|
||||
{}
|
||||
virtual void reset();
|
||||
inline void set_allocator(common::ObIAllocator* allocator);
|
||||
: allocator_(NULL),
|
||||
output_column_ids_(),
|
||||
reserved_column_cnt_(0),
|
||||
schema_guard_(NULL),
|
||||
table_schema_(NULL),
|
||||
index_schema_(NULL),
|
||||
cur_row_(),
|
||||
session_(NULL),
|
||||
convert_alloc_(),
|
||||
cast_ctx_(),
|
||||
convert_row_(),
|
||||
need_convert_(false),
|
||||
scan_param_(NULL)
|
||||
{}
|
||||
virtual ~ObVirtualTableIterator() {}
|
||||
virtual void reset() override;
|
||||
inline void set_allocator(common::ObIAllocator *allocator);
|
||||
inline void set_reserved_column_cnt(int64_t count);
|
||||
inline int set_output_column_ids(const common::ObIArray<uint64_t>& column_ids);
|
||||
inline void set_schema_guard(share::schema::ObSchemaGetterGuard* schema_guard);
|
||||
@ -66,13 +65,10 @@ class ObVirtualTableIterator : public ObNewRowIterator {
|
||||
scan_param_ = scan_param;
|
||||
}
|
||||
virtual int open();
|
||||
virtual int inner_open()
|
||||
{
|
||||
return common::OB_SUCCESS;
|
||||
};
|
||||
virtual int get_next_row(common::ObNewRow*& row);
|
||||
virtual int inner_get_next_row(common::ObNewRow*& row) = 0;
|
||||
virtual int get_next_row() override; // interface for static typing engine.
|
||||
virtual int inner_open() { return common::OB_SUCCESS; };
|
||||
virtual int get_next_row(common::ObNewRow *&row) override;
|
||||
virtual int inner_get_next_row(common::ObNewRow *&row) = 0;
|
||||
virtual int get_next_row() override; // interface for static typing engine.
|
||||
virtual int close();
|
||||
virtual int inner_close()
|
||||
{
|
||||
|
@ -166,12 +166,16 @@ class ObWebServiceRootAddr : public ObRootAddrAgent {
|
||||
virtual ~ObWebServiceRootAddr()
|
||||
{}
|
||||
|
||||
virtual int store(const ObIAddrList& addr_list, const ObIAddrList& readonly_addr_list, const bool force,
|
||||
const common::ObClusterType cluster_type, const int64_t timestamp);
|
||||
virtual int fetch(ObIAddrList& add_list, ObIAddrList& readonly_addr_list, common::ObClusterType& cluster_typ);
|
||||
virtual int fetch_remote_rslist(const int64_t cluster_id, ObIAddrList& addr_list, ObIAddrList& readonly_addr_list,
|
||||
common::ObClusterType& cluster_type) override;
|
||||
virtual int delete_cluster(const int64_t cluster_id);
|
||||
virtual int store(const ObIAddrList &addr_list, const ObIAddrList &readonly_addr_list,
|
||||
const bool force, const common::ObClusterType cluster_type,
|
||||
const int64_t timestamp) override;
|
||||
virtual int fetch(ObIAddrList &add_list, ObIAddrList &readonly_addr_list,
|
||||
common::ObClusterType &cluster_typ) override;
|
||||
virtual int fetch_remote_rslist(const int64_t cluster_id,
|
||||
ObIAddrList &addr_list,
|
||||
ObIAddrList &readonly_addr_list,
|
||||
common::ObClusterType &cluster_type) override;
|
||||
virtual int delete_cluster(const int64_t cluster_id) override;
|
||||
/// get RS_LIST from URL
|
||||
///
|
||||
/// @param [in] appanme cluster appanme
|
||||
|
@ -40,13 +40,12 @@ class ObInMemoryPartitionTable : public ObIPartitionTable {
|
||||
explicit ObInMemoryPartitionTable(ObIPartPropertyGetter& prop_getter);
|
||||
virtual ~ObInMemoryPartitionTable();
|
||||
|
||||
int init(ObIRsListChangeCb& rs_list_change_cb);
|
||||
inline bool is_inited() const
|
||||
{
|
||||
return inited_;
|
||||
}
|
||||
virtual int get(const uint64_t table_id, const int64_t partition_id, ObPartitionInfo& partition_info,
|
||||
const bool need_fetch_faillist = false, const int64_t cluster_id = common::OB_INVALID_ID);
|
||||
int init(ObIRsListChangeCb &rs_list_change_cb);
|
||||
inline bool is_inited() const { return inited_; }
|
||||
virtual int get(const uint64_t table_id, const int64_t partition_id,
|
||||
ObPartitionInfo &partition_info,
|
||||
const bool need_fetch_faillist = false,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID) override;
|
||||
|
||||
virtual int prefetch_by_table_id(const uint64_t tenant_id, const uint64_t start_table_id,
|
||||
const int64_t start_partition_id, common::ObIArray<ObPartitionInfo>& partition_infos,
|
||||
@ -60,32 +59,38 @@ class ObInMemoryPartitionTable : public ObIPartitionTable {
|
||||
const int64_t start_partition_id, common::ObIArray<ObPartitionInfo>& partition_infos,
|
||||
const bool need_fetch_faillist = false) override;
|
||||
|
||||
virtual int batch_fetch_partition_infos(const common::ObIArray<common::ObPartitionKey>& keys,
|
||||
common::ObIAllocator& allocator, common::ObArray<ObPartitionInfo*>& partitions,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID);
|
||||
virtual int batch_fetch_partition_infos(
|
||||
const common::ObIArray<common::ObPartitionKey> &keys,
|
||||
common::ObIAllocator &allocator,
|
||||
common::ObArray<ObPartitionInfo*> &partitions,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID) override;
|
||||
|
||||
virtual int batch_execute(const common::ObIArray<ObPartitionReplica>& replicas);
|
||||
virtual int batch_execute(const common::ObIArray<ObPartitionReplica> &replicas) override;
|
||||
virtual int batch_report_with_optimization(
|
||||
const common::ObIArray<ObPartitionReplica>& replicas, const bool with_role);
|
||||
const common::ObIArray<ObPartitionReplica> &replicas,
|
||||
const bool with_role) override;
|
||||
|
||||
virtual int batch_report_partition_role(
|
||||
const common::ObIArray<share::ObPartitionReplica>& pkey_array, const common::ObRole new_role);
|
||||
virtual int set_unit_id(
|
||||
const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server, const uint64_t unit_id);
|
||||
const common::ObIArray<share::ObPartitionReplica> &pkey_array,
|
||||
const common::ObRole new_role) override;
|
||||
virtual int set_unit_id(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const uint64_t unit_id) override;
|
||||
|
||||
virtual int set_original_leader(const uint64_t table_id, const int64_t partition_id, const bool is_original_leader);
|
||||
virtual int set_original_leader(const uint64_t table_id, const int64_t partition_id,
|
||||
const bool is_original_leader) override;
|
||||
|
||||
virtual int update_rebuild_flag(
|
||||
const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server, const bool rebuild);
|
||||
virtual int update_rebuild_flag(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const bool rebuild) override;
|
||||
|
||||
virtual int update_fail_list(const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server,
|
||||
const ObPartitionReplica::FailList& fail_list);
|
||||
virtual int update_fail_list(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const ObPartitionReplica::FailList &fail_list)
|
||||
override;
|
||||
|
||||
virtual int handover_partition(
|
||||
const common::ObPGKey& pg_key, const common::ObAddr& src_addr, const common::ObAddr& dest_addr);
|
||||
virtual int handover_partition(const common::ObPGKey &pg_key,
|
||||
const common::ObAddr &src_addr, const common::ObAddr &dest_addr) override;
|
||||
|
||||
virtual int replace_partition(
|
||||
const ObPartitionReplica& replica, const common::ObAddr& src_addr, const common::ObAddr& dest_addr);
|
||||
virtual int replace_partition(const ObPartitionReplica &replica,
|
||||
const common::ObAddr &src_addr, const common::ObAddr &dest_addr) override;
|
||||
|
||||
void reuse();
|
||||
|
||||
@ -97,8 +102,9 @@ class ObInMemoryPartitionTable : public ObIPartitionTable {
|
||||
int inner_prefetch(const uint64_t tenant_id, const uint64_t start_table_id, const int64_t start_partition_id,
|
||||
const bool filter_flag_replica, common::ObIArray<ObPartitionInfo>& partition_infos,
|
||||
const bool need_fetch_faillist = false);
|
||||
virtual int update(const ObPartitionReplica& replica);
|
||||
virtual int remove(const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server);
|
||||
virtual int update(const ObPartitionReplica &replica) override;
|
||||
virtual int remove(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server) override;
|
||||
|
||||
// holds mutex_
|
||||
int update_leader_replica(const ObPartitionReplica& replica);
|
||||
|
@ -486,45 +486,75 @@ class ObLocationFetcher : public ObILocationFetcher {
|
||||
static const int64_t OB_FETCH_MEMBER_LIST_AND_LEADER_TIMEOUT = 500 * 1000; // 500ms
|
||||
ObLocationFetcher();
|
||||
virtual ~ObLocationFetcher();
|
||||
int init(common::ObServerConfig& config, share::ObPartitionTableOperator& pt,
|
||||
share::ObRemotePartitionTableOperator& remote_pt, ObRsMgr& rs_mgr, obrpc::ObCommonRpcProxy& rpc_proxy,
|
||||
obrpc::ObSrvRpcProxy& srv_rpc_proxy, ObILocalityManager* locality_manager,
|
||||
// ObIRemoteLocatonGetter *remote_location_getter,
|
||||
const int64_t cluster_id);
|
||||
virtual int fetch_location(
|
||||
const uint64_t table_id, const int64_t partition_id, const int64_t cluster_id, ObPartitionLocation& location);
|
||||
virtual int fetch_vtable_location(const uint64_t table_id, common::ObSArray<ObPartitionLocation>& locations);
|
||||
int init(common::ObServerConfig &config,
|
||||
share::ObPartitionTableOperator &pt,
|
||||
share::ObRemotePartitionTableOperator &remote_pt,
|
||||
ObRsMgr &rs_mgr,
|
||||
obrpc::ObCommonRpcProxy &rpc_proxy,
|
||||
obrpc::ObSrvRpcProxy &srv_rpc_proxy,
|
||||
ObILocalityManager *locality_manager,
|
||||
//ObIRemoteLocatonGetter *remote_location_getter,
|
||||
const int64_t cluster_id);
|
||||
virtual int fetch_location(const uint64_t table_id,
|
||||
const int64_t partition_id,
|
||||
const int64_t cluster_id,
|
||||
ObPartitionLocation &location) override;
|
||||
virtual int fetch_vtable_location(const uint64_t table_id,
|
||||
common::ObSArray<ObPartitionLocation> &locations) override;
|
||||
virtual int renew_location_with_rpc_v2(
|
||||
common::hash::ObHashMap<ObReplicaRenewKey, const obrpc::ObMemberListAndLeaderArg*>* result_map,
|
||||
const ObPartitionLocation& cached_location, ObPartitionLocation& new_location, bool& is_new_location_valid);
|
||||
virtual int batch_renew_sys_table_location_by_rpc(const ObPartitionLocation& core_table_location,
|
||||
const common::ObIArray<ObLocationCacheKey>& keys, common::ObIArray<ObLocationLeader>& results);
|
||||
common::hash::ObHashMap<ObReplicaRenewKey, const obrpc::ObMemberListAndLeaderArg*> *result_map,
|
||||
const ObPartitionLocation &cached_location,
|
||||
ObPartitionLocation &new_location,
|
||||
bool &is_new_location_valid) override;
|
||||
virtual int batch_renew_sys_table_location_by_rpc(
|
||||
const ObPartitionLocation &core_table_location,
|
||||
const common::ObIArray<ObLocationCacheKey> &keys,
|
||||
common::ObIArray<ObLocationLeader> &results) override;
|
||||
|
||||
virtual int batch_fetch_location(const common::ObIArray<common::ObPartitionKey>& keys, const int64_t cluster_id,
|
||||
common::ObIAllocator& allocator, common::ObIArray<ObPartitionLocation*>& new_locations) override;
|
||||
virtual int batch_renew_location_with_rpc(const common::ObIArray<const ObPartitionLocation*>& rpc_locations,
|
||||
common::ObIAllocator& allocator, common::ObIArray<ObPartitionLocation*>& new_locations) override;
|
||||
virtual int batch_fetch_location(
|
||||
const common::ObIArray<common::ObPartitionKey> &keys,
|
||||
const int64_t cluster_id,
|
||||
common::ObIAllocator &allocator,
|
||||
common::ObIArray<ObPartitionLocation*> &new_locations) override;
|
||||
virtual int batch_renew_location_with_rpc(
|
||||
const common::ObIArray<const ObPartitionLocation*> &rpc_locations,
|
||||
common::ObIAllocator &allocator,
|
||||
common::ObIArray<ObPartitionLocation*> &new_locations) override;
|
||||
private:
|
||||
static int check_member_list(const common::ObIArray<ObReplicaLocation> &cached_member_list,
|
||||
const common::ObIArray<common::ObAddr> &server_list,
|
||||
bool &is_same);
|
||||
int check_non_paxos_replica(
|
||||
const common::ObIArray<ObReplicaLocation> &cached_member_list,
|
||||
const common::ObIArray<ObReplicaMember> &non_paxos_replicas,
|
||||
bool &is_same);
|
||||
int deal_with_replica_type_changed(
|
||||
const bool new_mode,
|
||||
const common::ObPartitionKey &pkey,
|
||||
const ObReplicaLocation &old_replica_location,
|
||||
const obrpc::ObMemberListAndLeaderArg &member_info,
|
||||
ObPartitionLocation &new_location,
|
||||
bool &is_new_location_valid);
|
||||
int add_non_paxos_replica(
|
||||
const obrpc::ObMemberListAndLeaderArg &member_info,
|
||||
common::ObIArray<common::ObReplicaMember> &non_paxos_replicas);
|
||||
int check_leader_and_member_list(
|
||||
const bool new_mode,
|
||||
const ObPartitionKey &pkey,
|
||||
const common::ObAddr &addr,
|
||||
const common::ObIArray<ObReplicaLocation> &location_array,
|
||||
const obrpc::ObMemberListAndLeaderArg &member_info,
|
||||
ObReplicaLocation &new_leader,
|
||||
bool &is_new_location_valid);
|
||||
|
||||
private:
|
||||
static int check_member_list(const common::ObIArray<ObReplicaLocation>& cached_member_list,
|
||||
const common::ObIArray<common::ObAddr>& server_list, bool& is_same);
|
||||
int check_non_paxos_replica(const common::ObIArray<ObReplicaLocation>& cached_member_list,
|
||||
const common::ObIArray<ObReplicaMember>& non_paxos_replicas, bool& is_same);
|
||||
int deal_with_replica_type_changed(const bool new_mode, const common::ObPartitionKey& pkey,
|
||||
const ObReplicaLocation& old_replica_location, const obrpc::ObMemberListAndLeaderArg& member_info,
|
||||
ObPartitionLocation& new_location, bool& is_new_location_valid);
|
||||
int add_non_paxos_replica(const obrpc::ObMemberListAndLeaderArg& member_info,
|
||||
common::ObIArray<common::ObReplicaMember>& non_paxos_replicas);
|
||||
int check_leader_and_member_list(const bool new_mode, const ObPartitionKey& pkey, const common::ObAddr& addr,
|
||||
const common::ObIArray<ObReplicaLocation>& location_array, const obrpc::ObMemberListAndLeaderArg& member_info,
|
||||
ObReplicaLocation& new_leader, bool& is_new_location_valid);
|
||||
|
||||
virtual int init_batch_rpc_renew_struct(const common::ObIArray<const ObPartitionLocation*>& rpc_locations,
|
||||
common::ObIAllocator& allocator, common::ObArray<ObLocationRpcRenewInfo>& infos,
|
||||
common::ObArray<int>& key_results,
|
||||
common::hash::ObHashMap<ObReplicaRenewKey, const obrpc::ObMemberListAndLeaderArg*>& result_map);
|
||||
|
||||
private:
|
||||
virtual int init_batch_rpc_renew_struct(
|
||||
const common::ObIArray<const ObPartitionLocation*> &rpc_locations,
|
||||
common::ObIAllocator &allocator,
|
||||
common::ObArray<ObLocationRpcRenewInfo> &infos,
|
||||
common::ObArray<int> &key_results,
|
||||
common::hash::ObHashMap<ObReplicaRenewKey, const obrpc::ObMemberListAndLeaderArg*> &result_map);
|
||||
private:
|
||||
bool inited_;
|
||||
common::ObServerConfig* config_;
|
||||
share::ObPartitionTableOperator* pt_;
|
||||
@ -695,7 +725,7 @@ class ObPartitionLocationCache : public ObIPartitionLocationCache {
|
||||
|
||||
int reload_config();
|
||||
|
||||
virtual ObIPartitionLocationCache::PartitionLocationCacheType get_type() const
|
||||
virtual ObIPartitionLocationCache::PartitionLocationCacheType get_type() const override
|
||||
{
|
||||
return ObIPartitionLocationCache::PART_LOC_CACHE_TYPE_NORMAL;
|
||||
}
|
||||
@ -760,7 +790,8 @@ class ObPartitionLocationCache : public ObIPartitionLocationCache {
|
||||
virtual int nonblock_renew_with_limiter(
|
||||
const common::ObPartitionKey& partition, const int64_t expire_renew_time, bool& is_limited) override;
|
||||
// link table.
|
||||
virtual int get_link_table_location(const uint64_t table_id, ObPartitionLocation& location);
|
||||
virtual int get_link_table_location(const uint64_t table_id,
|
||||
ObPartitionLocation &location) override;
|
||||
|
||||
/*-----batch async renew location-----*/
|
||||
virtual int batch_process_tasks(const common::ObIArray<ObLocationAsyncUpdateTask>& tasks, bool& stopped) override;
|
||||
|
@ -44,8 +44,10 @@ class ObPartitionTableOperator : public ObIPartitionTable {
|
||||
int set_callback_for_rs(ObIRsListChangeCb& rs_list_change_cb, ObIMergeErrorCb& merge_error_cb);
|
||||
int set_callback_for_obs(obrpc::ObCommonRpcProxy& rpc_proxy, ObRsMgr& rs_mgr, common::ObServerConfig& config);
|
||||
|
||||
virtual int get(const uint64_t table_id, const int64_t partition_id, ObPartitionInfo& partition_info,
|
||||
const bool need_fetch_faillist = false, const int64_t cluster_id = common::OB_INVALID_ID);
|
||||
virtual int get(const uint64_t table_id, const int64_t partition_id,
|
||||
ObPartitionInfo &partition_info,
|
||||
const bool need_fetch_faillist = false,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID) override;
|
||||
|
||||
virtual int prefetch_by_table_id(const uint64_t tenant_id, const uint64_t start_table_id,
|
||||
const int64_t set_partition_id, common::ObIArray<ObPartitionInfo>& partition_infos,
|
||||
@ -57,37 +59,40 @@ class ObPartitionTableOperator : public ObIPartitionTable {
|
||||
|
||||
virtual int prefetch(const uint64_t pt_table_id, const int64_t pt_partition_id, const uint64_t start_table_id,
|
||||
const int64_t start_partition_id, common::ObIArray<ObPartitionInfo>& partition_infos,
|
||||
const bool need_fetch_faillist = false);
|
||||
const bool need_fetch_faillist = false) override;
|
||||
|
||||
virtual int batch_fetch_partition_infos(const common::ObIArray<common::ObPartitionKey>& keys,
|
||||
common::ObIAllocator& allocator, common::ObArray<ObPartitionInfo*>& partitions,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID) override;
|
||||
virtual int update(const ObPartitionReplica &replica) override;
|
||||
|
||||
virtual int update(const ObPartitionReplica& replica);
|
||||
|
||||
virtual int batch_execute(const common::ObIArray<ObPartitionReplica>& replicas);
|
||||
virtual int batch_execute(const common::ObIArray<ObPartitionReplica> &replicas) override;
|
||||
virtual int batch_report_with_optimization(
|
||||
const common::ObIArray<ObPartitionReplica>& replicas, const bool with_role);
|
||||
const common::ObIArray<ObPartitionReplica> &replicas,
|
||||
const bool with_role) override;
|
||||
virtual int batch_report_partition_role(
|
||||
const common::ObIArray<share::ObPartitionReplica>& pkey_array, const ObRole new_role);
|
||||
virtual int remove(const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server);
|
||||
const common::ObIArray<share::ObPartitionReplica> &pkey_array,
|
||||
const ObRole new_role) override;
|
||||
virtual int remove(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server) override;
|
||||
|
||||
virtual int set_unit_id(
|
||||
const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server, const uint64_t unit_id);
|
||||
virtual int set_unit_id(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const uint64_t unit_id) override;
|
||||
|
||||
virtual int set_original_leader(const uint64_t table_id, int64_t partition_id, const bool is_original_leader);
|
||||
virtual int set_original_leader(const uint64_t table_id, int64_t partition_id,
|
||||
const bool is_original_leader) override;
|
||||
|
||||
virtual int update_rebuild_flag(
|
||||
const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server, const bool rebuild);
|
||||
virtual int update_rebuild_flag(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const bool rebuild) override;
|
||||
|
||||
virtual int update_fail_list(const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server,
|
||||
const ObPartitionReplica::FailList& fail_list);
|
||||
virtual int update_fail_list(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const ObPartitionReplica::FailList &fail_list) override;
|
||||
|
||||
virtual int handover_partition(
|
||||
const common::ObPGKey& pg_key, const common::ObAddr& src_addr, const common::ObAddr& dest_addr);
|
||||
virtual int handover_partition(const common::ObPGKey &pg_key,
|
||||
const common::ObAddr &src_addr, const common::ObAddr &dest_addr) override;
|
||||
|
||||
virtual int replace_partition(
|
||||
const ObPartitionReplica& replica, const common::ObAddr& src_addr, const common::ObAddr& dest_addr);
|
||||
virtual int replace_partition(const ObPartitionReplica &replica,
|
||||
const common::ObAddr &src_addr, const common::ObAddr &dest_addr) override;
|
||||
|
||||
ObInMemoryPartitionTable& get_inmemory_table()
|
||||
{
|
||||
|
@ -32,16 +32,17 @@ class ObPersistentPartitionTable : public ObIPartitionTable {
|
||||
explicit ObPersistentPartitionTable(ObIPartPropertyGetter& prop_getter);
|
||||
virtual ~ObPersistentPartitionTable();
|
||||
|
||||
int init(common::ObISQLClient& sql_proxy, common::ObServerConfig* config);
|
||||
bool is_inited() const
|
||||
{
|
||||
return inited_;
|
||||
}
|
||||
int init(common::ObISQLClient &sql_proxy, common::ObServerConfig *config);
|
||||
bool is_inited() const { return inited_; }
|
||||
|
||||
virtual int get(const uint64_t table_id, const int64_t partition_id, ObPartitionInfo& partition_info,
|
||||
const bool need_fetch_faillist = false, const int64_t cluster_id = common::OB_INVALID_ID);
|
||||
virtual int batch_fetch_partition_infos(const common::ObIArray<common::ObPartitionKey>& keys,
|
||||
common::ObIAllocator& allocator, common::ObArray<ObPartitionInfo*>& partitions,
|
||||
virtual int get(const uint64_t table_id, const int64_t partition_id,
|
||||
ObPartitionInfo &partition_info,
|
||||
const bool need_fetch_faillist = false,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID) override;
|
||||
virtual int batch_fetch_partition_infos(
|
||||
const common::ObIArray<common::ObPartitionKey> &keys,
|
||||
common::ObIAllocator &allocator,
|
||||
common::ObArray<ObPartitionInfo*> &partitions,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID) override;
|
||||
|
||||
virtual int prefetch_by_table_id(const uint64_t tenant_id, const uint64_t start_table_id,
|
||||
@ -56,31 +57,35 @@ class ObPersistentPartitionTable : public ObIPartitionTable {
|
||||
const int64_t start_partition_id, common::ObIArray<ObPartitionInfo>& partition_infos,
|
||||
const bool need_fetch_faillist = false) override;
|
||||
|
||||
virtual int update(const ObPartitionReplica& replica);
|
||||
virtual int update(const ObPartitionReplica &replica) override;
|
||||
virtual int batch_report_partition_role(
|
||||
const common::ObIArray<share::ObPartitionReplica>& pkey_array, const common::ObRole new_role);
|
||||
const common::ObIArray<share::ObPartitionReplica> &pkey_array,
|
||||
const common::ObRole new_role) override;
|
||||
|
||||
virtual int batch_execute(const common::ObIArray<ObPartitionReplica>& replicas);
|
||||
virtual int batch_execute(const common::ObIArray<ObPartitionReplica> &replicas) override;
|
||||
virtual int batch_report_with_optimization(
|
||||
const common::ObIArray<ObPartitionReplica>& replicas, const bool with_role);
|
||||
virtual int remove(const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server);
|
||||
const common::ObIArray<ObPartitionReplica> &replicas,
|
||||
const bool with_role) override;
|
||||
virtual int remove(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server) override;
|
||||
|
||||
virtual int set_unit_id(
|
||||
const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server, const uint64_t unit_id);
|
||||
virtual int set_unit_id(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const uint64_t unit_id) override;
|
||||
|
||||
virtual int set_original_leader(const uint64_t table_id, const int64_t partition_id, const bool is_original_leader);
|
||||
virtual int set_original_leader(const uint64_t table_id, const int64_t partition_id,
|
||||
const bool is_original_leader) override;
|
||||
|
||||
virtual int update_rebuild_flag(
|
||||
const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server, const bool rebuild);
|
||||
virtual int update_rebuild_flag(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const bool rebuild) override;
|
||||
|
||||
virtual int update_fail_list(const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server,
|
||||
const ObPartitionReplica::FailList& fail_list);
|
||||
virtual int update_fail_list(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const ObPartitionReplica::FailList &fail_list) override;
|
||||
|
||||
virtual int handover_partition(
|
||||
const common::ObPGKey& pg_key, const common::ObAddr& src_addr, const common::ObAddr& dest_addr);
|
||||
virtual int handover_partition(const common::ObPGKey &pg_key,
|
||||
const common::ObAddr &src_addr, const common::ObAddr &dest_addr) override;
|
||||
|
||||
virtual int replace_partition(
|
||||
const ObPartitionReplica& replica, const common::ObAddr& src_addr, const common::ObAddr& dest_addr);
|
||||
virtual int replace_partition(const ObPartitionReplica &replica,
|
||||
const common::ObAddr &src_addr, const common::ObAddr &dest_addr) override;
|
||||
|
||||
common::ObISQLClient* get_sql_proxy() const
|
||||
{
|
||||
|
@ -30,22 +30,29 @@ class ObPartitionLocation;
|
||||
namespace schema {
|
||||
class ObMultiVersionSchemaService;
|
||||
}
|
||||
class ObRemotePartitionTableOperator : public ObPartitionTableOperator {
|
||||
public:
|
||||
explicit ObRemotePartitionTableOperator(ObIPartPropertyGetter& prop_getter);
|
||||
virtual ~ObRemotePartitionTableOperator()
|
||||
{}
|
||||
int init(share::schema::ObMultiVersionSchemaService* schema_service, ObRemoteSqlProxy* remote_sql_proxy);
|
||||
virtual int get(const uint64_t table_id, const int64_t partition_id, ObPartitionInfo& partition_info,
|
||||
const bool need_fetch_faillist = false, const int64_t cluster_id = common::OB_INVALID_ID);
|
||||
virtual int batch_fetch_partition_infos(const common::ObIArray<common::ObPartitionKey>& keys,
|
||||
common::ObIAllocator& allocator, common::ObArray<ObPartitionInfo*>& partitions,
|
||||
class ObRemotePartitionTableOperator : public ObPartitionTableOperator
|
||||
{
|
||||
public:
|
||||
explicit ObRemotePartitionTableOperator(ObIPartPropertyGetter &prop_getter);
|
||||
virtual ~ObRemotePartitionTableOperator() { }
|
||||
int init(share::schema::ObMultiVersionSchemaService *schema_service,
|
||||
ObRemoteSqlProxy *remote_sql_proxy);
|
||||
virtual int get(const uint64_t table_id,
|
||||
const int64_t partition_id,
|
||||
ObPartitionInfo &partition_info,
|
||||
const bool need_fetch_faillist = false,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID) override;
|
||||
virtual int batch_fetch_partition_infos(
|
||||
const common::ObIArray<common::ObPartitionKey> &keys,
|
||||
common::ObIAllocator &allocator,
|
||||
common::ObArray<ObPartitionInfo*> &partitions,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID) override;
|
||||
|
||||
// not supported interface
|
||||
virtual int batch_execute(const common::ObIArray<ObPartitionReplica>& replicas);
|
||||
virtual int prefetch_by_table_id(const uint64_t tenant_id, const uint64_t table_id, const int64_t partition_id,
|
||||
common::ObIArray<ObPartitionInfo>& partition_infos, const bool need_fetch_faillist = false) override;
|
||||
//not supported interface
|
||||
virtual int batch_execute(const common::ObIArray<ObPartitionReplica> &replicas) override;
|
||||
virtual int prefetch_by_table_id(const uint64_t tenant_id, const uint64_t table_id,
|
||||
const int64_t partition_id, common::ObIArray<ObPartitionInfo> &partition_infos,
|
||||
const bool need_fetch_faillist = false) override;
|
||||
|
||||
virtual int prefetch(const uint64_t tenant_id, const uint64_t table_id, const int64_t partition_id,
|
||||
common::ObIArray<ObPartitionInfo>& partition_infos, bool ignore_row_checksum,
|
||||
@ -55,24 +62,27 @@ class ObRemotePartitionTableOperator : public ObPartitionTableOperator {
|
||||
const int64_t partition_id, common::ObIArray<ObPartitionInfo>& partition_infos,
|
||||
const bool need_fetch_faillist = false) override;
|
||||
|
||||
virtual int update(const ObPartitionReplica& replica);
|
||||
virtual int update(const ObPartitionReplica &replica) override;
|
||||
|
||||
virtual int remove(const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server);
|
||||
virtual int remove(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server) override;
|
||||
|
||||
virtual int set_unit_id(
|
||||
const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server, const uint64_t unit_id);
|
||||
virtual int set_unit_id(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const uint64_t unit_id) override;
|
||||
|
||||
virtual int set_original_leader(const uint64_t table_id, const int64_t partition_id, const bool is_original_leader);
|
||||
virtual int set_original_leader(const uint64_t table_id, const int64_t partition_id,
|
||||
const bool is_original_leader) override;
|
||||
|
||||
virtual int update_rebuild_flag(
|
||||
const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server, const bool rebuild);
|
||||
virtual int update_rebuild_flag(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const bool rebuild) override;
|
||||
|
||||
virtual int update_fail_list(const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server,
|
||||
const ObPartitionReplica::FailList& fail_list);
|
||||
|
||||
private:
|
||||
int get_partition_info(const uint64_t table_id, const int64_t partition_id, const bool filter_flag_replica,
|
||||
ObPartitionInfo& partition_info, common::ObConsistencyLevel consistency);
|
||||
virtual int update_fail_list(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const ObPartitionReplica::FailList &fail_list) override;
|
||||
private:
|
||||
int get_partition_info(
|
||||
const uint64_t table_id, const int64_t partition_id,
|
||||
const bool filter_flag_replica, ObPartitionInfo &partition_info,
|
||||
common::ObConsistencyLevel consistency);
|
||||
|
||||
private:
|
||||
bool inited_;
|
||||
|
@ -39,9 +39,11 @@ class ObRpcPartitionTable : public ObIPartitionTable {
|
||||
{
|
||||
return is_inited_;
|
||||
}
|
||||
|
||||
virtual int get(const uint64_t table_id, const int64_t partition_id, ObPartitionInfo& partition_info,
|
||||
const bool need_fetch_faillist = false, const int64_t cluster_id = common::OB_INVALID_ID);
|
||||
|
||||
virtual int get(const uint64_t table_id,
|
||||
const int64_t partition_id, ObPartitionInfo &partition_info,
|
||||
const bool need_fetch_faillist = false,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID) override;
|
||||
|
||||
virtual int prefetch_by_table_id(const uint64_t tenant_id, const uint64_t start_table_id,
|
||||
const int64_t start_partition_id, common::ObIArray<ObPartitionInfo>& partition_infos,
|
||||
@ -55,50 +57,59 @@ class ObRpcPartitionTable : public ObIPartitionTable {
|
||||
const int64_t start_partition_id, common::ObIArray<ObPartitionInfo>& partition_infos,
|
||||
const bool need_fetch_faillist = false) override;
|
||||
|
||||
virtual int batch_fetch_partition_infos(const common::ObIArray<common::ObPartitionKey>& keys,
|
||||
common::ObIAllocator& allocator, common::ObArray<ObPartitionInfo*>& partitions,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID);
|
||||
virtual int batch_fetch_partition_infos(
|
||||
const common::ObIArray<common::ObPartitionKey> &keys,
|
||||
common::ObIAllocator &allocator,
|
||||
common::ObArray<ObPartitionInfo*> &partitions,
|
||||
const int64_t cluster_id = common::OB_INVALID_ID) override;
|
||||
|
||||
virtual int batch_execute(const common::ObIArray<ObPartitionReplica>& replicas);
|
||||
virtual int batch_execute(const common::ObIArray<ObPartitionReplica> &replicas) override;
|
||||
virtual int batch_report_with_optimization(
|
||||
const common::ObIArray<ObPartitionReplica>& replicas, const bool with_role);
|
||||
const common::ObIArray<ObPartitionReplica> &replicas,
|
||||
const bool with_role) override;
|
||||
virtual int batch_report_partition_role(
|
||||
const common::ObIArray<share::ObPartitionReplica>& pkey_array, const common::ObRole new_role);
|
||||
virtual int update(const ObPartitionReplica& replica);
|
||||
const common::ObIArray<share::ObPartitionReplica> &pkey_array,
|
||||
const common::ObRole new_role) override;
|
||||
virtual int update(const ObPartitionReplica &replica) override;
|
||||
|
||||
virtual int remove(const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server);
|
||||
virtual int remove(const uint64_t table_id,
|
||||
const int64_t partition_id, const common::ObAddr &server) override;
|
||||
|
||||
virtual int set_unit_id(
|
||||
const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server, const uint64_t unit_id);
|
||||
virtual int set_unit_id(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const uint64_t unit_id) override;
|
||||
|
||||
virtual int update_rebuild_flag(
|
||||
const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server, const bool rebuild);
|
||||
virtual int update_fail_list(const uint64_t table_id, const int64_t partition_id, const common::ObAddr& server,
|
||||
const ObPartitionReplica::FailList& fail_list);
|
||||
virtual int update_rebuild_flag(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const bool rebuild) override;
|
||||
virtual int update_fail_list(const uint64_t table_id, const int64_t partition_id,
|
||||
const common::ObAddr &server, const ObPartitionReplica::FailList &fail_list) override;
|
||||
|
||||
virtual int handover_partition(
|
||||
const common::ObPGKey& pg_key, const common::ObAddr& src_addr, const common::ObAddr& dest_addr);
|
||||
virtual int handover_partition(const common::ObPGKey &pg_key,
|
||||
const common::ObAddr &src_addr, const common::ObAddr &dest_addr) override;
|
||||
|
||||
virtual int replace_partition(
|
||||
const ObPartitionReplica& replica, const common::ObAddr& src_addr, const common::ObAddr& dest_addr);
|
||||
virtual int replace_partition(const ObPartitionReplica &replica,
|
||||
const common::ObAddr &src_addr, const common::ObAddr &dest_addr) override;
|
||||
|
||||
virtual int set_original_leader(const uint64_t table_id, const int64_t partition_id, const bool is_original_leader);
|
||||
virtual int set_original_leader(const uint64_t table_id, const int64_t partition_id,
|
||||
const bool is_original_leader) override;
|
||||
private:
|
||||
int get_timeout(int64_t &timeout);
|
||||
int fetch_root_partition_v1(ObPartitionInfo &partition_info);
|
||||
int fetch_root_partition_v2(ObPartitionInfo &partition_info);
|
||||
int fetch_root_partition_from_rs_list_v1(ObPartitionInfo &partition_info);
|
||||
int fetch_root_partition_from_all_server_v1(ObPartitionInfo &partition);
|
||||
|
||||
private:
|
||||
int get_timeout(int64_t& timeout);
|
||||
int fetch_root_partition_v1(ObPartitionInfo& partition_info);
|
||||
int fetch_root_partition_v2(ObPartitionInfo& partition_info);
|
||||
int fetch_root_partition_from_rs_list_v1(ObPartitionInfo& partition_info);
|
||||
int fetch_root_partition_from_all_server_v1(ObPartitionInfo& partition);
|
||||
int fetch_root_partition_from_rs_list_v2(common::ObIArray<ObAddr> &obs_list,
|
||||
ObPartitionInfo &partition_info);
|
||||
int fetch_root_partition_from_all_server_v2(const common::ObIArray<ObAddr> &obs_list,
|
||||
ObPartitionInfo &partition);
|
||||
int fetch_root_partition_from_ps_v2(common::ObIArray<ObAddr> &obs_list,
|
||||
ObPartitionInfo &partition);
|
||||
int fetch_root_partition_from_obs_v1(const common::ObIArray<ObAddr> &obs_list,
|
||||
ObPartitionInfo &partition_info);
|
||||
|
||||
int fetch_root_partition_from_rs_list_v2(common::ObIArray<ObAddr>& obs_list, ObPartitionInfo& partition_info);
|
||||
int fetch_root_partition_from_all_server_v2(const common::ObIArray<ObAddr>& obs_list, ObPartitionInfo& partition);
|
||||
int fetch_root_partition_from_ps_v2(common::ObIArray<ObAddr>& obs_list, ObPartitionInfo& partition);
|
||||
int fetch_root_partition_from_obs_v1(const common::ObIArray<ObAddr>& obs_list, ObPartitionInfo& partition_info);
|
||||
const int64_t CACHE_VALID_INTERVAL = 300 * 1000 * 1000; // 5min
|
||||
|
||||
const int64_t CACHE_VALID_INTERVAL = 300 * 1000 * 1000; // 5min
|
||||
|
||||
private:
|
||||
private:
|
||||
bool is_inited_;
|
||||
obrpc::ObCommonRpcProxy* rpc_proxy_;
|
||||
share::ObRsMgr* rs_mgr_;
|
||||
|
@ -231,7 +231,7 @@ class ObMultiVersionSchemaService : public ObServerSchemaService {
|
||||
protected:
|
||||
ObMultiVersionSchemaService();
|
||||
virtual ~ObMultiVersionSchemaService();
|
||||
virtual int destroy();
|
||||
virtual int destroy() override;
|
||||
|
||||
virtual int publish_schema() override;
|
||||
virtual int publish_schema(const uint64_t tenant_id) override;
|
||||
@ -298,10 +298,10 @@ class ObMultiVersionSchemaService : public ObServerSchemaService {
|
||||
// schema_cache related
|
||||
int init_sys_tenant_user_schema();
|
||||
|
||||
int update_schema_cache(common::ObIArray<ObTableSchema*>& schema_array, const bool is_force = false);
|
||||
int update_schema_cache(common::ObIArray<ObTableSchema>& schema_array, const bool is_force = false);
|
||||
int update_schema_cache(const common::ObIArray<ObTenantSchema>& schema_array);
|
||||
int update_schema_cache(const share::schema::ObSysVariableSchema& schema);
|
||||
int update_schema_cache(common::ObIArray<ObTableSchema*> &schema_array, const bool is_force = false) override;
|
||||
int update_schema_cache(common::ObIArray<ObTableSchema> &schema_array, const bool is_force = false) override;
|
||||
int update_schema_cache(const common::ObIArray<ObTenantSchema> &schema_array) override;
|
||||
int update_schema_cache(const share::schema::ObSysVariableSchema &schema) override;
|
||||
int build_full_materalized_view_schema(
|
||||
ObSchemaGetterGuard& schema_guard, common::ObIAllocator& allocator, ObTableSchema*& view_schema);
|
||||
virtual int get_schema(const ObSchemaMgr* mgr, const ObRefreshSchemaStatus& schema_status,
|
||||
|
@ -475,56 +475,50 @@ class ObSchemaGetterGuard : public common::ObPartMgr {
|
||||
int get_table_schema_version(const uint64_t table_id, int64_t& table_version);
|
||||
|
||||
template <typename SchemaType>
|
||||
int check_flashback_object_exist(
|
||||
const SchemaType& object_schema, const common::ObString& object_name, bool& object_exist);
|
||||
int check_flashback_object_exist(const SchemaType &object_schema,
|
||||
const common::ObString &object_name,
|
||||
bool &object_exist);
|
||||
|
||||
virtual int get_part(const uint64_t table_id, const share::schema::ObPartitionLevel part_level, const int64_t part_id,
|
||||
const common::ObNewRange& range, const bool reverse, common::ObIArray<int64_t>& part_ids) override;
|
||||
virtual int get_part(const uint64_t table_id, const share::schema::ObPartitionLevel part_level, const int64_t part_id,
|
||||
const common::ObNewRow& row, common::ObIArray<int64_t>& part_ids);
|
||||
int get_schema_count(int64_t& schema_count);
|
||||
int get_schema_count(const uint64_t tenant_id, int64_t& schema_count);
|
||||
int get_schema_size(const uint64_t tenant_id, int64_t& schema_count);
|
||||
int get_schema_version_v2(const ObSchemaType schema_type, const uint64_t schema_id, int64_t& schema_version);
|
||||
int get_idx_schema_by_origin_idx_name(
|
||||
uint64_t tenant_id, uint64_t database_id, const common::ObString& index_name, const ObTableSchema*& table_schema);
|
||||
virtual int get_part(const uint64_t table_id,
|
||||
const share::schema::ObPartitionLevel part_level,
|
||||
const int64_t part_id,
|
||||
const common::ObNewRange &range,
|
||||
const bool reverse,
|
||||
common::ObIArray<int64_t> &part_ids) override;
|
||||
virtual int get_part(const uint64_t table_id,
|
||||
const share::schema::ObPartitionLevel part_level,
|
||||
const int64_t part_id,
|
||||
const common::ObNewRow &row,
|
||||
common::ObIArray<int64_t> &part_ids) override;
|
||||
int get_schema_count(int64_t &schema_count);
|
||||
int get_schema_count(const uint64_t tenant_id, int64_t &schema_count);
|
||||
int get_schema_size(const uint64_t tenant_id, int64_t &schema_count);
|
||||
int get_schema_version_v2(const ObSchemaType schema_type,
|
||||
const uint64_t schema_id,
|
||||
int64_t &schema_version);
|
||||
int get_idx_schema_by_origin_idx_name(uint64_t tenant_id,
|
||||
uint64_t database_id,
|
||||
const common::ObString &index_name,
|
||||
const ObTableSchema *&table_schema);
|
||||
|
||||
int get_tenant_unavailable_index(const uint64_t tenant_id, common::ObIArray<uint64_t>& table_ids);
|
||||
int check_unavailable_index_exist(const uint64_t tenant_id, bool& exist);
|
||||
int check_restore_error_index_exist(const uint64_t tenant_id, bool& exist);
|
||||
int get_tenant_unavailable_index(const uint64_t tenant_id, common::ObIArray<uint64_t> &table_ids);
|
||||
int check_unavailable_index_exist(const uint64_t tenant_id, bool &exist);
|
||||
int check_restore_error_index_exist(const uint64_t tenant_id, bool &exist);
|
||||
|
||||
inline uint64_t get_session_id() const
|
||||
{
|
||||
return session_id_;
|
||||
}
|
||||
inline void set_session_id(const uint64_t id)
|
||||
{
|
||||
session_id_ = id;
|
||||
}
|
||||
inline uint64_t get_session_id() const { return session_id_; }
|
||||
inline void set_session_id(const uint64_t id) { session_id_ = id; }
|
||||
|
||||
int get_partition_cnt(uint64_t table_id, int64_t& part_cnt);
|
||||
int get_partition_cnt(uint64_t table_id, int64_t &part_cnt);
|
||||
|
||||
bool is_tenant_schema_guard() const
|
||||
{
|
||||
return common::OB_INVALID_TENANT_ID != tenant_id_;
|
||||
}
|
||||
bool is_tenant_schema_guard() const { return common::OB_INVALID_TENANT_ID != tenant_id_; }
|
||||
|
||||
int get_tenant_mv_ids(const uint64_t tenant_id, common::ObArray<uint64_t>& mv_ids) const;
|
||||
int get_all_mv_ids(common::ObArray<uint64_t>& mv_ids) const;
|
||||
int get_tenant_mv_ids(const uint64_t tenant_id, common::ObArray<uint64_t> &mv_ids) const;
|
||||
int get_all_mv_ids(common::ObArray<uint64_t> &mv_ids) const;
|
||||
|
||||
SchemaGuardType get_schema_guard_type() const
|
||||
{
|
||||
return schema_guard_type_;
|
||||
}
|
||||
SchemaGuardType get_schema_guard_type() const { return schema_guard_type_; }
|
||||
|
||||
bool is_standby_cluster()
|
||||
{
|
||||
return is_standby_cluster_;
|
||||
}
|
||||
bool is_schema_splited() const
|
||||
{
|
||||
return 0 != schema_mgr_infos_.count();
|
||||
}
|
||||
bool is_standby_cluster() { return is_standby_cluster_; }
|
||||
bool is_schema_splited() const { return 0 != schema_mgr_infos_.count(); }
|
||||
int check_formal_guard() const;
|
||||
int is_lazy_mode(const uint64_t tenant_id, bool& is_lazy) const;
|
||||
|
||||
|
@ -68,17 +68,14 @@ class ObSchemaServiceSQLImpl : public ObSchemaService {
|
||||
|
||||
ObSchemaServiceSQLImpl();
|
||||
virtual ~ObSchemaServiceSQLImpl();
|
||||
virtual int init(common::ObMySQLProxy* sql_proxy, common::ObDbLinkProxy* dblink_proxy,
|
||||
const share::schema::ObServerSchemaService* schema_service);
|
||||
virtual void set_common_config(const common::ObCommonConfig* config)
|
||||
{
|
||||
config_ = config;
|
||||
}
|
||||
virtual int init(common::ObMySQLProxy *sql_proxy,
|
||||
common::ObDbLinkProxy *dblink_proxy,
|
||||
const share::schema::ObServerSchemaService *schema_service) override;
|
||||
virtual void set_common_config(const common::ObCommonConfig *config) override { config_ = config; }
|
||||
|
||||
#define GET_DDL_SQL_SERVICE_FUNC(SCHEMA_TYPE, SCHEMA) \
|
||||
Ob##SCHEMA_TYPE##SqlService& get_##SCHEMA##_sql_service() \
|
||||
{ \
|
||||
return SCHEMA##_service_; \
|
||||
#define GET_DDL_SQL_SERVICE_FUNC(SCHEMA_TYPE, SCHEMA) \
|
||||
Ob##SCHEMA_TYPE##SqlService &get_##SCHEMA##_sql_service() override { \
|
||||
return SCHEMA##_service_; \
|
||||
};
|
||||
GET_DDL_SQL_SERVICE_FUNC(Tenant, tenant);
|
||||
GET_DDL_SQL_SERVICE_FUNC(Database, database);
|
||||
@ -95,71 +92,69 @@ class ObSchemaServiceSQLImpl : public ObSchemaService {
|
||||
GET_DDL_SQL_SERVICE_FUNC(DbLink, dblink);
|
||||
|
||||
/* sequence_id related */
|
||||
virtual int init_sequence_id(const int64_t rootservice_epoch);
|
||||
virtual int inc_sequence_id();
|
||||
virtual uint64_t get_sequence_id()
|
||||
{
|
||||
return schema_info_.get_sequence_id();
|
||||
};
|
||||
virtual int init_sequence_id(const int64_t rootservice_epoch) override;
|
||||
virtual int inc_sequence_id() override;
|
||||
virtual uint64_t get_sequence_id() override { return schema_info_.get_sequence_id(); };
|
||||
|
||||
virtual int64_t get_last_operation_schema_version() const
|
||||
{
|
||||
return last_operation_schema_version_;
|
||||
};
|
||||
virtual uint64_t get_last_operation_tenant_id() const
|
||||
{
|
||||
return last_operation_tenant_id_;
|
||||
};
|
||||
virtual int set_last_operation_info(const uint64_t tenant_id, const int64_t schema_version);
|
||||
virtual int64_t get_last_operation_schema_version() const override { return last_operation_schema_version_; };
|
||||
virtual uint64_t get_last_operation_tenant_id() const override { return last_operation_tenant_id_; };
|
||||
virtual int set_last_operation_info(const uint64_t tenant_id, const int64_t schema_version) override;
|
||||
|
||||
virtual int get_refresh_schema_info(ObRefreshSchemaInfo& schema_info);
|
||||
// enable refresh schema info
|
||||
virtual int set_refresh_schema_info(const ObRefreshSchemaInfo& schema_info);
|
||||
virtual int get_refresh_schema_info(ObRefreshSchemaInfo &schema_info) override;
|
||||
//enable refresh schema info
|
||||
virtual int set_refresh_schema_info(const ObRefreshSchemaInfo &schema_info) override;
|
||||
|
||||
virtual bool is_sync_primary_ddl() const override
|
||||
{
|
||||
return 0 < primary_schema_versions_.count();
|
||||
}
|
||||
// get schema of __all_core_table
|
||||
virtual int get_all_core_table_schema(ObTableSchema& table_schema);
|
||||
virtual void set_in_bootstrap(const bool is_in_bootstrap) override
|
||||
{
|
||||
is_in_bootstrap_ = is_in_bootstrap;
|
||||
}
|
||||
virtual bool is_in_bootstrap() const override
|
||||
{
|
||||
return is_in_bootstrap_;
|
||||
}
|
||||
virtual int get_all_core_table_schema(ObTableSchema &table_schema) override;
|
||||
virtual void set_in_bootstrap(const bool is_in_bootstrap) override { is_in_bootstrap_ = is_in_bootstrap; }
|
||||
virtual bool is_in_bootstrap() const override { return is_in_bootstrap_; }
|
||||
// get schemas of core tables, need get from kv table
|
||||
int get_core_table_schemas(common::ObISQLClient& sql_client, common::ObArray<ObTableSchema>& core_schemas);
|
||||
int get_core_table_schemas(common::ObISQLClient &sql_client,
|
||||
common::ObArray<ObTableSchema> &core_schemas) override;
|
||||
|
||||
int get_sys_table_schemas(const common::ObIArray<uint64_t>& table_ids, common::ObISQLClient& sql_client,
|
||||
common::ObIAllocator& allocator, common::ObArray<ObTableSchema*>& sys_schemas);
|
||||
int get_sys_table_schemas(const common::ObIArray<uint64_t> &table_ids,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObIAllocator &allocator,
|
||||
common::ObArray<ObTableSchema *> &sys_schemas) override;
|
||||
|
||||
/**
|
||||
* for schema fetcher
|
||||
*/
|
||||
virtual int get_table_schema(const ObRefreshSchemaStatus& schema_status, const uint64_t table_id,
|
||||
const int64_t schema_version, common::ObISQLClient& sql_client, common::ObIAllocator& allocator,
|
||||
ObTableSchema*& table_schema);
|
||||
virtual int get_table_schema(const ObRefreshSchemaStatus &schema_status,
|
||||
const uint64_t table_id,
|
||||
const int64_t schema_version,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObIAllocator &allocator,
|
||||
ObTableSchema *&table_schema) override;
|
||||
|
||||
virtual int get_batch_table_schema(const ObRefreshSchemaStatus& schema_status, const int64_t schema_version,
|
||||
common::ObArray<uint64_t>& table_ids, common::ObISQLClient& sql_client, common::ObIAllocator& allocator,
|
||||
common::ObArray<ObTableSchema*>& table_schema_array);
|
||||
virtual int get_batch_table_schema(const ObRefreshSchemaStatus &schema_status,
|
||||
const int64_t schema_version,
|
||||
common::ObArray<uint64_t> &table_ids,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObIAllocator &allocator,
|
||||
common::ObArray<ObTableSchema *> &table_schema_array) override;
|
||||
|
||||
/**
|
||||
* for refresh full schema
|
||||
*/
|
||||
virtual int get_all_tenants(common::ObISQLClient& sql_client, const int64_t schema_version,
|
||||
common::ObIArray<ObSimpleTenantSchema>& schema_array);
|
||||
virtual int get_sys_variable(common::ObISQLClient& client, const ObRefreshSchemaStatus& schema_status,
|
||||
const uint64_t tenant_id, const int64_t schema_version, ObSimpleSysVariableSchema& schema);
|
||||
#define GET_ALL_SCHEMA_FUNC_DECLARE(SCHEMA, SCHEMA_TYPE) \
|
||||
virtual int get_all_##SCHEMA##s(common::ObISQLClient& sql_client, \
|
||||
const ObRefreshSchemaStatus& schema_status, \
|
||||
const int64_t schema_version, \
|
||||
const uint64_t tenant_id, \
|
||||
common::ObIArray<SCHEMA_TYPE>& schema_array);
|
||||
virtual int get_all_tenants(common::ObISQLClient &sql_client,
|
||||
const int64_t schema_version,
|
||||
common::ObIArray<ObSimpleTenantSchema> &schema_array) override;
|
||||
virtual int get_sys_variable(common::ObISQLClient &client,
|
||||
const ObRefreshSchemaStatus &schema_status,
|
||||
const uint64_t tenant_id,
|
||||
const int64_t schema_version,
|
||||
ObSimpleSysVariableSchema &schema) override;
|
||||
#define GET_ALL_SCHEMA_FUNC_DECLARE(SCHEMA, SCHEMA_TYPE) \
|
||||
virtual int get_all_##SCHEMA##s(common::ObISQLClient &sql_client, \
|
||||
const ObRefreshSchemaStatus &schema_status, \
|
||||
const int64_t schema_version, \
|
||||
const uint64_t tenant_id, \
|
||||
common::ObIArray<SCHEMA_TYPE> &schema_array) override;
|
||||
GET_ALL_SCHEMA_FUNC_DECLARE(user, ObSimpleUserSchema);
|
||||
GET_ALL_SCHEMA_FUNC_DECLARE(database, ObSimpleDatabaseSchema);
|
||||
GET_ALL_SCHEMA_FUNC_DECLARE(tablegroup, ObSimpleTablegroupSchema);
|
||||
@ -175,58 +170,76 @@ class ObSchemaServiceSQLImpl : public ObSchemaService {
|
||||
GET_ALL_SCHEMA_FUNC_DECLARE(obj_priv, ObObjPriv);
|
||||
GET_ALL_SCHEMA_FUNC_DECLARE(dblink, ObDbLinkSchema);
|
||||
|
||||
// get tenant increment schema operation between (base_version, new_schema_version]
|
||||
virtual int get_increment_schema_operations(const ObRefreshSchemaStatus& schema_status, const int64_t base_version,
|
||||
const int64_t new_schema_version, common::ObISQLClient& sql_client,
|
||||
SchemaOperationSetWithAlloc& schema_operations);
|
||||
//get tenant increment schema operation between (base_version, new_schema_version]
|
||||
virtual int get_increment_schema_operations(const ObRefreshSchemaStatus &schema_status,
|
||||
const int64_t base_version,
|
||||
const int64_t new_schema_version,
|
||||
common::ObISQLClient &sql_client,
|
||||
SchemaOperationSetWithAlloc &schema_operations) override;
|
||||
|
||||
// get tenant increment schema operation (base_version, ] with limit, for rs used only
|
||||
virtual int get_increment_schema_operations(const ObRefreshSchemaStatus& schema_status, const int64_t base_version,
|
||||
common::ObISQLClient& sql_client, SchemaOperationSetWithAlloc& schema_operations);
|
||||
//get tenant increment schema operation (base_version, ] with limit, for rs used only
|
||||
virtual int get_increment_schema_operations(
|
||||
const ObRefreshSchemaStatus &schema_status,
|
||||
const int64_t base_version,
|
||||
common::ObISQLClient &sql_client,
|
||||
SchemaOperationSetWithAlloc &schema_operations) override;
|
||||
|
||||
virtual int check_sys_schema_change(common::ObISQLClient& sql_client, const common::ObIArray<uint64_t>& sys_table_ids,
|
||||
const int64_t schema_version, const int64_t new_schema_version, bool& sys_schema_change);
|
||||
virtual int check_sys_schema_change(common::ObISQLClient &sql_client,
|
||||
const common::ObIArray<uint64_t> &sys_table_ids,
|
||||
const int64_t schema_version,
|
||||
const int64_t new_schema_version,
|
||||
bool &sys_schema_change) override;
|
||||
|
||||
virtual int get_tenant_schema(const int64_t schema_version, common::ObISQLClient& client, const uint64_t tenant_id,
|
||||
ObTenantSchema& tenant_schema);
|
||||
virtual int get_tenant_schema(const int64_t schema_version,
|
||||
common::ObISQLClient &client,
|
||||
const uint64_t tenant_id,
|
||||
ObTenantSchema &tenant_schema) override;
|
||||
|
||||
// get table schema of a single table
|
||||
virtual int get_table_schema_from_inner_table(const ObRefreshSchemaStatus& schema_status, const uint64_t table_id,
|
||||
common::ObISQLClient& sql_client, ObTableSchema& table_schema);
|
||||
//get table schema of a single table
|
||||
virtual int get_table_schema_from_inner_table(const ObRefreshSchemaStatus &schema_status,
|
||||
const uint64_t table_id,
|
||||
common::ObISQLClient &sql_client,
|
||||
ObTableSchema &table_schema) override;
|
||||
|
||||
virtual int fetch_new_tenant_id(uint64_t& new_tenant_id);
|
||||
virtual int fetch_new_table_id(const uint64_t tenant_id, uint64_t& new_table_id);
|
||||
virtual int fetch_new_database_id(const uint64_t tenant_id, uint64_t& new_database_id);
|
||||
virtual int fetch_new_tablegroup_id(const uint64_t tenant_id, uint64_t& new_tablegroup_id);
|
||||
virtual int fetch_new_user_id(const uint64_t tenant_id, uint64_t& new_user_id);
|
||||
virtual int fetch_new_outline_id(const uint64_t tenant_id, uint64_t& new_outline_id);
|
||||
virtual int fetch_new_synonym_id(const uint64_t tenant_id, uint64_t& new_synonym_id);
|
||||
virtual int fetch_new_udf_id(const uint64_t tenant_id, uint64_t& new_udf_id);
|
||||
virtual int fetch_new_constraint_id(const uint64_t tenant_id, uint64_t& new_constraint_id);
|
||||
virtual int fetch_new_sequence_id(const uint64_t tenant_id, uint64_t& new_sequence_id);
|
||||
virtual int fetch_new_dblink_id(const uint64_t tenant_id, uint64_t& new_dblink_id);
|
||||
|
||||
virtual int fetch_new_profile_id(const uint64_t tenant_id, uint64_t& new_profile_id);
|
||||
virtual int fetch_new_tenant_id(uint64_t &new_tenant_id) override;
|
||||
virtual int fetch_new_table_id(const uint64_t tenant_id, uint64_t &new_table_id) override;
|
||||
virtual int fetch_new_database_id(const uint64_t tenant_id, uint64_t &new_database_id) override;
|
||||
virtual int fetch_new_tablegroup_id(const uint64_t tenant_id, uint64_t &new_tablegroup_id) override;
|
||||
virtual int fetch_new_user_id(const uint64_t tenant_id, uint64_t &new_user_id) override;
|
||||
virtual int fetch_new_outline_id(const uint64_t tenant_id, uint64_t &new_outline_id) override;
|
||||
virtual int fetch_new_synonym_id(const uint64_t tenant_id, uint64_t &new_synonym_id) override;
|
||||
virtual int fetch_new_udf_id(const uint64_t tenant_id, uint64_t &new_udf_id) override;
|
||||
virtual int fetch_new_constraint_id(const uint64_t tenant_id, uint64_t &new_constraint_id) override;
|
||||
virtual int fetch_new_sequence_id(const uint64_t tenant_id, uint64_t &new_sequence_id) override;
|
||||
virtual int fetch_new_dblink_id(const uint64_t tenant_id, uint64_t &new_dblink_id) override;
|
||||
|
||||
// virtual int insert_sys_param(const ObSysParam &sys_param,
|
||||
// common::ObISQLClient *sql_client);
|
||||
virtual int fetch_new_profile_id(const uint64_t tenant_id, uint64_t &new_profile_id) override;
|
||||
|
||||
// virtual int insert_sys_param(const ObSysParam &sys_param,
|
||||
// common::ObISQLClient *sql_client);
|
||||
|
||||
virtual int delete_partition_table(const uint64_t partition_table_id, const uint64_t tenant_id,
|
||||
const int64_t partition_idx, common::ObISQLClient& sql_client);
|
||||
const int64_t partition_idx, common::ObISQLClient &sql_client) override;
|
||||
|
||||
virtual int get_tablegroup_schema(const ObRefreshSchemaStatus& schema_status, const uint64_t tablegroup_id,
|
||||
const int64_t schema_version, common::ObISQLClient& sql_client, common::ObIAllocator& allocator,
|
||||
ObTablegroupSchema*& tablegroup_schema) override;
|
||||
virtual int get_tablegroup_schema(const ObRefreshSchemaStatus &schema_status,
|
||||
const uint64_t tablegroup_id,
|
||||
const int64_t schema_version,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObIAllocator &allocator,
|
||||
ObTablegroupSchema *&tablegroup_schema) override;
|
||||
|
||||
virtual int get_batch_tenants(common::ObISQLClient& client, const int64_t schema_version,
|
||||
common::ObArray<SchemaKey>& schema_keys, common::ObIArray<ObSimpleTenantSchema>& schema_array);
|
||||
virtual int get_batch_tenants(common::ObISQLClient &client,
|
||||
const int64_t schema_version,
|
||||
common::ObArray<SchemaKey> &schema_keys,
|
||||
common::ObIArray<ObSimpleTenantSchema> &schema_array) override;
|
||||
|
||||
#define GET_BATCH_SCHEMAS_FUNC_DECLARE(SCHEMA, SCHEMA_TYPE) \
|
||||
virtual int get_batch_##SCHEMA##s(const ObRefreshSchemaStatus& schema_status, \
|
||||
common::ObISQLClient& client, \
|
||||
const int64_t schema_version, \
|
||||
common::ObArray<SchemaKey>& schema_keys, \
|
||||
common::ObIArray<SCHEMA_TYPE>& schema_array);
|
||||
#define GET_BATCH_SCHEMAS_FUNC_DECLARE(SCHEMA, SCHEMA_TYPE) \
|
||||
virtual int get_batch_##SCHEMA##s(const ObRefreshSchemaStatus &schema_status,\
|
||||
common::ObISQLClient &client, \
|
||||
const int64_t schema_version, \
|
||||
common::ObArray<SchemaKey> &schema_keys, \
|
||||
common::ObIArray<SCHEMA_TYPE> &schema_array) override;
|
||||
GET_BATCH_SCHEMAS_FUNC_DECLARE(user, ObSimpleUserSchema);
|
||||
GET_BATCH_SCHEMAS_FUNC_DECLARE(database, ObSimpleDatabaseSchema);
|
||||
GET_BATCH_SCHEMAS_FUNC_DECLARE(tablegroup, ObSimpleTablegroupSchema);
|
||||
@ -252,7 +265,7 @@ class ObSchemaServiceSQLImpl : public ObSchemaService {
|
||||
const int64_t schema_version, \
|
||||
common::ObArray<uint64_t>& SCHEMA##_ids, \
|
||||
common::ObISQLClient& sql_client, \
|
||||
common::ObIArray<SCHEMA_TYPE>& SCHEMA##_schema_array);
|
||||
common::ObIArray<SCHEMA_TYPE>& SCHEMA##_schema_array) override;
|
||||
GET_BATCH_FULL_SCHEMA_FUNC_DECLARE(database, ObDatabaseSchema);
|
||||
GET_BATCH_FULL_SCHEMA_FUNC_DECLARE(tablegroup, ObTablegroupSchema);
|
||||
GET_BATCH_FULL_SCHEMA_FUNC_DECLARE(outline, ObOutlineInfo);
|
||||
@ -261,21 +274,25 @@ class ObSchemaServiceSQLImpl : public ObSchemaService {
|
||||
GET_BATCH_FULL_SCHEMA_FUNC_DECLARE(sequence, ObSequenceSchema);
|
||||
GET_BATCH_FULL_SCHEMA_FUNC_DECLARE(profile, ObProfileSchema);
|
||||
|
||||
virtual int get_batch_users(const ObRefreshSchemaStatus& schema_status, const int64_t schema_version,
|
||||
common::ObArray<uint64_t>& tenant_user_ids, common::ObISQLClient& sql_client,
|
||||
common::ObArray<ObUserInfo>& user_info_array);
|
||||
virtual int get_batch_users(const ObRefreshSchemaStatus &schema_status,
|
||||
const int64_t schema_version,
|
||||
common::ObArray<uint64_t> &tenant_user_ids,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObArray<ObUserInfo> &user_info_array) override;
|
||||
|
||||
virtual int get_batch_tenants(common::ObISQLClient& client, const int64_t schema_version,
|
||||
common::ObArray<uint64_t>& tenant_ids, common::ObIArray<ObTenantSchema>& schema_array);
|
||||
virtual int get_batch_tenants(common::ObISQLClient &client,
|
||||
const int64_t schema_version,
|
||||
common::ObArray<uint64_t> &tenant_ids,
|
||||
common::ObIArray<ObTenantSchema> &schema_array) override;
|
||||
|
||||
#define FETCH_SCHEMAS_FUNC_DECLARE(SCHEMA, SCHEMA_TYPE) \
|
||||
int fetch_##SCHEMA##s(common::ObISQLClient& client, \
|
||||
const ObRefreshSchemaStatus& schema_status, \
|
||||
const int64_t schema_version, \
|
||||
const uint64_t tenant_id, \
|
||||
common::ObIArray<SCHEMA_TYPE>& schema_array, \
|
||||
const SchemaKey* schema_keys = NULL, \
|
||||
const int64_t schema_key_size = 0);
|
||||
int fetch_##SCHEMA##s(common::ObISQLClient &client, \
|
||||
const ObRefreshSchemaStatus &schema_status,\
|
||||
const int64_t schema_version, \
|
||||
const uint64_t tenant_id, \
|
||||
common::ObIArray<SCHEMA_TYPE> &schema_array, \
|
||||
const SchemaKey *schema_keys = NULL, \
|
||||
const int64_t schema_key_size = 0);
|
||||
FETCH_SCHEMAS_FUNC_DECLARE(user, ObSimpleUserSchema);
|
||||
FETCH_SCHEMAS_FUNC_DECLARE(database, ObSimpleDatabaseSchema);
|
||||
FETCH_SCHEMAS_FUNC_DECLARE(tablegroup, ObSimpleTablegroupSchema);
|
||||
@ -321,97 +338,161 @@ class ObSchemaServiceSQLImpl : public ObSchemaService {
|
||||
const uint64_t tenant_id, common::ObISQLClient& sql_client, common::ObArray<ObUserInfo>& user_array,
|
||||
const uint64_t* user_keys = NULL, const int64_t users_size = 0);
|
||||
|
||||
int fetch_role_grantee_map_info(const ObRefreshSchemaStatus& schema_status, const int64_t schema_version,
|
||||
const uint64_t tenant_id, ObISQLClient& sql_client, ObArray<ObUserInfo>& user_array, const bool is_fetch_role,
|
||||
const uint64_t* user_keys /* = NULL */, const int64_t users_size /* = 0 */);
|
||||
int fetch_role_grantee_map_info(
|
||||
const ObRefreshSchemaStatus &schema_status,
|
||||
const int64_t schema_version,
|
||||
const uint64_t tenant_id,
|
||||
ObISQLClient &sql_client,
|
||||
ObArray<ObUserInfo> &user_array,
|
||||
const bool is_fetch_role,
|
||||
const uint64_t *user_keys /* = NULL */,
|
||||
const int64_t users_size /* = 0 */);
|
||||
|
||||
virtual int get_core_version(
|
||||
common::ObISQLClient& sql_client, const int64_t frozen_version, int64_t& core_schema_version);
|
||||
virtual int get_baseline_schema_version(
|
||||
common::ObISQLClient& sql_client, const int64_t frozen_version, int64_t& baseline_schema_version);
|
||||
virtual int get_core_version(common::ObISQLClient &sql_client,
|
||||
const int64_t frozen_version,
|
||||
int64_t &core_schema_version) override;
|
||||
virtual int get_baseline_schema_version(common::ObISQLClient &sql_client,
|
||||
const int64_t frozen_version,
|
||||
int64_t &baseline_schema_version) override;
|
||||
|
||||
virtual int fetch_schema_version(
|
||||
const ObRefreshSchemaStatus& schema_status, common::ObISQLClient& sql_client, int64_t& schema_version);
|
||||
virtual int fetch_schema_version(const ObRefreshSchemaStatus &schema_status,
|
||||
common::ObISQLClient &sql_client,
|
||||
int64_t &schema_version) override;
|
||||
|
||||
virtual void set_refreshed_schema_version(const int64_t schema_version);
|
||||
virtual int gen_new_schema_version(
|
||||
const uint64_t tenant_id, const int64_t refreshed_schema_version, int64_t& schema_version);
|
||||
virtual void set_refreshed_schema_version(const int64_t schema_version) override;
|
||||
virtual int gen_new_schema_version(const uint64_t tenant_id,
|
||||
const int64_t refreshed_schema_version,
|
||||
int64_t &schema_version) override;
|
||||
|
||||
virtual int get_new_schema_version(uint64_t tenant_id, int64_t& schema_version);
|
||||
virtual int get_new_schema_version(uint64_t tenant_id, int64_t &schema_version) override;
|
||||
|
||||
virtual int get_ori_schema_version(const ObRefreshSchemaStatus& schema_status, const uint64_t tenant_id,
|
||||
const uint64_t table_id, int64_t& last_schema_version);
|
||||
virtual int get_ori_schema_version(const ObRefreshSchemaStatus &schema_status, const uint64_t tenant_id, const uint64_t table_id, int64_t &last_schema_version) override;
|
||||
|
||||
/**
|
||||
* for recycle bin
|
||||
*/
|
||||
virtual int insert_recyclebin_object(const ObRecycleObject& recycle_obj, common::ObISQLClient& sql_client);
|
||||
virtual int insert_recyclebin_object(
|
||||
const ObRecycleObject &recycle_obj,
|
||||
common::ObISQLClient &sql_client) override;
|
||||
|
||||
virtual int fetch_recycle_object(const uint64_t tenant_id, const common::ObString& object_name,
|
||||
const ObRecycleObject::RecycleObjType recycle_obj_type, common::ObISQLClient& sql_client,
|
||||
common::ObIArray<ObRecycleObject>& recycle_objs);
|
||||
virtual int fetch_recycle_object(
|
||||
const uint64_t tenant_id,
|
||||
const common::ObString &object_name,
|
||||
const ObRecycleObject::RecycleObjType recycle_obj_type,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObIArray<ObRecycleObject> &recycle_objs) override;
|
||||
|
||||
virtual int delete_recycle_object(
|
||||
const uint64_t tenant_id, const ObRecycleObject& recycle_object, common::ObISQLClient& sql_client);
|
||||
const uint64_t tenant_id,
|
||||
const ObRecycleObject &recycle_object,
|
||||
common::ObISQLClient &sql_client) override;
|
||||
|
||||
virtual int fetch_expire_recycle_objects(const uint64_t tenant_id, const int64_t expire_time,
|
||||
common::ObISQLClient& sql_client, common::ObIArray<ObRecycleObject>& recycle_objs);
|
||||
virtual int fetch_expire_recycle_objects(
|
||||
const uint64_t tenant_id,
|
||||
const int64_t expire_time,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObIArray<ObRecycleObject> &recycle_objs) override;
|
||||
|
||||
virtual int fetch_recycle_objects_of_db(const uint64_t tenant_id, const uint64_t database_id,
|
||||
common::ObISQLClient& sql_client, common::ObIArray<ObRecycleObject>& recycle_objs);
|
||||
virtual int fetch_recycle_objects_of_db(
|
||||
const uint64_t tenant_id,
|
||||
const uint64_t database_id,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObIArray<ObRecycleObject> &recycle_objs) override;
|
||||
|
||||
virtual int query_table_status(const ObRefreshSchemaStatus& schema_status, common::ObISQLClient& sql_client,
|
||||
const int64_t schema_version, const uint64_t tenant_id, const uint64_t table_id, const bool is_pg,
|
||||
TableStatus& table_status);
|
||||
virtual int query_table_status(const ObRefreshSchemaStatus &schema_status,
|
||||
common::ObISQLClient &sql_client,
|
||||
const int64_t schema_version,
|
||||
const uint64_t tenant_id,
|
||||
const uint64_t table_id,
|
||||
const bool is_pg,
|
||||
TableStatus &table_status) override;
|
||||
// for backup
|
||||
virtual int construct_recycle_table_object(
|
||||
common::ObISQLClient& sql_client, const ObSimpleTableSchemaV2& table, ObRecycleObject& recycle_object);
|
||||
common::ObISQLClient &sql_client,
|
||||
const ObSimpleTableSchemaV2 &table,
|
||||
ObRecycleObject &recycle_object) override;
|
||||
|
||||
virtual int construct_recycle_database_object(
|
||||
common::ObISQLClient& sql_client, const ObDatabaseSchema& database, ObRecycleObject& recycle_object);
|
||||
common::ObISQLClient &sql_client,
|
||||
const ObDatabaseSchema &database,
|
||||
ObRecycleObject &recycle_object) override;
|
||||
|
||||
// for liboblog
|
||||
virtual int query_partition_status_from_sys_table(const ObRefreshSchemaStatus& schema_status,
|
||||
common::ObISQLClient& sql_client, const int64_t schema_version, const common::ObPartitionKey& pkey,
|
||||
const bool is_sub_part_template, PartitionStatus& table_status);
|
||||
virtual int fetch_aux_tables(const ObRefreshSchemaStatus& schema_status, const uint64_t tenant_id,
|
||||
const uint64_t table_id, const int64_t schema_version, common::ObISQLClient& sql_client,
|
||||
common::ObIArray<ObAuxTableMetaInfo>& aux_tables);
|
||||
virtual int query_partition_status_from_sys_table(
|
||||
const ObRefreshSchemaStatus &schema_status,
|
||||
common::ObISQLClient &sql_client,
|
||||
const int64_t schema_version,
|
||||
const common::ObPartitionKey &pkey,
|
||||
const bool is_sub_part_template,
|
||||
PartitionStatus &table_status) override;
|
||||
virtual int fetch_aux_tables(const ObRefreshSchemaStatus &schema_status,
|
||||
const uint64_t tenant_id,
|
||||
const uint64_t table_id,
|
||||
const int64_t schema_version,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObIArray<ObAuxTableMetaInfo> &aux_tables) override;
|
||||
|
||||
// link table.
|
||||
virtual int get_link_table_schema(const ObDbLinkSchema& dblink_schema, const common::ObString& database_name,
|
||||
const common::ObString& table_name, common::ObIAllocator& allocator, ObTableSchema*& table_schema);
|
||||
virtual int get_link_table_schema(const ObDbLinkSchema &dblink_schema,
|
||||
const common::ObString &database_name,
|
||||
const common::ObString &table_name,
|
||||
common::ObIAllocator &allocator,
|
||||
ObTableSchema *&table_schema) override;
|
||||
|
||||
static int check_ddl_id_exist(
|
||||
common::ObISQLClient& sql_client, const uint64_t tenant_id, const common::ObString& ddl_id_str, bool& is_exists);
|
||||
virtual int construct_schema_version_history(const ObRefreshSchemaStatus& schema_status,
|
||||
common::ObISQLClient& sql_client, const int64_t snapshot_version, const VersionHisKey& version_his_key,
|
||||
VersionHisVal& version_his_val);
|
||||
common::ObISQLClient &sql_client,
|
||||
const uint64_t tenant_id,
|
||||
const common::ObString &ddl_id_str,
|
||||
bool &is_exists);
|
||||
virtual int construct_schema_version_history(
|
||||
const ObRefreshSchemaStatus &schema_status,
|
||||
common::ObISQLClient &sql_client,
|
||||
const int64_t snapshot_version,
|
||||
const VersionHisKey &version_his_key,
|
||||
VersionHisVal &version_his_val) override;
|
||||
|
||||
static int fetch_tenant_compat_mode(
|
||||
common::ObISQLClient& sql_client, const uint64_t tenant_id, common::ObCompatibilityMode& mode);
|
||||
static int sort_partition_array(ObPartitionSchema& partition_schema);
|
||||
static int sort_subpartition_array(ObPartitionSchema& partition_schema);
|
||||
static int fetch_tenant_compat_mode(common::ObISQLClient &sql_client,
|
||||
const uint64_t tenant_id,
|
||||
common::ObCompatibilityMode &mode);
|
||||
static int sort_partition_array(ObPartitionSchema &partition_schema);
|
||||
static int sort_subpartition_array(ObPartitionSchema &partition_schema);
|
||||
|
||||
static int gen_bootstrap_schema_version(const int64_t tenant_id, const int64_t refreshed_schema_version,
|
||||
int64_t& gen_schema_version, int64_t& schema_version);
|
||||
virtual int get_mock_schema_infos(common::ObISQLClient& sql_client, common::ObIArray<uint64_t>& tenant_ids,
|
||||
common::hash::ObHashMap<uint64_t, ObMockSchemaInfo>& new_mock_schema_infos);
|
||||
int64_t &gen_schema_version, int64_t &schema_version);
|
||||
virtual int get_mock_schema_infos(
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObIArray<uint64_t> &tenant_ids,
|
||||
common::hash::ObHashMap<uint64_t, ObMockSchemaInfo> &new_mock_schema_infos) override;
|
||||
|
||||
virtual int get_drop_tenant_infos(
|
||||
common::ObISQLClient& sql_client, int64_t schema_version, common::ObIArray<ObDropTenantInfo>& drop_tenant_infos);
|
||||
common::ObISQLClient &sql_client,
|
||||
int64_t schema_version,
|
||||
common::ObIArray<ObDropTenantInfo> &drop_tenant_infos) override;
|
||||
|
||||
virtual int query_tenant_status(
|
||||
common::ObISQLClient& sql_client, const uint64_t tenant_id, TenantStatus& tenant_status);
|
||||
virtual int get_schema_version_by_timestamp(common::ObISQLClient& sql_client,
|
||||
const ObRefreshSchemaStatus& schema_status, const uint64_t tenant_id, int64_t timestamp, int64_t& schema_version);
|
||||
common::ObISQLClient &sql_client,
|
||||
const uint64_t tenant_id,
|
||||
TenantStatus &tenant_status) override;
|
||||
virtual int get_schema_version_by_timestamp(
|
||||
common::ObISQLClient &sql_client,
|
||||
const ObRefreshSchemaStatus &schema_status,
|
||||
const uint64_t tenant_id,
|
||||
int64_t timestamp,
|
||||
int64_t &schema_version) override;
|
||||
virtual int get_first_trans_end_schema_version(
|
||||
common::ObISQLClient& sql_client, const uint64_t tenant_id, int64_t& schema_version);
|
||||
virtual int load_split_schema_version(common::ObISQLClient& sql_client, int64_t& split_schema_version);
|
||||
virtual int get_split_schema_version_v2(common::ObISQLClient& sql_client, const ObRefreshSchemaStatus& schema_status,
|
||||
const uint64_t tenant_id, int64_t& split_schema_version);
|
||||
common::ObISQLClient &sql_client,
|
||||
const uint64_t tenant_id,
|
||||
int64_t &schema_version) override;
|
||||
virtual int load_split_schema_version(
|
||||
common::ObISQLClient &sql_client,
|
||||
int64_t &split_schema_version) override;
|
||||
virtual int get_split_schema_version_v2(
|
||||
common::ObISQLClient &sql_client,
|
||||
const ObRefreshSchemaStatus &schema_status,
|
||||
const uint64_t tenant_id,
|
||||
int64_t &split_schema_version) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
bool check_inner_stat();
|
||||
int fetch_new_schema_id(const uint64_t tenant_id, const share::ObMaxIdType max_id_type, uint64_t& new_schema_id);
|
||||
|
||||
@ -424,41 +505,72 @@ class ObSchemaServiceSQLImpl : public ObSchemaService {
|
||||
common::ObArray<ObTableSchema*>& not_core_schemas);
|
||||
|
||||
template <typename T>
|
||||
int fetch_all_table_info(const ObRefreshSchemaStatus& schema_status, const int64_t schema_version, uint64_t tenant_id,
|
||||
common::ObISQLClient& sql_client, common::ObIAllocator& allocator, common::ObIArray<T>& table_schema_array,
|
||||
const uint64_t* table_ids = NULL, const int64_t table_ids_size = 0);
|
||||
int fetch_all_column_info(const ObRefreshSchemaStatus& schema_status, const int64_t schema_version,
|
||||
const uint64_t tenant_id, common::ObISQLClient& sql_client, common::ObArray<ObTableSchema*>& table_schema_array,
|
||||
const uint64_t* table_ids = NULL, const int64_t table_ids_size = 0);
|
||||
int fetch_all_constraint_info_ignore_inner_table(const ObRefreshSchemaStatus& schema_status,
|
||||
const int64_t schema_version, const uint64_t tenant_id, common::ObISQLClient& sql_client,
|
||||
common::ObArray<ObTableSchema*>& table_schema_array, const uint64_t* table_ids = NULL,
|
||||
const int64_t table_ids_size = 0);
|
||||
int fetch_all_constraint_info(const ObRefreshSchemaStatus& schema_status, const int64_t schema_version,
|
||||
const uint64_t tenant_id, common::ObISQLClient& sql_client, common::ObArray<ObTableSchema*>& table_schema_array,
|
||||
const uint64_t* table_ids = NULL, const int64_t table_ids_size = 0);
|
||||
int fetch_all_table_info(const ObRefreshSchemaStatus &schema_status,
|
||||
const int64_t schema_version,
|
||||
uint64_t tenant_id,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObIAllocator &allocator,
|
||||
common::ObIArray<T> &table_schema_array,
|
||||
const uint64_t *table_ids = NULL,
|
||||
const int64_t table_ids_size = 0);
|
||||
int fetch_all_column_info(const ObRefreshSchemaStatus &schema_status,
|
||||
const int64_t schema_version,
|
||||
const uint64_t tenant_id,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObArray<ObTableSchema *> &table_schema_array,
|
||||
const uint64_t *table_ids = NULL,
|
||||
const int64_t table_ids_size = 0);
|
||||
int fetch_all_constraint_info_ignore_inner_table(const ObRefreshSchemaStatus &schema_status,
|
||||
const int64_t schema_version,
|
||||
const uint64_t tenant_id,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObArray<ObTableSchema *> &table_schema_array,
|
||||
const uint64_t *table_ids = NULL,
|
||||
const int64_t table_ids_size = 0);
|
||||
int fetch_all_constraint_info(const ObRefreshSchemaStatus &schema_status,
|
||||
const int64_t schema_version,
|
||||
const uint64_t tenant_id,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObArray<ObTableSchema *> &table_schema_array,
|
||||
const uint64_t *table_ids = NULL,
|
||||
const int64_t table_ids_size = 0);
|
||||
|
||||
template <typename T>
|
||||
int gen_batch_fetch_array(common::ObArray<T*>& table_schema_array, const uint64_t* table_ids /* = NULL */,
|
||||
const int64_t table_ids_size /*= 0 */, common::ObIArray<uint64_t>& part_tables,
|
||||
common::ObIArray<uint64_t>& def_subpart_tables, common::ObIArray<uint64_t>& subpart_tables,
|
||||
common::ObIArray<int64_t>& part_idxs, common::ObIArray<int64_t>& def_subpart_idxs,
|
||||
common::ObIArray<int64_t>& subpart_idxs);
|
||||
template<typename T>
|
||||
int gen_batch_fetch_array(
|
||||
common::ObArray<T *> &table_schema_array,
|
||||
const uint64_t *table_ids /* = NULL */,
|
||||
const int64_t table_ids_size /*= 0 */,
|
||||
common::ObIArray<uint64_t> &part_tables,
|
||||
common::ObIArray<uint64_t> &def_subpart_tables,
|
||||
common::ObIArray<uint64_t> &subpart_tables,
|
||||
common::ObIArray<int64_t> &part_idxs,
|
||||
common::ObIArray<int64_t> &def_subpart_idxs,
|
||||
common::ObIArray<int64_t> &subpart_idxs);
|
||||
|
||||
template <typename T>
|
||||
int fetch_all_partition_info(const ObRefreshSchemaStatus& schema_status, const int64_t schema_version,
|
||||
const uint64_t tenant_id, common::ObISQLClient& sql_client, common::ObArray<T*>& table_schema_array,
|
||||
const uint64_t* table_ids /* = NULL */, const int64_t table_ids_size /*= 0 */);
|
||||
template<typename T>
|
||||
int fetch_all_partition_info(const ObRefreshSchemaStatus &schema_status,
|
||||
const int64_t schema_version,
|
||||
const uint64_t tenant_id,
|
||||
common::ObISQLClient &sql_client,
|
||||
common::ObArray<T *> &table_schema_array,
|
||||
const uint64_t *table_ids /* = NULL */,
|
||||
const int64_t table_ids_size /*= 0 */);
|
||||
|
||||
int fetch_all_tenant_info(const int64_t schema_version, common::ObISQLClient& client,
|
||||
common::ObIArray<ObTenantSchema>& tenant_schema_array, const uint64_t* tenant_ids = NULL,
|
||||
const int64_t tenant_ids_size = 0);
|
||||
int fetch_all_tenant_info(const int64_t schema_version,
|
||||
common::ObISQLClient &client,
|
||||
common::ObIArray<ObTenantSchema> &tenant_schema_array,
|
||||
const uint64_t *tenant_ids = NULL,
|
||||
const int64_t tenant_ids_size = 0);
|
||||
|
||||
int get_sys_variable_schema(common::ObISQLClient& sql_client, const ObRefreshSchemaStatus& schema_status,
|
||||
const uint64_t tenant_id, const int64_t schema_version, share::schema::ObSysVariableSchema& sys_variable_schema);
|
||||
int get_sys_variable_schema(
|
||||
common::ObISQLClient &sql_client,
|
||||
const ObRefreshSchemaStatus &schema_status,
|
||||
const uint64_t tenant_id,
|
||||
const int64_t schema_version,
|
||||
share::schema::ObSysVariableSchema &sys_variable_schema) override;
|
||||
|
||||
template <typename T>
|
||||
int retrieve_schema_version(T& result, int64_t& schema_version);
|
||||
template<typename T>
|
||||
int retrieve_schema_version(T &result, int64_t &schema_version);
|
||||
// retrieve core table and sys table don't read history table, set check_deleted to false
|
||||
// to filter is_deleted column
|
||||
|
||||
|
@ -3193,68 +3193,26 @@ class ObTablegroupSchema : public ObPartitionSchema {
|
||||
{
|
||||
return PARTITION_LEVEL_TWO == get_part_level();
|
||||
}
|
||||
inline virtual uint64_t get_table_id() const override
|
||||
{
|
||||
return tablegroup_id_;
|
||||
} // for partition schema used
|
||||
inline virtual uint64_t get_database_id() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
inline virtual void set_database_id(const uint64_t database_id)
|
||||
{
|
||||
UNUSED(database_id);
|
||||
}
|
||||
inline virtual void set_table_id(const uint64_t tablegroup_id) override
|
||||
{
|
||||
tablegroup_id_ = tablegroup_id;
|
||||
}
|
||||
inline int64_t get_part_func_expr_num() const
|
||||
{
|
||||
return part_func_expr_num_;
|
||||
}
|
||||
inline void set_part_func_expr_num(const int64_t part_func_expr_num)
|
||||
{
|
||||
part_func_expr_num_ = part_func_expr_num;
|
||||
}
|
||||
inline int64_t get_sub_part_func_expr_num() const
|
||||
{
|
||||
return sub_part_func_expr_num_;
|
||||
}
|
||||
inline void set_sub_part_func_expr_num(const int64_t sub_part_func_expr_num)
|
||||
{
|
||||
sub_part_func_expr_num_ = sub_part_func_expr_num;
|
||||
}
|
||||
virtual int64_t get_partition_cnt() const override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual int calc_part_func_expr_num(int64_t& part_func_expr_num) const;
|
||||
virtual int calc_subpart_func_expr_num(int64_t& subpart_func_expr_num) const;
|
||||
// other methods
|
||||
virtual void reset();
|
||||
int64_t get_convert_size() const;
|
||||
virtual bool has_self_partition() const override
|
||||
{
|
||||
return get_binding();
|
||||
}
|
||||
virtual bool is_valid() const;
|
||||
bool is_mock_global_index_invalid() const
|
||||
{
|
||||
return is_mock_global_index_invalid_;
|
||||
}
|
||||
bool is_global_index_table() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
void set_mock_global_index_invalid(const bool is_invalid)
|
||||
{
|
||||
is_mock_global_index_invalid_ = is_invalid;
|
||||
}
|
||||
bool can_read_index() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
inline virtual uint64_t get_table_id() const override { return tablegroup_id_; } // for partition schema used
|
||||
inline virtual uint64_t get_database_id() const { return 0; }
|
||||
inline virtual void set_database_id(const uint64_t database_id) { UNUSED(database_id); }
|
||||
inline virtual void set_table_id(const uint64_t tablegroup_id) override { tablegroup_id_ = tablegroup_id; }
|
||||
inline int64_t get_part_func_expr_num() const override { return part_func_expr_num_; }
|
||||
inline void set_part_func_expr_num(const int64_t part_func_expr_num) override { part_func_expr_num_ = part_func_expr_num; }
|
||||
inline int64_t get_sub_part_func_expr_num() const override { return sub_part_func_expr_num_; }
|
||||
inline void set_sub_part_func_expr_num(const int64_t sub_part_func_expr_num) override { sub_part_func_expr_num_ = sub_part_func_expr_num; }
|
||||
virtual int64_t get_partition_cnt() const override { return 0; }
|
||||
virtual int calc_part_func_expr_num(int64_t &part_func_expr_num) const;
|
||||
virtual int calc_subpart_func_expr_num(int64_t &subpart_func_expr_num) const;
|
||||
//other methods
|
||||
virtual void reset() override;
|
||||
int64_t get_convert_size() const override;
|
||||
virtual bool has_self_partition() const override { return get_binding(); }
|
||||
virtual bool is_valid() const override;
|
||||
bool is_mock_global_index_invalid() const { return is_mock_global_index_invalid_; }
|
||||
bool is_global_index_table() const { return false; }
|
||||
void set_mock_global_index_invalid(const bool is_invalid) {is_mock_global_index_invalid_ = is_invalid; }
|
||||
bool can_read_index() const { return true; }
|
||||
|
||||
DECLARE_VIRTUAL_TO_STRING;
|
||||
|
||||
|
@ -207,150 +207,49 @@ class ObSimpleTableSchemaV2 : public ObPartitionSchema {
|
||||
explicit ObSimpleTableSchemaV2(common::ObIAllocator* allocator);
|
||||
ObSimpleTableSchemaV2(const ObSimpleTableSchemaV2& src_schema) = delete;
|
||||
virtual ~ObSimpleTableSchemaV2();
|
||||
ObSimpleTableSchemaV2& operator=(const ObSimpleTableSchemaV2& other) = delete;
|
||||
int assign(const ObSimpleTableSchemaV2& src_schema);
|
||||
bool operator==(const ObSimpleTableSchemaV2& other) const;
|
||||
void reset();
|
||||
ObSimpleTableSchemaV2 &operator=(const ObSimpleTableSchemaV2 &other) = delete;
|
||||
int assign(const ObSimpleTableSchemaV2 &src_schema);
|
||||
bool operator ==(const ObSimpleTableSchemaV2 &other) const;
|
||||
void reset() override;
|
||||
void reset_partition_schema();
|
||||
bool is_valid() const;
|
||||
bool is_valid() const override;
|
||||
bool is_link_valid() const;
|
||||
int64_t get_convert_size() const;
|
||||
inline void set_tenant_id(const uint64_t tenant_id) override
|
||||
{
|
||||
tenant_id_ = tenant_id;
|
||||
}
|
||||
inline uint64_t get_tenant_id() const override
|
||||
{
|
||||
return tenant_id_;
|
||||
}
|
||||
inline virtual void set_table_id(const uint64_t table_id) override
|
||||
{
|
||||
table_id_ = table_id;
|
||||
}
|
||||
inline virtual uint64_t get_table_id() const override
|
||||
{
|
||||
return table_id_;
|
||||
}
|
||||
inline void set_schema_version(const int64_t schema_version) override
|
||||
{
|
||||
schema_version_ = schema_version;
|
||||
}
|
||||
inline int64_t get_schema_version() const override
|
||||
{
|
||||
return schema_version_;
|
||||
}
|
||||
inline const char* get_locality() const
|
||||
{
|
||||
return extract_str(locality_str_);
|
||||
}
|
||||
virtual const common::ObString& get_locality_str() const override
|
||||
{
|
||||
return locality_str_;
|
||||
}
|
||||
virtual common::ObString& get_locality_str() override
|
||||
{
|
||||
return locality_str_;
|
||||
}
|
||||
inline const char* get_previous_locality() const
|
||||
{
|
||||
return extract_str(previous_locality_str_);
|
||||
}
|
||||
virtual const common::ObString& get_previous_locality_str() const override
|
||||
{
|
||||
return previous_locality_str_;
|
||||
}
|
||||
inline int set_locality(const char* locality)
|
||||
{
|
||||
return deep_copy_str(locality, locality_str_);
|
||||
}
|
||||
inline int set_locality(const common::ObString& locality)
|
||||
{
|
||||
return deep_copy_str(locality, locality_str_);
|
||||
}
|
||||
inline int set_previous_locality(const char* previous_locality)
|
||||
{
|
||||
return deep_copy_str(previous_locality, previous_locality_str_);
|
||||
}
|
||||
inline int set_previous_locality(const common::ObString& previous_locality)
|
||||
{
|
||||
return deep_copy_str(previous_locality, previous_locality_str_);
|
||||
}
|
||||
inline void set_database_id(const uint64_t database_id)
|
||||
{
|
||||
database_id_ = database_id;
|
||||
}
|
||||
inline uint64_t get_database_id() const
|
||||
{
|
||||
return database_id_;
|
||||
}
|
||||
virtual void set_tablegroup_id(const uint64_t tablegroup_id) override
|
||||
{
|
||||
tablegroup_id_ = tablegroup_id;
|
||||
}
|
||||
virtual uint64_t get_tablegroup_id() const override
|
||||
{
|
||||
return tablegroup_id_;
|
||||
}
|
||||
inline void set_data_table_id(const uint64_t data_table_id)
|
||||
{
|
||||
data_table_id_ = data_table_id;
|
||||
}
|
||||
inline uint64_t get_data_table_id() const
|
||||
{
|
||||
return data_table_id_;
|
||||
}
|
||||
inline int set_table_name(const common::ObString& table_name)
|
||||
{
|
||||
return deep_copy_str(table_name, table_name_);
|
||||
}
|
||||
inline const char* get_table_name() const
|
||||
{
|
||||
return extract_str(table_name_);
|
||||
}
|
||||
virtual const char* get_entity_name() const override
|
||||
{
|
||||
return extract_str(table_name_);
|
||||
}
|
||||
inline const common::ObString& get_table_name_str() const
|
||||
{
|
||||
return table_name_;
|
||||
}
|
||||
inline const common::ObString& get_origin_index_name_str() const
|
||||
{
|
||||
return origin_index_name_;
|
||||
}
|
||||
inline void set_name_case_mode(const common::ObNameCaseMode cmp_mode)
|
||||
{
|
||||
name_case_mode_ = cmp_mode;
|
||||
}
|
||||
inline common::ObNameCaseMode get_name_case_mode() const
|
||||
{
|
||||
return name_case_mode_;
|
||||
}
|
||||
inline void set_table_type(const ObTableType table_type)
|
||||
{
|
||||
table_type_ = table_type;
|
||||
}
|
||||
inline ObTableType get_table_type() const
|
||||
{
|
||||
return table_type_;
|
||||
}
|
||||
inline void set_table_mode(const int32_t table_mode)
|
||||
{
|
||||
table_mode_.mode_ = table_mode;
|
||||
}
|
||||
inline int32_t get_table_mode() const
|
||||
{
|
||||
return table_mode_.mode_;
|
||||
}
|
||||
inline void set_table_mode_struct(const ObTableMode table_mode)
|
||||
{
|
||||
table_mode_ = table_mode;
|
||||
}
|
||||
inline ObTableMode get_table_mode_struct() const
|
||||
{
|
||||
return table_mode_;
|
||||
}
|
||||
int64_t get_convert_size() const override;
|
||||
inline void set_tenant_id(const uint64_t tenant_id) override { tenant_id_ = tenant_id; }
|
||||
inline uint64_t get_tenant_id() const override { return tenant_id_; }
|
||||
inline virtual void set_table_id(const uint64_t table_id) override { table_id_ = table_id; }
|
||||
inline virtual uint64_t get_table_id() const override { return table_id_; }
|
||||
inline void set_schema_version(const int64_t schema_version) override { schema_version_ = schema_version; }
|
||||
inline int64_t get_schema_version() const override { return schema_version_; }
|
||||
inline const char *get_locality() const { return extract_str(locality_str_); }
|
||||
virtual const common::ObString &get_locality_str() const override { return locality_str_; }
|
||||
virtual common::ObString &get_locality_str() override { return locality_str_; }
|
||||
inline const char *get_previous_locality() const { return extract_str(previous_locality_str_); }
|
||||
virtual const common::ObString &get_previous_locality_str() const override { return previous_locality_str_; }
|
||||
inline int set_locality(const char *locality) { return deep_copy_str(locality, locality_str_); }
|
||||
inline int set_locality(const common::ObString &locality) { return deep_copy_str(locality, locality_str_); }
|
||||
inline int set_previous_locality(const char *previous_locality) { return deep_copy_str(previous_locality, previous_locality_str_); }
|
||||
inline int set_previous_locality(const common::ObString &previous_locality) { return deep_copy_str(previous_locality, previous_locality_str_); }
|
||||
inline void set_database_id(const uint64_t database_id) { database_id_ = database_id; }
|
||||
inline uint64_t get_database_id() const { return database_id_; }
|
||||
virtual void set_tablegroup_id(const uint64_t tablegroup_id) override { tablegroup_id_ = tablegroup_id; }
|
||||
virtual uint64_t get_tablegroup_id() const override { return tablegroup_id_; }
|
||||
inline void set_data_table_id(const uint64_t data_table_id) { data_table_id_ = data_table_id; }
|
||||
inline uint64_t get_data_table_id() const { return data_table_id_; }
|
||||
inline int set_table_name(const common::ObString &table_name)
|
||||
{ return deep_copy_str(table_name, table_name_); }
|
||||
inline const char *get_table_name() const { return extract_str(table_name_); }
|
||||
virtual const char *get_entity_name() const override { return extract_str(table_name_); }
|
||||
inline const common::ObString &get_table_name_str() const { return table_name_; }
|
||||
inline const common::ObString &get_origin_index_name_str() const { return origin_index_name_; }
|
||||
inline void set_name_case_mode(const common::ObNameCaseMode cmp_mode) { name_case_mode_ = cmp_mode; }
|
||||
inline common::ObNameCaseMode get_name_case_mode() const { return name_case_mode_; }
|
||||
inline void set_table_type(const ObTableType table_type) { table_type_ = table_type; }
|
||||
inline ObTableType get_table_type() const { return table_type_; }
|
||||
inline void set_table_mode(const int32_t table_mode) { table_mode_.mode_ = table_mode; }
|
||||
inline int32_t get_table_mode() const { return table_mode_.mode_; }
|
||||
inline void set_table_mode_struct(const ObTableMode table_mode) { table_mode_ = table_mode; }
|
||||
inline ObTableMode get_table_mode_struct() const { return table_mode_; }
|
||||
inline ObTableModeFlag get_table_mode_flag() const
|
||||
{
|
||||
return (ObTableModeFlag)table_mode_.mode_flag_;
|
||||
@ -361,37 +260,18 @@ class ObSimpleTableSchemaV2 : public ObPartitionSchema {
|
||||
}
|
||||
// Is it a new table without a primary key
|
||||
inline bool is_new_no_pk_table() const
|
||||
{
|
||||
return TPKM_NEW_NO_PK == (enum ObTablePKMode)table_mode_.pk_mode_;
|
||||
}
|
||||
inline int set_primary_zone(const common::ObString& primary_zone)
|
||||
{
|
||||
return deep_copy_str(primary_zone, primary_zone_);
|
||||
}
|
||||
int set_primary_zone_array(const common::ObIArray<ObZoneScore>& primary_zone_array);
|
||||
inline virtual void set_min_partition_id(uint64_t partition_id)
|
||||
{
|
||||
min_partition_id_ = partition_id;
|
||||
}
|
||||
inline void set_session_id(const uint64_t id)
|
||||
{
|
||||
session_id_ = id;
|
||||
}
|
||||
inline virtual uint64_t get_min_partition_id() const
|
||||
{
|
||||
return min_partition_id_;
|
||||
}
|
||||
inline const common::ObString& get_primary_zone() const
|
||||
{
|
||||
return primary_zone_;
|
||||
}
|
||||
inline uint64_t get_session_id() const
|
||||
{
|
||||
return session_id_;
|
||||
}
|
||||
int set_zone_list(const common::ObIArray<common::ObString>& zone_list);
|
||||
int set_zone_list(const common::ObIArray<common::ObZone>& zone_list);
|
||||
int get_zone_list(common::ObIArray<common::ObZone>& zone_list) const;
|
||||
{ return TPKM_NEW_NO_PK == (enum ObTablePKMode)table_mode_.pk_mode_; }
|
||||
inline int set_primary_zone(const common::ObString &primary_zone)
|
||||
{ return deep_copy_str(primary_zone, primary_zone_); }
|
||||
int set_primary_zone_array(const common::ObIArray<ObZoneScore> &primary_zone_array);
|
||||
inline virtual void set_min_partition_id(uint64_t partition_id) override { min_partition_id_ = partition_id; }
|
||||
inline void set_session_id(const uint64_t id) { session_id_ = id; }
|
||||
inline virtual uint64_t get_min_partition_id() const override { return min_partition_id_; }
|
||||
inline const common::ObString &get_primary_zone() const { return primary_zone_; }
|
||||
inline uint64_t get_session_id() const { return session_id_; }
|
||||
int set_zone_list(const common::ObIArray<common::ObString> &zone_list);
|
||||
int set_zone_list(const common::ObIArray<common::ObZone> &zone_list);
|
||||
int get_zone_list(common::ObIArray<common::ObZone> &zone_list) const;
|
||||
virtual int get_zone_list(
|
||||
share::schema::ObSchemaGetterGuard& schema_guard, common::ObIArray<common::ObZone>& zone_list) const override;
|
||||
virtual int get_primary_zone_inherit(
|
||||
|
@ -148,7 +148,7 @@ class ObUDF : public ObSchema {
|
||||
}
|
||||
|
||||
// other
|
||||
int64_t get_convert_size() const;
|
||||
int64_t get_convert_size() const override;
|
||||
virtual void reset() override;
|
||||
bool is_normal_udf() const
|
||||
{
|
||||
|
@ -37,37 +37,51 @@ class ObColStatService : public ObColumnStatDataService {
|
||||
* Caller should not hold ObColumnStat object for a long time that ObColumnStatCache
|
||||
* can not release it.
|
||||
*/
|
||||
int get_column_stat(const ObColumnStat::Key& key, const bool force_new, ObColumnStatValueHandle& handle);
|
||||
int get_column_stat(const ObColumnStat::Key &key,
|
||||
const bool force_new,
|
||||
ObColumnStatValueHandle &handle) override;
|
||||
|
||||
/**
|
||||
* same as above interface, except do not hold object in cache instead of deep copy
|
||||
* so %stat can be written in incremental calculation.
|
||||
*/
|
||||
int get_column_stat(const ObColumnStat::Key& key, const bool force_new, ObColumnStat& stat, ObIAllocator& alloc);
|
||||
int get_column_stat(const ObColumnStat::Key &key,
|
||||
const bool force_new,
|
||||
ObColumnStat &stat,
|
||||
ObIAllocator &alloc) override;
|
||||
|
||||
int get_batch_stat(const uint64_t table_id, const ObIArray<uint64_t>& partition_id,
|
||||
const ObIArray<uint64_t>& column_id, ObIArray<ObColumnStatValueHandle>& handles);
|
||||
int get_batch_stat(const uint64_t table_id,
|
||||
const ObIArray<uint64_t> &partition_id,
|
||||
const ObIArray<uint64_t> &column_id,
|
||||
ObIArray<ObColumnStatValueHandle> &handles) override;
|
||||
|
||||
int get_batch_stat(const share::schema::ObTableSchema& table_schema, const uint64_t partition_id,
|
||||
ObIArray<ObColumnStat*>& stats, ObIAllocator& allocator);
|
||||
int get_batch_stat(const share::schema::ObTableSchema &table_schema,
|
||||
const uint64_t partition_id,
|
||||
ObIArray<ObColumnStat *> &stats,
|
||||
ObIAllocator &allocator) override;
|
||||
/**
|
||||
* item in stats must not NULL, or will return OB_ERR_UNEXPECTED
|
||||
*/
|
||||
int update_column_stats(const ObIArray<ObColumnStat*>& stats);
|
||||
int update_column_stat(const ObColumnStat& stat);
|
||||
int erase_column_stat(const ObPartitionKey& pkey, const int64_t column_id) override;
|
||||
|
||||
private:
|
||||
int load_and_put_cache(const ObColumnStat::Key& key, ObColumnStatValueHandle& handle);
|
||||
int load_and_put_cache(const ObColumnStat::Key& key, ObColumnStat& new_entry, ObColumnStatValueHandle& handle);
|
||||
int batch_load_and_put_cache(const share::schema::ObTableSchema& table_schema, const uint64_t partition_id,
|
||||
ObIArray<ObColumnStatValueHandle>& handles);
|
||||
int batch_load_and_put_cache(const uint64_t table_id, const ObIArray<uint64_t>& partition_ids,
|
||||
const ObIArray<uint64_t>& column_ids, ObIArray<ObColumnStatValueHandle>& handles);
|
||||
int batch_put_and_fetch_row(ObIArray<ObColumnStat*>& col_stats, ObIArray<ObColumnStatValueHandle>& handles);
|
||||
static int deep_copy(ObIAllocator& alloc, const ObColumnStat& src, ObColumnStat& dst);
|
||||
|
||||
private:
|
||||
int update_column_stats(const ObIArray<ObColumnStat *> &stats) override;
|
||||
int update_column_stat(const ObColumnStat &stat) override;
|
||||
int erase_column_stat(const ObPartitionKey &pkey, const int64_t column_id) override;
|
||||
private:
|
||||
int load_and_put_cache(const ObColumnStat::Key &key,
|
||||
ObColumnStatValueHandle &handle);
|
||||
int load_and_put_cache(const ObColumnStat::Key &key,
|
||||
ObColumnStat &new_entry,
|
||||
ObColumnStatValueHandle &handle);
|
||||
int batch_load_and_put_cache(const share::schema::ObTableSchema &table_schema,
|
||||
const uint64_t partition_id,
|
||||
ObIArray<ObColumnStatValueHandle> &handles);
|
||||
int batch_load_and_put_cache(const uint64_t table_id,
|
||||
const ObIArray<uint64_t> &partition_ids,
|
||||
const ObIArray<uint64_t> &column_ids,
|
||||
ObIArray<ObColumnStatValueHandle> &handles);
|
||||
int batch_put_and_fetch_row(ObIArray<ObColumnStat *> &col_stats,
|
||||
ObIArray<ObColumnStatValueHandle> &handles);
|
||||
static int deep_copy(ObIAllocator &alloc, const ObColumnStat &src, ObColumnStat &dst);
|
||||
private:
|
||||
ObTableColStatSqlService sql_service_;
|
||||
ObColumnStatCache column_stat_cache_;
|
||||
bool inited_;
|
||||
|
@ -20,11 +20,15 @@ class ObExprAcos : public ObFuncExprOperator {
|
||||
public:
|
||||
explicit ObExprAcos(common::ObIAllocator& alloc);
|
||||
virtual ~ObExprAcos();
|
||||
virtual int calc_result_type1(ObExprResType& type, ObExprResType& type1, common::ObExprTypeCtx& type_ctx) const;
|
||||
virtual int calc_result1(common::ObObj& result, const common::ObObj& obj, common::ObExprCtx& expr_ctx) const;
|
||||
virtual int cg_expr(ObExprCGCtx& expr_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override;
|
||||
|
||||
private:
|
||||
virtual int calc_result_type1(ObExprResType &type,
|
||||
ObExprResType &type1,
|
||||
common::ObExprTypeCtx &type_ctx) const override;
|
||||
virtual int calc_result1(common::ObObj &result,
|
||||
const common::ObObj &obj,
|
||||
common::ObExprCtx &expr_ctx) const override;
|
||||
virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
|
||||
ObExpr &rt_expr) const override;
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExprAcos);
|
||||
};
|
||||
|
||||
|
@ -22,12 +22,12 @@ namespace sql {
|
||||
class ObExprEqual : public ObRelationalExprOperator {
|
||||
public:
|
||||
ObExprEqual();
|
||||
explicit ObExprEqual(common::ObIAllocator& alloc);
|
||||
virtual ~ObExprEqual(){};
|
||||
virtual int calc_result2(
|
||||
common::ObObj& result, const common::ObObj& obj1, const common::ObObj& obj2, common::ObExprCtx& expr_ctx) const;
|
||||
virtual int calc_resultN(
|
||||
common::ObObj& result, const common::ObObj* objs_stack, int64_t param_num, common::ObExprCtx& expr_ctx) const;
|
||||
explicit ObExprEqual(common::ObIAllocator &alloc);
|
||||
virtual ~ObExprEqual() {};
|
||||
virtual int calc_result2(common::ObObj &result, const common::ObObj &obj1,
|
||||
const common::ObObj &obj2, common::ObExprCtx &expr_ctx) const override;
|
||||
virtual int calc_resultN(common::ObObj &result, const common::ObObj *objs_stack,
|
||||
int64_t param_num, common::ObExprCtx &expr_ctx) const override;
|
||||
|
||||
virtual int cg_expr(ObExprCGCtx& expr_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override
|
||||
{
|
||||
@ -35,16 +35,26 @@ class ObExprEqual : public ObRelationalExprOperator {
|
||||
return ObRelationalExprOperator::cg_expr(expr_cg_ctx, raw_expr, rt_expr);
|
||||
}
|
||||
|
||||
static int calc(common::ObObj& result, const common::ObObj& obj1, const common::ObObj& obj2,
|
||||
const common::ObCompareCtx& cmp_ctx, common::ObCastCtx& cast_ctx);
|
||||
static int calc_cast(common::ObObj& result, const common::ObObj& obj1, const common::ObObj& obj2,
|
||||
const common::ObCompareCtx& cmp_ctx, common::ObCastCtx& cast_ctx);
|
||||
static int calc_without_cast(common::ObObj& result, const common::ObObj& obj1, const common::ObObj& obj2,
|
||||
const common::ObCompareCtx& cmp_ctx, bool& need_cast);
|
||||
virtual int calc_result_type2(
|
||||
ObExprResType& type, ObExprResType& type1, ObExprResType& type2, common::ObExprTypeCtx& type_ctx) const;
|
||||
|
||||
private:
|
||||
static int calc(common::ObObj &result,
|
||||
const common::ObObj &obj1,
|
||||
const common::ObObj &obj2,
|
||||
const common::ObCompareCtx &cmp_ctx,
|
||||
common::ObCastCtx &cast_ctx);
|
||||
static int calc_cast(common::ObObj &result,
|
||||
const common::ObObj &obj1,
|
||||
const common::ObObj &obj2,
|
||||
const common::ObCompareCtx &cmp_ctx,
|
||||
common::ObCastCtx &cast_ctx);
|
||||
static int calc_without_cast(common::ObObj &result,
|
||||
const common::ObObj &obj1,
|
||||
const common::ObObj &obj2,
|
||||
const common::ObCompareCtx &cmp_ctx,
|
||||
bool &need_cast);
|
||||
virtual int calc_result_type2(ObExprResType &type,
|
||||
ObExprResType &type1,
|
||||
ObExprResType &type2,
|
||||
common::ObExprTypeCtx &type_ctx) const override;
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExprEqual);
|
||||
};
|
||||
|
||||
|
@ -21,11 +21,16 @@ class ObExprEstimateNdv : public ObFuncExprOperator {
|
||||
public:
|
||||
explicit ObExprEstimateNdv(common::ObIAllocator& alloc);
|
||||
virtual ~ObExprEstimateNdv();
|
||||
virtual int calc_result_type1(ObExprResType& type, ObExprResType& type1, common::ObExprTypeCtx& type_ctx) const;
|
||||
virtual int calc_result1(common::ObObj& result, const common::ObObj& obj, common::ObExprCtx& expr_ctx) const;
|
||||
static int llc_estimate_ndv(common::ObObj& result, const common::ObObj& obj, common::ObExprCtx& expr_ctx);
|
||||
static void llc_estimate_ndv(int64_t& result, const common::ObString& bitmap_str);
|
||||
static int llc_estimate_ndv(double& estimate_ndv, const common::ObString& bitmap_buf);
|
||||
virtual int calc_result_type1(ObExprResType &type,
|
||||
ObExprResType &type1,
|
||||
common::ObExprTypeCtx &type_ctx) const override;
|
||||
virtual int calc_result1(common::ObObj &result,
|
||||
const common::ObObj &obj,
|
||||
common::ObExprCtx &expr_ctx) const override;
|
||||
static int llc_estimate_ndv(common::ObObj &result, const common::ObObj &obj,
|
||||
common::ObExprCtx &expr_ctx);
|
||||
static void llc_estimate_ndv(int64_t &result, const common::ObString &bitmap_str);
|
||||
static int llc_estimate_ndv(double &estimate_ndv, const common::ObString &bitmap_buf);
|
||||
// high several bits of hash value are used to store bucket_id, the param value must
|
||||
// remove these bits by left shift, the count of valid bits after removing is bit_width.
|
||||
static uint64_t llc_leading_zeros(uint64_t value, uint64_t bit_width);
|
||||
|
@ -20,8 +20,12 @@ class ObExprExists : public ObSubQueryRelationalExpr {
|
||||
explicit ObExprExists(common::ObIAllocator& alloc);
|
||||
virtual ~ObExprExists();
|
||||
|
||||
virtual int calc_result_type1(ObExprResType& type, ObExprResType& type1, common::ObExprTypeCtx& type_ctx) const;
|
||||
virtual int calc_result1(common::ObObj& result, const common::ObObj& obj1, common::ObExprCtx& expr_ctx) const;
|
||||
virtual int calc_result_type1(ObExprResType &type,
|
||||
ObExprResType &type1,
|
||||
common::ObExprTypeCtx &type_ctx) const override;
|
||||
virtual int calc_result1(common::ObObj &result,
|
||||
const common::ObObj &obj1,
|
||||
common::ObExprCtx &expr_ctx) const override;
|
||||
|
||||
virtual int cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override;
|
||||
|
||||
|
@ -23,23 +23,33 @@ class ObExprExtract : public ObFuncExprOperator {
|
||||
public:
|
||||
explicit ObExprExtract(common::ObIAllocator& alloc);
|
||||
virtual ~ObExprExtract();
|
||||
virtual int calc_result_type2(
|
||||
ObExprResType& type, ObExprResType& date_unit, ObExprResType& date, common::ObExprTypeCtx& type_ctx) const;
|
||||
virtual int calc_result_type2(ObExprResType &type,
|
||||
ObExprResType &date_unit,
|
||||
ObExprResType &date,
|
||||
common::ObExprTypeCtx &type_ctx) const override;
|
||||
template <typename T>
|
||||
static int calc(T& result, const int64_t date_unit, const T& date, common::ObObjType date_type,
|
||||
const common::ObCastMode cast_mode, const common::ObTimeZoneInfo* tz_info, const int64_t cur_ts_value);
|
||||
template <typename T>
|
||||
static int calc_oracle(T& result, const int64_t date_unit, const T& date, common::ObObjType type,
|
||||
const ObSQLSessionInfo* session, common::ObIAllocator* calc_buf);
|
||||
virtual int calc_result2(common::ObObj& result, const common::ObObj& date_unit, const common::ObObj& date,
|
||||
common::ObExprCtx& expr_ctx) const;
|
||||
virtual int cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override;
|
||||
static int calc_extract_oracle(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum);
|
||||
static int calc_extract_mysql(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum);
|
||||
|
||||
private:
|
||||
int set_result_type_oracle(
|
||||
common::ObExprTypeCtx& type_ctx, const ObExprResType& date_unit, ObExprResType& res_type) const;
|
||||
static int calc_oracle(T &result,
|
||||
const int64_t date_unit,
|
||||
const T &date,
|
||||
common::ObObjType type,
|
||||
const ObSQLSessionInfo *session,
|
||||
common::ObIAllocator *calc_buf);
|
||||
virtual int calc_result2(common::ObObj &result,
|
||||
const common::ObObj &date_unit,
|
||||
const common::ObObj &date,
|
||||
common::ObExprCtx &expr_ctx) const override;
|
||||
virtual int cg_expr(ObExprCGCtx &op_cg_ctx,
|
||||
const ObRawExpr &raw_expr,
|
||||
ObExpr &rt_expr) const override;
|
||||
static int calc_extract_oracle(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
|
||||
static int calc_extract_mysql(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
|
||||
private:
|
||||
int set_result_type_oracle(common::ObExprTypeCtx &type_ctx,
|
||||
const ObExprResType &date_unit,
|
||||
ObExprResType &res_type) const;
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExprExtract);
|
||||
};
|
||||
|
@ -21,10 +21,12 @@ class ObExprMySQLPort : public ObFuncExprOperator {
|
||||
public:
|
||||
explicit ObExprMySQLPort(common::ObIAllocator& alloc);
|
||||
virtual ~ObExprMySQLPort();
|
||||
virtual int calc_result_type0(ObExprResType& type, common::ObExprTypeCtx& type_ctx) const;
|
||||
virtual int calc_result0(common::ObObj& result, common::ObExprCtx& expr_ctx) const;
|
||||
static int eval_mysql_port(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum);
|
||||
virtual int cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override;
|
||||
virtual int calc_result_type0(ObExprResType &type, common::ObExprTypeCtx &type_ctx) const override;
|
||||
virtual int calc_result0(common::ObObj &result, common::ObExprCtx &expr_ctx) const override;
|
||||
static int eval_mysql_port(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
|
||||
virtual int cg_expr(ObExprCGCtx &op_cg_ctx,
|
||||
const ObRawExpr &raw_expr,
|
||||
ObExpr &rt_expr) const override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExprMySQLPort);
|
||||
|
@ -860,15 +860,20 @@ class ObFuncExprOperator : public ObExprOperator {
|
||||
// In ObRelationalExprOperator, there are three concepts: res_type, cmp_type, calc_type
|
||||
// The first two are relative to the expression; the latter one is relative to the parameters of the expression.
|
||||
//
|
||||
class ObRelationalExprOperator : public ObExprOperator {
|
||||
public:
|
||||
virtual int deserialize(const char* buf, const int64_t data_len, int64_t& pos);
|
||||
|
||||
public:
|
||||
ObRelationalExprOperator(common::ObIAllocator& alloc, ObExprOperatorType type, const char* name, int32_t param_num,
|
||||
int32_t dimension = NOT_ROW_DIMENSION)
|
||||
: ObExprOperator(alloc, type, name, param_num, dimension), cmp_op_func2_(NULL)
|
||||
{}
|
||||
class ObRelationalExprOperator : public ObExprOperator
|
||||
{
|
||||
public:
|
||||
virtual int deserialize(const char *buf, const int64_t data_len, int64_t &pos) override;
|
||||
public:
|
||||
ObRelationalExprOperator(common::ObIAllocator &alloc,
|
||||
ObExprOperatorType type,
|
||||
const char *name,
|
||||
int32_t param_num,
|
||||
int32_t dimension = NOT_ROW_DIMENSION)
|
||||
: ObExprOperator(alloc, type, name, param_num, dimension),
|
||||
cmp_op_func2_(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ObRelationalExprOperator()
|
||||
{}
|
||||
@ -931,8 +936,11 @@ class ObRelationalExprOperator : public ObExprOperator {
|
||||
common::ObCastCtx& cast_ctx, common::ObObjType cmp_type, common::ObCollationType cmp_cs_type);
|
||||
// determine the type used for comparison of the two types
|
||||
// binary comparison
|
||||
virtual int calc_result_type2(
|
||||
ObExprResType& type, ObExprResType& type1, ObExprResType& type2, common::ObExprTypeCtx& type_ctx) const;
|
||||
|
||||
virtual int calc_result_type2(ObExprResType &type,
|
||||
ObExprResType &type1,
|
||||
ObExprResType &type2,
|
||||
common::ObExprTypeCtx &type_ctx) const override;
|
||||
|
||||
// deduce binary comparison result type and parameters types
|
||||
static int deduce_cmp_type(const ObExprOperator& expr, ObExprResType& type, ObExprResType& type1,
|
||||
@ -940,48 +948,73 @@ class ObRelationalExprOperator : public ObExprOperator {
|
||||
|
||||
// for between...and, not between...and etc.
|
||||
// @todo need refactor, ....yzf....Thu, 6 Aug 2015....16:00....
|
||||
virtual int calc_result_type3(ObExprResType& type, ObExprResType& type1, ObExprResType& type2, ObExprResType& type3,
|
||||
common::ObExprTypeCtx& type_ctx) const;
|
||||
virtual int calc_calc_type3(ObExprResType& type1, ObExprResType& type2, ObExprResType& type3,
|
||||
common::ObExprTypeCtx& type_ctx, const common::ObObjType cmp_type) const;
|
||||
int get_cmp_result_type3(ObExprResType& type, bool& need_no_cast, const ObExprResType* types, const int64_t param_num,
|
||||
const sql::ObSQLSessionInfo& my_session);
|
||||
virtual int calc_result_type3(ObExprResType &type,
|
||||
ObExprResType &type1,
|
||||
ObExprResType &type2,
|
||||
ObExprResType &type3,
|
||||
common::ObExprTypeCtx &type_ctx) const override;
|
||||
virtual int calc_calc_type3(ObExprResType &type1,
|
||||
ObExprResType &type2,
|
||||
ObExprResType &type3,
|
||||
common::ObExprTypeCtx &type_ctx,
|
||||
const common::ObObjType cmp_type) const;
|
||||
int get_cmp_result_type3(ObExprResType &type,
|
||||
bool &need_no_cast,
|
||||
const ObExprResType *types,
|
||||
const int64_t param_num,
|
||||
const sql::ObSQLSessionInfo &my_session);
|
||||
|
||||
// vector comparison, e.g. (a,b,c) > (1,2,3)
|
||||
virtual int calc_result_typeN(
|
||||
ObExprResType& type, ObExprResType* types, int64_t param_num, common::ObExprTypeCtx& type_ctx) const;
|
||||
virtual int calc_result2(common::ObObj& result, const common::ObObj& obj1, const common::ObObj& obj2,
|
||||
common::ObExprCtx& expr_ctx, bool is_null_safe, common::ObCmpOp cmp_op) const;
|
||||
virtual int calc_resultN(common::ObObj& result, const common::ObObj* objs_array, int64_t param_num,
|
||||
common::ObExprCtx& expr_ctx, bool is_null_safe, common::ObCmpOp cmp_op) const;
|
||||
virtual int calc_result_typeN(ObExprResType &type,
|
||||
ObExprResType *types,
|
||||
int64_t param_num,
|
||||
common::ObExprTypeCtx &type_ctx) const override;
|
||||
virtual int calc_result2(common::ObObj &result, const common::ObObj &obj1,
|
||||
const common::ObObj &obj2,
|
||||
common::ObExprCtx &expr_ctx, bool is_null_safe,
|
||||
common::ObCmpOp cmp_op) const;
|
||||
virtual int calc_resultN(common::ObObj &result,
|
||||
const common::ObObj *objs_array,
|
||||
int64_t param_num,
|
||||
common::ObExprCtx &expr_ctx,
|
||||
bool is_null_safe,
|
||||
common::ObCmpOp cmp_op) const;
|
||||
|
||||
static int is_equivalent(
|
||||
const common::ObObjMeta& meta1, const common::ObObjMeta& meta2, const common::ObObjMeta& meta3, bool& result);
|
||||
int assign(const ObExprOperator& other);
|
||||
int set_cmp_func(const common::ObObjType type1, const common::ObObjType type2);
|
||||
common::obj_cmp_func get_cmp_fun() const
|
||||
{
|
||||
return cmp_op_func2_;
|
||||
}
|
||||
static int is_equivalent(const common::ObObjMeta &meta1,
|
||||
const common::ObObjMeta &meta2,
|
||||
const common::ObObjMeta &meta3,
|
||||
bool &result);
|
||||
int assign(const ObExprOperator &other) override;
|
||||
int set_cmp_func(const common::ObObjType type1,
|
||||
const common::ObObjType type2);
|
||||
common::obj_cmp_func get_cmp_fun() const { return cmp_op_func2_; }
|
||||
|
||||
// pure virtual but implemented, derived classes can use this implement.
|
||||
virtual int cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override = 0;
|
||||
// pure virtual but implemented, derived classes can use this implement.
|
||||
virtual int cg_expr(ObExprCGCtx &op_cg_ctx,
|
||||
const ObRawExpr &raw_expr,
|
||||
ObExpr &rt_expr) const override = 0;
|
||||
|
||||
static int cg_row_cmp_expr(const int row_dim, common::ObIAllocator& allocator, const ObRawExpr& raw_expr,
|
||||
const ObExprOperatorInputTypeArray& input_types, ObExpr& rt_expr);
|
||||
static int cg_datum_cmp_expr(
|
||||
const ObRawExpr& raw_expr, const ObExprOperatorInputTypeArray& input_types, ObExpr& rt_expr);
|
||||
static int cg_row_cmp_expr(const int row_dim, common::ObIAllocator &allocator,
|
||||
const ObRawExpr &raw_expr,
|
||||
const ObExprOperatorInputTypeArray &input_types,
|
||||
ObExpr &rt_expr);
|
||||
static int cg_datum_cmp_expr(const ObRawExpr &raw_expr,
|
||||
const ObExprOperatorInputTypeArray &input_types,
|
||||
ObExpr &rt_expr);
|
||||
|
||||
static int is_row_cmp(const ObRawExpr&, int& row_dim);
|
||||
static int row_eval(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datm);
|
||||
static int is_row_cmp(const ObRawExpr&, int &row_dim);
|
||||
static int row_eval(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datm);
|
||||
|
||||
// row compare
|
||||
// CAUTION: null safe equal row compare is not included.
|
||||
static int row_cmp(
|
||||
const ObExpr& expr, ObDatum& expr_datum, ObExpr** l_row, ObEvalCtx& l_ctx, ObExpr** r_row, ObEvalCtx& r_ctx);
|
||||
// row compare
|
||||
// CAUTION: null safe equal row compare is not included.
|
||||
static int row_cmp(const ObExpr &expr, ObDatum &expr_datum,
|
||||
ObExpr **l_row, ObEvalCtx &l_ctx, ObExpr **r_row, ObEvalCtx &r_ctx);
|
||||
|
||||
OB_INLINE static int get_comparator_operands(const ObExpr& expr, ObEvalCtx& ctx, common::ObDatum*& left,
|
||||
common::ObDatum*& right, ObDatum& result, bool& is_finish)
|
||||
OB_INLINE static int get_comparator_operands(
|
||||
const ObExpr &expr,
|
||||
ObEvalCtx &ctx,
|
||||
common::ObDatum *&left, common::ObDatum *&right,
|
||||
ObDatum &result, bool &is_finish)
|
||||
{
|
||||
int ret = common::OB_SUCCESS;
|
||||
if (OB_FAIL(expr.args_[0]->eval(ctx, left))) {
|
||||
@ -1166,30 +1199,41 @@ class ObSubQueryRelationalExpr : public ObExprOperator {
|
||||
{
|
||||
right_is_iter_ = is_iter;
|
||||
}
|
||||
virtual void reset()
|
||||
virtual void reset() override
|
||||
{
|
||||
subquery_key_ = T_WITH_NONE;
|
||||
left_is_iter_ = false;
|
||||
right_is_iter_ = false;
|
||||
}
|
||||
virtual int calc_result_type2(
|
||||
ObExprResType& type, ObExprResType& type1, ObExprResType& type2, common::ObExprTypeCtx& type_ctx) const;
|
||||
virtual int calc_result_typeN(
|
||||
ObExprResType& type, ObExprResType* types, int64_t param_num, common::ObExprTypeCtx& type_ctx) const;
|
||||
int calc_result2(
|
||||
common::ObObj& result, const common::ObObj& obj1, const common::ObObj& obj2, common::ObExprCtx& expr_ctx) const;
|
||||
int calc_resultN(
|
||||
common::ObObj& result, const common::ObObj* param_array, int64_t param_num, common::ObExprCtx& expr_ctx) const;
|
||||
virtual int call(common::ObObj* stack, int64_t& stack_size, common::ObExprCtx& expr_ctx) const;
|
||||
virtual int eval(
|
||||
common::ObExprCtx& expr_ctx, common::ObObj& val, common::ObObj* params, int64_t param_num) const override;
|
||||
virtual int calc_result_type2(ObExprResType &type,
|
||||
ObExprResType &type1,
|
||||
ObExprResType &type2,
|
||||
common::ObExprTypeCtx &type_ctx) const override;
|
||||
virtual int calc_result_typeN(ObExprResType &type,
|
||||
ObExprResType *types,
|
||||
int64_t param_num,
|
||||
common::ObExprTypeCtx &type_ctx) const override;
|
||||
int calc_result2(common::ObObj &result,
|
||||
const common::ObObj &obj1,
|
||||
const common::ObObj &obj2,
|
||||
common::ObExprCtx &expr_ctx) const override;
|
||||
int calc_resultN(common::ObObj &result,
|
||||
const common::ObObj *param_array,
|
||||
int64_t param_num,
|
||||
common::ObExprCtx &expr_ctx) const override;
|
||||
virtual int call(common::ObObj *stack, int64_t &stack_size, common::ObExprCtx &expr_ctx) const override;
|
||||
virtual int eval(common::ObExprCtx &expr_ctx, common::ObObj &val,
|
||||
common::ObObj *params, int64_t param_num) const override;
|
||||
|
||||
static int subquery_cmp_eval(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum);
|
||||
static int subquery_cmp_eval(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
|
||||
|
||||
VIRTUAL_TO_STRING_KV(N_EXPR_TYPE, get_type_name(type_), N_REAL_PARAM_NUM, real_param_num_, N_RESULT_TYPE,
|
||||
result_type_, K_(subquery_key), K_(left_is_iter), K_(right_is_iter));
|
||||
|
||||
protected:
|
||||
VIRTUAL_TO_STRING_KV(N_EXPR_TYPE, get_type_name(type_),
|
||||
N_REAL_PARAM_NUM, real_param_num_,
|
||||
N_RESULT_TYPE, result_type_,
|
||||
K_(subquery_key),
|
||||
K_(left_is_iter),
|
||||
K_(right_is_iter));
|
||||
protected:
|
||||
// The result of processing the subquery is a vector. In this case, the result
|
||||
// of the subquery has at most one row of data, and multiple rows of data are not allowed.
|
||||
// According to the characteristics of the vector, the result of the subquery
|
||||
|
@ -21,12 +21,17 @@ class ObExprQuote : public ObStringExprOperator {
|
||||
ObExprQuote();
|
||||
explicit ObExprQuote(common::ObIAllocator& alloc);
|
||||
virtual ~ObExprQuote();
|
||||
virtual int calc_result_type1(ObExprResType& type, ObExprResType& type1, common::ObExprTypeCtx& type_ctx) const;
|
||||
virtual int calc_result1(common::ObObj& result, const common::ObObj& obj, common::ObExprCtx& expr_ctx) const;
|
||||
virtual int cg_expr(ObExprCGCtx& expr_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override;
|
||||
static int calc_quote_expr(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& res_datum);
|
||||
|
||||
private:
|
||||
virtual int calc_result_type1(ObExprResType &type,
|
||||
ObExprResType &type1,
|
||||
common::ObExprTypeCtx &type_ctx) const override;
|
||||
virtual int calc_result1(common::ObObj &result,
|
||||
const common::ObObj &obj,
|
||||
common::ObExprCtx &expr_ctx) const override;
|
||||
virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
|
||||
ObExpr &rt_expr) const override;
|
||||
static int calc_quote_expr(const ObExpr &expr, ObEvalCtx &ctx,
|
||||
ObDatum &res_datum);
|
||||
private:
|
||||
static const int16_t APPEND_LEN = 2;
|
||||
static const int16_t LEN_OF_NULL = 4;
|
||||
// quote string
|
||||
|
@ -26,9 +26,11 @@ class ObExprSubQueryEqual : public ObSubQueryRelationalExpr {
|
||||
return ObSubQueryRelationalExpr::cg_expr(op_cg_ctx, raw_expr, rt_expr);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual int compare_single_row(const common::ObNewRow& left_row, const common::ObNewRow& right_row,
|
||||
common::ObExprCtx& expr_ctx, common::ObObj& result) const;
|
||||
private:
|
||||
virtual int compare_single_row(const common::ObNewRow &left_row,
|
||||
const common::ObNewRow &right_row,
|
||||
common::ObExprCtx &expr_ctx,
|
||||
common::ObObj &result) const override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExprSubQueryEqual);
|
||||
|
@ -395,10 +395,7 @@ struct ObExprOperatorFetcher : public ObSqlExpression {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
op_ = NULL;
|
||||
}
|
||||
void reset() override { op_ = NULL; }
|
||||
|
||||
const ObExprOperator* op_;
|
||||
};
|
||||
|
@ -103,16 +103,14 @@ class ObDeterminateTaskTransmit : public ObDistributedTransmit {
|
||||
|
||||
typedef common::hash::ObHashMap<int64_t, int64_t, common::hash::NoPthreadDefendMode> Id2IdxMap;
|
||||
typedef common::hash::ObHashSet<ObTaskID> TaskIDSet;
|
||||
public:
|
||||
explicit ObDeterminateTaskTransmit(common::ObIAllocator &alloc);
|
||||
virtual ~ObDeterminateTaskTransmit() {}
|
||||
|
||||
public:
|
||||
explicit ObDeterminateTaskTransmit(common::ObIAllocator& alloc);
|
||||
virtual ~ObDeterminateTaskTransmit()
|
||||
{}
|
||||
|
||||
virtual int init_op_ctx(ObExecContext& exec_ctx) const override;
|
||||
virtual int inner_open(ObExecContext& exec_ctx) const override;
|
||||
virtual int inner_close(ObExecContext& ctx) const override;
|
||||
virtual OperatorOpenOrder get_operator_open_order(ObExecContext& ctx) const;
|
||||
virtual int init_op_ctx(ObExecContext &exec_ctx) const override;
|
||||
virtual int inner_open(ObExecContext &exec_ctx) const override;
|
||||
virtual int inner_close(ObExecContext &ctx) const override;
|
||||
virtual OperatorOpenOrder get_operator_open_order(ObExecContext &ctx) const override;
|
||||
typedef common::ObFixedArray<ObTaskInfo::ObRangeLocation, common::ObIAllocator> RangeLocations;
|
||||
typedef common::ObFixedArray<TaskIndex, common::ObIAllocator> Tasks;
|
||||
typedef common::ObFixedArray<common::ObFixedArray<common::ObNewRange, common::ObIAllocator>, common::ObIAllocator>
|
||||
|
@ -124,7 +124,7 @@ class ObDistributedTransmit : public ObTransmit {
|
||||
explicit ObDistributedTransmit(common::ObIAllocator& alloc);
|
||||
virtual ~ObDistributedTransmit();
|
||||
|
||||
virtual int create_operator_input(ObExecContext& ctx) const;
|
||||
virtual int create_operator_input(ObExecContext& ctx) const override;
|
||||
inline void set_shuffle_func(ObSqlExpression* shuffle_func);
|
||||
int get_part_shuffle_key(
|
||||
const share::schema::ObTableSchema* table_schema, int64_t part_idx, ObShuffleKey& part_shuffle_key) const;
|
||||
@ -133,29 +133,36 @@ class ObDistributedTransmit : public ObTransmit {
|
||||
int get_shuffle_part_key(const share::schema::ObTableSchema* table_schema, int64_t part_idx, int64_t subpart_idx,
|
||||
common::ObPartitionKey& shuffle_part_key) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
int init_slice_infos(
|
||||
const share::schema::ObTableSchema& table_schema, common::ObIArray<ObSliceInfo>& slices_info) const;
|
||||
int get_slice_idx(ObExecContext& exec_ctx, const share::schema::ObTableSchema* table_schema,
|
||||
const common::ObNewRow* row, const ObSqlExpression& part_partition_func,
|
||||
const ObSqlExpression& subpart_partition_func, const ObIArray<ObTransmitRepartColumn>& repart_columns,
|
||||
const ObIArray<ObTransmitRepartColumn>& repart_sub_columns, int64_t slices_count, int64_t& slice_idx,
|
||||
bool& no_match_partiton) const;
|
||||
const share::schema::ObTableSchema &table_schema,
|
||||
common::ObIArray<ObSliceInfo> &slices_info) const;
|
||||
int get_slice_idx(
|
||||
ObExecContext &exec_ctx,
|
||||
const share::schema::ObTableSchema *table_schema,
|
||||
const common::ObNewRow *row,
|
||||
const ObSqlExpression &part_partition_func,
|
||||
const ObSqlExpression &subpart_partition_func,
|
||||
const ObIArray<ObTransmitRepartColumn> &repart_columns,
|
||||
const ObIArray<ObTransmitRepartColumn> &repart_sub_columns,
|
||||
int64_t slices_count,
|
||||
int64_t &slice_idx,
|
||||
bool &no_match_partiton) const;
|
||||
|
||||
protected:
|
||||
virtual int inner_open(ObExecContext& exec_ctx) const;
|
||||
protected:
|
||||
virtual int inner_open(ObExecContext &exec_ctx) const override;
|
||||
/**
|
||||
* @brief init operator context, will create a physical operator context (and a current row space)
|
||||
* @param ctx[in], execute context
|
||||
* @return if success, return OB_SUCCESS, otherwise, return errno
|
||||
*/
|
||||
virtual int init_op_ctx(ObExecContext& ctx) const;
|
||||
virtual int init_op_ctx(ObExecContext &ctx) const override;
|
||||
bool skip_empty_slice() const;
|
||||
int prepare_interm_result(ObIntermResultManager& interm_result_mgr, ObIntermResult*& interm_result) const;
|
||||
int get_next_row(ObExecContext& ctx, const ObNewRow*& row) const override;
|
||||
int inner_get_next_row(ObExecContext& ctx, const ObNewRow*& row) const;
|
||||
|
||||
private:
|
||||
int prepare_interm_result(ObIntermResultManager &interm_result_mgr,
|
||||
ObIntermResult *&interm_result) const;
|
||||
int get_next_row(ObExecContext &ctx, const ObNewRow *&row) const override;
|
||||
int inner_get_next_row(ObExecContext &ctx, const ObNewRow *&row) const override;
|
||||
private:
|
||||
const static int64_t NO_MATCH_PARTITION = -2;
|
||||
ObSqlExpression* shuffle_func_;
|
||||
|
||||
|
@ -464,10 +464,9 @@ class RelExprPointerChecker : public RelExprCheckerBase {
|
||||
virtual ~RelExprPointerChecker()
|
||||
{}
|
||||
virtual int init(int64_t bucket_num = CHECKER_BUCKET_NUM) override;
|
||||
int add_expr(ObRawExpr*& expr);
|
||||
|
||||
private:
|
||||
common::ObIArray<ObRawExprPointer>& rel_array_;
|
||||
int add_expr(ObRawExpr *&expr) override;
|
||||
private:
|
||||
common::ObIArray<ObRawExprPointer> &rel_array_;
|
||||
common::hash::ObHashMap<uint64_t, uint64_t, common::hash::NoPthreadDefendMode> expr_id_map_;
|
||||
};
|
||||
|
||||
|
@ -282,9 +282,13 @@ int ObShardingInfo::is_compatible_partition_key(const common::ObIArray<ObRawExpr
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObShardingInfo::check_if_match_partition_wise(ObLogPlan& log_plan, const EqualSets& equal_sets,
|
||||
const common::ObIArray<ObRawExpr*>& left_keys, const common::ObIArray<ObRawExpr*>& right_keys,
|
||||
const ObShardingInfo& left_sharding, const ObShardingInfo& right_sharding, bool& is_partition_wise)
|
||||
int ObShardingInfo::check_if_match_partition_wise(ObLogPlan &log_plan __attribute__((unused)),
|
||||
const EqualSets &equal_sets,
|
||||
const common::ObIArray<ObRawExpr*> &left_keys,
|
||||
const common::ObIArray<ObRawExpr*> &right_keys,
|
||||
const ObShardingInfo &left_sharding,
|
||||
const ObShardingInfo &right_sharding,
|
||||
bool &is_partition_wise)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_key_covered = false;
|
||||
@ -384,8 +388,10 @@ int ObShardingInfo::check_if_match_repart(const EqualSets& equal_sets, const ObI
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObShardingInfo::is_physically_equal_partitioned(ObLogPlan& log_plan, const ObShardingInfo& left_sharding,
|
||||
const ObShardingInfo& right_sharding, bool& is_physical_equal)
|
||||
int ObShardingInfo::is_physically_equal_partitioned(ObLogPlan &log_plan __attribute__((unused)),
|
||||
const ObShardingInfo &left_sharding,
|
||||
const ObShardingInfo &right_sharding,
|
||||
bool &is_physical_equal)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ret = is_physically_equal_partitioned(left_sharding, right_sharding, is_physical_equal);
|
||||
|
@ -216,7 +216,9 @@ int parse_sql_stmt(ParseResult* parse_result)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void setup_token_pos_info(ParseNode* node, int off, int len)
|
||||
void setup_token_pos_info(ParseNode *node __attribute__((unused)),
|
||||
int off __attribute__((unused)),
|
||||
int len __attribute__((unused)))
|
||||
{
|
||||
#ifdef SQL_PARSER_COMPILATION
|
||||
node->token_off_ = off;
|
||||
@ -226,7 +228,10 @@ void setup_token_pos_info(ParseNode* node, int off, int len)
|
||||
#endif
|
||||
}
|
||||
|
||||
int setup_token_pos_info_and_dup_string(ParseNode* node, ParseResult* result, int start, int end)
|
||||
int setup_token_pos_info_and_dup_string(ParseNode *node __attribute__((unused)),
|
||||
ParseResult *result __attribute__((unused)),
|
||||
int start __attribute__((unused)),
|
||||
int end __attribute__((unused)))
|
||||
{
|
||||
int ret = OB_PARSER_SUCCESS;
|
||||
#ifdef SQL_PARSER_COMPILATION
|
||||
|
@ -76425,9 +76425,9 @@ YY_BUFFER_STATE obsql_mysql_yy_scan_bytes (yyconst char * yybytes, int _yybyte
|
||||
#define YY_EXIT_FAILURE 2
|
||||
#endif
|
||||
|
||||
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
|
||||
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner __attribute__((unused)))
|
||||
{
|
||||
(void) fprintf( stderr, "%s\n", msg );
|
||||
(void) fprintf( stderr, "%s\n", msg );
|
||||
exit( YY_EXIT_FAILURE );
|
||||
}
|
||||
|
||||
|
@ -34,19 +34,18 @@ class ObBlockCacheWorkingSet : public common::ObIKVCache<ObMicroBlockCacheKey, O
|
||||
}
|
||||
void reset();
|
||||
|
||||
virtual int add_put_size(const int64_t put_size);
|
||||
virtual int get_cache(BaseBlockCache*& cache);
|
||||
virtual int get_allocator(common::ObIAllocator*& allocator);
|
||||
virtual int add_put_size(const int64_t put_size) override;
|
||||
virtual int get_cache(BaseBlockCache *&cache) override;
|
||||
virtual int get_allocator(common::ObIAllocator *&allocator) override;
|
||||
|
||||
virtual int put(const Key& key, const Value& value, bool overwrite = true);
|
||||
virtual int put_and_fetch(
|
||||
const Key& key, const Value& value, const Value*& pvalue, common::ObKVCacheHandle& handle, bool overwrite = true);
|
||||
virtual int get(const Key& key, const Value*& pvalue, common::ObKVCacheHandle& handle);
|
||||
virtual int erase(const Key& key);
|
||||
virtual int alloc(const uint64_t tenant_id, const int64_t key_size, const int64_t value_size, ObKVCachePair*& kvpair,
|
||||
ObKVCacheHandle& handle, ObKVCacheInstHandle& inst_handle) override;
|
||||
|
||||
private:
|
||||
virtual int put(const Key &key, const Value &value, bool overwrite = true) override;
|
||||
virtual int put_and_fetch(const Key &key, const Value &value, const Value *&pvalue,
|
||||
common::ObKVCacheHandle &handle, bool overwrite = true) override;
|
||||
virtual int get(const Key &key, const Value *&pvalue, common::ObKVCacheHandle &handle) override;
|
||||
virtual int erase(const Key &key) override;
|
||||
virtual int alloc(const uint64_t tenant_id, const int64_t key_size, const int64_t value_size,
|
||||
ObKVCachePair *&kvpair, ObKVCacheHandle &handle, ObKVCacheInstHandle &inst_handle) override;
|
||||
private:
|
||||
int create_working_set_if_need();
|
||||
static const int64_t USE_WORKING_SET_THRESHOLD = 1024 * 1024 * 1024 * 1024LL; // disable working set
|
||||
bool inited_;
|
||||
|
@ -1628,10 +1628,7 @@ struct ObServerSuperBlock : public blocksstable::ObISuperBlock {
|
||||
|
||||
ObServerSuperBlock();
|
||||
|
||||
virtual int64_t get_timestamp() const
|
||||
{
|
||||
return content_.modify_timestamp_;
|
||||
}
|
||||
virtual int64_t get_timestamp() const override { return content_.modify_timestamp_; }
|
||||
virtual bool is_valid() const override;
|
||||
virtual void reset() override;
|
||||
VIRTUAL_NEED_SERIALIZE_AND_DESERIALIZE;
|
||||
|
@ -37,30 +37,57 @@ class ObMicroBlockGetReader : public ObIMicroBlockGetReader {
|
||||
public:
|
||||
ObMicroBlockGetReader();
|
||||
virtual ~ObMicroBlockGetReader();
|
||||
virtual int get_row(const uint64_t tenant_id, const ObMicroBlockData& block_data, const common::ObStoreRowkey& rowkey,
|
||||
const ObColumnMap& column_map, const ObFullMacroBlockMeta& macro_meta,
|
||||
const storage::ObSSTableRowkeyHelper* rowkey_helper, storage::ObStoreRow& row);
|
||||
virtual int get_row(const uint64_t tenant_id, const ObMicroBlockData& block_data, const common::ObStoreRowkey& rowkey,
|
||||
const ObFullMacroBlockMeta& macro_meta, const storage::ObSSTableRowkeyHelper* rowkey_helper,
|
||||
storage::ObStoreRow& row);
|
||||
virtual int exist_row(const uint64_t tenant_id, const ObMicroBlockData& block_data,
|
||||
const common::ObStoreRowkey& rowkey, const ObFullMacroBlockMeta& macro_meta,
|
||||
const storage::ObSSTableRowkeyHelper* rowkey_helper, bool& exist, bool& found);
|
||||
virtual int check_row_locked(memtable::ObIMvccCtx& ctx, const transaction::ObTransStateTableGuard& trans_table_guard,
|
||||
const transaction::ObTransID& read_trans_id, const ObMicroBlockData& block_data,
|
||||
const common::ObStoreRowkey& rowkey, const ObFullMacroBlockMeta& macro_meta,
|
||||
const storage::ObSSTableRowkeyHelper* rowkey_helper, storage::ObStoreRowLockState& lock_state) override;
|
||||
|
||||
protected:
|
||||
int inner_init(const ObMicroBlockData& block_data);
|
||||
virtual int check_row_locked_(ObIRowReader* row_reader_ptr, memtable::ObIMvccCtx& ctx,
|
||||
const transaction::ObTransStateTableGuard& trans_table_guard, const transaction::ObTransID& read_trans_id,
|
||||
const ObMicroBlockData& block_data, const common::ObStoreRowkey& rowkey, const ObFullMacroBlockMeta& macro_meta,
|
||||
const storage::ObSSTableRowkeyHelper* rowkey_helper, storage::ObStoreRowLockState& lock_state);
|
||||
virtual int locate_row(const common::ObStoreRowkey& rowkey, const storage::ObSSTableRowkeyHelper* rowkey_helper,
|
||||
const common::ObObjMeta* cols_type, const char*& row_buf, int64_t& row_len);
|
||||
|
||||
protected:
|
||||
virtual int get_row(
|
||||
const uint64_t tenant_id,
|
||||
const ObMicroBlockData &block_data,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const ObColumnMap &column_map,
|
||||
const ObFullMacroBlockMeta ¯o_meta,
|
||||
const storage::ObSSTableRowkeyHelper *rowkey_helper,
|
||||
storage::ObStoreRow &row) override;
|
||||
virtual int get_row(
|
||||
const uint64_t tenant_id,
|
||||
const ObMicroBlockData &block_data,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const ObFullMacroBlockMeta ¯o_meta,
|
||||
const storage::ObSSTableRowkeyHelper *rowkey_helper,
|
||||
storage::ObStoreRow &row) override;
|
||||
virtual int exist_row(
|
||||
const uint64_t tenant_id,
|
||||
const ObMicroBlockData &block_data,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const ObFullMacroBlockMeta ¯o_meta,
|
||||
const storage::ObSSTableRowkeyHelper *rowkey_helper,
|
||||
bool &exist,
|
||||
bool &found) override;
|
||||
virtual int check_row_locked(
|
||||
memtable::ObIMvccCtx &ctx,
|
||||
const transaction::ObTransStateTableGuard &trans_table_guard,
|
||||
const transaction::ObTransID &read_trans_id,
|
||||
const ObMicroBlockData &block_data,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const ObFullMacroBlockMeta ¯o_meta,
|
||||
const storage::ObSSTableRowkeyHelper *rowkey_helper,
|
||||
storage::ObStoreRowLockState &lock_state) override;
|
||||
protected:
|
||||
int inner_init(const ObMicroBlockData &block_data);
|
||||
virtual int check_row_locked_(
|
||||
ObIRowReader *row_reader_ptr,
|
||||
memtable::ObIMvccCtx &ctx,
|
||||
const transaction::ObTransStateTableGuard &trans_table_guard,
|
||||
const transaction::ObTransID &read_trans_id,
|
||||
const ObMicroBlockData &block_data,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const ObFullMacroBlockMeta ¯o_meta,
|
||||
const storage::ObSSTableRowkeyHelper *rowkey_helper,
|
||||
storage::ObStoreRowLockState &lock_state);
|
||||
virtual int locate_row(
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const storage::ObSSTableRowkeyHelper *rowkey_helper,
|
||||
const common::ObObjMeta *cols_type,
|
||||
const char *&row_buf,
|
||||
int64_t &row_len);
|
||||
protected:
|
||||
common::ObArenaAllocator allocator_;
|
||||
const ObMicroBlockHeader* header_;
|
||||
const char* data_begin_;
|
||||
@ -73,27 +100,51 @@ class ObMultiVersionBlockGetReader : public ObMicroBlockGetReader {
|
||||
public:
|
||||
ObMultiVersionBlockGetReader();
|
||||
virtual ~ObMultiVersionBlockGetReader();
|
||||
virtual int get_row(const uint64_t tenant_id, const ObMicroBlockData& block_data, const common::ObStoreRowkey& rowkey,
|
||||
const ObColumnMap& column_map, const ObFullMacroBlockMeta& macro_meta,
|
||||
const storage::ObSSTableRowkeyHelper* rowkey_helper, storage::ObStoreRow& row);
|
||||
virtual int get_row(const uint64_t tenant_id, const ObMicroBlockData& block_data, const common::ObStoreRowkey& rowkey,
|
||||
const ObFullMacroBlockMeta& macro_meta, const storage::ObSSTableRowkeyHelper* rowkey_helper,
|
||||
storage::ObStoreRow& row);
|
||||
virtual int exist_row(const uint64_t tenant_id, const ObMicroBlockData& block_data,
|
||||
const common::ObStoreRowkey& rowkey, const ObFullMacroBlockMeta& macro_meta,
|
||||
const storage::ObSSTableRowkeyHelper* rowkey_helper, bool& exist, bool& found);
|
||||
virtual int check_row_locked(memtable::ObIMvccCtx& ctx, const transaction::ObTransStateTableGuard& trans_table_guard,
|
||||
const transaction::ObTransID& read_trans_id, const ObMicroBlockData& block_data,
|
||||
const common::ObStoreRowkey& rowkey, const ObFullMacroBlockMeta& macro_meta,
|
||||
const storage::ObSSTableRowkeyHelper* rowkey_helper, storage::ObStoreRowLockState& lock_state) override;
|
||||
|
||||
protected:
|
||||
virtual int locate_row(const common::ObStoreRowkey& rowkey, const storage::ObSSTableRowkeyHelper* rowkey_helper,
|
||||
const common::ObObjMeta* cols_type, const char*& row_buf, int64_t& row_len) override;
|
||||
|
||||
private:
|
||||
int get_trans_version(const common::ObStoreRowkey& rowkey, const common::ObObjMeta* cols_type, const int64_t target,
|
||||
int64_t& trans_version);
|
||||
virtual int get_row(
|
||||
const uint64_t tenant_id,
|
||||
const ObMicroBlockData &block_data,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const ObColumnMap &column_map,
|
||||
const ObFullMacroBlockMeta ¯o_meta,
|
||||
const storage::ObSSTableRowkeyHelper *rowkey_helper,
|
||||
storage::ObStoreRow &row) override;
|
||||
virtual int get_row(
|
||||
const uint64_t tenant_id,
|
||||
const ObMicroBlockData &block_data,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const ObFullMacroBlockMeta ¯o_meta,
|
||||
const storage::ObSSTableRowkeyHelper *rowkey_helper,
|
||||
storage::ObStoreRow &row) override;
|
||||
virtual int exist_row(
|
||||
const uint64_t tenant_id,
|
||||
const ObMicroBlockData &block_data,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const ObFullMacroBlockMeta ¯o_meta,
|
||||
const storage::ObSSTableRowkeyHelper *rowkey_helper,
|
||||
bool &exist,
|
||||
bool &found) override;
|
||||
virtual int check_row_locked(
|
||||
memtable::ObIMvccCtx &ctx,
|
||||
const transaction::ObTransStateTableGuard &trans_table_guard,
|
||||
const transaction::ObTransID &read_trans_id,
|
||||
const ObMicroBlockData &block_data,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const ObFullMacroBlockMeta ¯o_meta,
|
||||
const storage::ObSSTableRowkeyHelper *rowkey_helper,
|
||||
storage::ObStoreRowLockState &lock_state) override;
|
||||
protected:
|
||||
virtual int locate_row(
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const storage::ObSSTableRowkeyHelper *rowkey_helper,
|
||||
const common::ObObjMeta *cols_type,
|
||||
const char *&row_buf,
|
||||
int64_t &row_len) override;
|
||||
private:
|
||||
int get_trans_version(
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const common::ObObjMeta *cols_type,
|
||||
const int64_t target,
|
||||
int64_t &trans_version);
|
||||
};
|
||||
|
||||
class ObMicroBlockReader : public ObIMicroBlockReader {
|
||||
@ -106,29 +157,43 @@ class ObMicroBlockReader : public ObIMicroBlockReader {
|
||||
virtual ~ObMicroBlockReader();
|
||||
virtual int init(const ObMicroBlockData& block_data, const ObColumnMap* column_map,
|
||||
const common::ObRowStoreType out_type = common::FLAT_ROW_STORE) override;
|
||||
virtual void reset();
|
||||
virtual int get_row(const int64_t index, storage::ObStoreRow& row) override;
|
||||
virtual int get_rows(const int64_t begin_index, const int64_t end_index, const int64_t row_capacity,
|
||||
storage::ObStoreRow* rows, int64_t& row_count) override;
|
||||
virtual int get_row_count(int64_t& row_count) override;
|
||||
virtual int get_row_header(const int64_t row_idx, const ObRowHeader*& row_header) override;
|
||||
virtual int get_multi_version_info(const int64_t row_idx, const int64_t version_column_idx,
|
||||
const int64_t sql_sequence_idx, storage::ObMultiVersionRowFlag& flag, transaction::ObTransID& trans_id,
|
||||
int64_t& version, int64_t& sql_sequence) override;
|
||||
|
||||
protected:
|
||||
int base_init(const ObMicroBlockData& block_data);
|
||||
virtual int find_bound(const common::ObStoreRowkey& key, const bool lower_bound, const int64_t begin_idx,
|
||||
const int64_t end_idx, int64_t& row_idx, bool& equal);
|
||||
|
||||
private:
|
||||
int get_row_impl(const int64_t index, storage::ObStoreRow& row);
|
||||
|
||||
protected:
|
||||
const ObMicroBlockHeader* header_;
|
||||
const char* data_begin_;
|
||||
const char* data_end_;
|
||||
const int32_t* index_data_;
|
||||
virtual void reset() override;
|
||||
virtual int get_row(
|
||||
const int64_t index,
|
||||
storage::ObStoreRow &row) override;
|
||||
virtual int get_rows(
|
||||
const int64_t begin_index,
|
||||
const int64_t end_index,
|
||||
const int64_t row_capacity,
|
||||
storage::ObStoreRow *rows,
|
||||
int64_t &row_count) override;
|
||||
virtual int get_row_count(int64_t &row_count) override;
|
||||
virtual int get_row_header(const int64_t row_idx, const ObRowHeader *&row_header) override;
|
||||
virtual int get_multi_version_info(
|
||||
const int64_t row_idx,
|
||||
const int64_t version_column_idx,
|
||||
const int64_t sql_sequence_idx,
|
||||
storage::ObMultiVersionRowFlag &flag,
|
||||
transaction::ObTransID &trans_id,
|
||||
int64_t &version,
|
||||
int64_t &sql_sequence) override;
|
||||
protected:
|
||||
int base_init(const ObMicroBlockData &block_data);
|
||||
virtual int find_bound(const common::ObStoreRowkey &key,
|
||||
const bool lower_bound,
|
||||
const int64_t begin_idx,
|
||||
const int64_t end_idx,
|
||||
int64_t &row_idx,
|
||||
bool &equal) override;
|
||||
private:
|
||||
int get_row_impl(
|
||||
const int64_t index,
|
||||
storage::ObStoreRow &row);
|
||||
protected:
|
||||
const ObMicroBlockHeader *header_;
|
||||
const char *data_begin_;
|
||||
const char *data_end_;
|
||||
const int32_t *index_data_;
|
||||
common::ObArenaAllocator allocator_;
|
||||
ObFlatRowReader flat_row_reader_;
|
||||
};
|
||||
|
@ -47,9 +47,9 @@ class ObMicroBlockWriter : public ObIMicroBlockWriter {
|
||||
virtual ~ObMicroBlockWriter();
|
||||
int init(const int64_t micro_block_size_limit, const int64_t rowkey_column_count, const int64_t column_count = 0,
|
||||
const common::ObRowStoreType row_store_type = common::FLAT_ROW_STORE);
|
||||
virtual int append_row(const storage::ObStoreRow& row);
|
||||
virtual int build_block(char*& buf, int64_t& size);
|
||||
virtual void reuse();
|
||||
virtual int append_row(const storage::ObStoreRow &row) override;
|
||||
virtual int build_block(char *&buf, int64_t &size) override;
|
||||
virtual void reuse() override;
|
||||
|
||||
virtual int64_t get_block_size() const override;
|
||||
virtual int64_t get_row_count() const override;
|
||||
|
@ -54,29 +54,43 @@ class ObSparseMicroBlockReader : public ObIMicroBlockReader {
|
||||
virtual ~ObSparseMicroBlockReader();
|
||||
virtual int init(const ObMicroBlockData& block_data, const ObColumnMap* column_map,
|
||||
const common::ObRowStoreType out_type = common::FLAT_ROW_STORE) override;
|
||||
virtual void reset();
|
||||
virtual int get_row(const int64_t index, storage::ObStoreRow& row) override;
|
||||
virtual int get_rows(const int64_t begin_index, const int64_t end_index, const int64_t row_capacity,
|
||||
storage::ObStoreRow* rows, int64_t& row_count) override;
|
||||
virtual int get_row_count(int64_t& row_count) override;
|
||||
virtual int get_row_header(const int64_t row_idx, const ObRowHeader*& row_header) override;
|
||||
virtual int get_multi_version_info(const int64_t row_idx, const int64_t version_column_idx,
|
||||
const int64_t sql_sequence_idx, storage::ObMultiVersionRowFlag& flag, transaction::ObTransID& trans_id,
|
||||
int64_t& version, int64_t& sql_sequence) override;
|
||||
|
||||
protected:
|
||||
int base_init(const ObMicroBlockData& block_data);
|
||||
virtual int find_bound(const common::ObStoreRowkey& key, const bool lower_bound, const int64_t begin_idx,
|
||||
const int64_t end_idx, int64_t& row_idx, bool& equal);
|
||||
|
||||
private:
|
||||
int get_row_impl(const int64_t index, storage::ObStoreRow& row);
|
||||
|
||||
protected:
|
||||
const ObMicroBlockHeader* header_;
|
||||
const char* data_begin_; // start position of micro block data
|
||||
const char* data_end_; // end position of micro block data
|
||||
const int32_t* index_data_;
|
||||
virtual void reset() override;
|
||||
virtual int get_row(
|
||||
const int64_t index,
|
||||
storage::ObStoreRow &row) override;
|
||||
virtual int get_rows(
|
||||
const int64_t begin_index,
|
||||
const int64_t end_index,
|
||||
const int64_t row_capacity,
|
||||
storage::ObStoreRow *rows,
|
||||
int64_t &row_count) override;
|
||||
virtual int get_row_count(int64_t &row_count) override;
|
||||
virtual int get_row_header(const int64_t row_idx, const ObRowHeader *&row_header) override;
|
||||
virtual int get_multi_version_info(
|
||||
const int64_t row_idx,
|
||||
const int64_t version_column_idx,
|
||||
const int64_t sql_sequence_idx,
|
||||
storage::ObMultiVersionRowFlag &flag,
|
||||
transaction::ObTransID &trans_id,
|
||||
int64_t &version,
|
||||
int64_t &sql_sequence) override;
|
||||
protected:
|
||||
int base_init(const ObMicroBlockData &block_data);
|
||||
virtual int find_bound(const common::ObStoreRowkey &key,
|
||||
const bool lower_bound,
|
||||
const int64_t begin_idx,
|
||||
const int64_t end_idx,
|
||||
int64_t &row_idx,
|
||||
bool &equal) override;
|
||||
private:
|
||||
int get_row_impl(
|
||||
const int64_t index,
|
||||
storage::ObStoreRow &row);
|
||||
protected:
|
||||
const ObMicroBlockHeader *header_;
|
||||
const char *data_begin_; // start position of micro block data
|
||||
const char *data_end_; // end position of micro block data
|
||||
const int32_t *index_data_;
|
||||
common::ObArenaAllocator allocator_;
|
||||
ObSparseRowReader sparse_row_reader_;
|
||||
};
|
||||
|
@ -25,18 +25,22 @@
|
||||
#include "ob_storage_log_replayer.h"
|
||||
|
||||
#define SLOGGER (oceanbase::blocksstable::ObBaseStorageLogger::get_instance())
|
||||
namespace oceanbase {
|
||||
namespace blocksstable {
|
||||
// The redo log module of base storage. It is responsible for the write and recovery of all redo logs
|
||||
// of block sstable.
|
||||
class ObBaseStorageLogger : public ObStorageLogReplayer {
|
||||
public:
|
||||
static ObBaseStorageLogger& get_instance();
|
||||
// NOT thread safe.
|
||||
// Init the redo log and do recovery if there is redo logs in log_dir.
|
||||
virtual int init(const char* log_dir, const int64_t max_log_file_size, ObISLogFilter* filter_before_parse = nullptr,
|
||||
ObISLogFilter* filter_after_parse = nullptr);
|
||||
virtual void destroy();
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace blocksstable
|
||||
{
|
||||
//The redo log module of base storage. It is responsible for the write and recovery of all redo logs
|
||||
//of block sstable.
|
||||
class ObBaseStorageLogger : public ObStorageLogReplayer
|
||||
{
|
||||
public:
|
||||
static ObBaseStorageLogger &get_instance();
|
||||
//NOT thread safe.
|
||||
//Init the redo log and do recovery if there is redo logs in log_dir.
|
||||
virtual int init(const char *log_dir, const int64_t max_log_file_size,
|
||||
ObISLogFilter *filter_before_parse = nullptr,
|
||||
ObISLogFilter *filter_after_parse = nullptr);
|
||||
virtual void destroy() override;
|
||||
|
||||
// Thread safe.
|
||||
// begin a transaction.
|
||||
|
@ -82,9 +82,10 @@ class ObStorageLogWriter : public common::ObBaseLogWriter {
|
||||
ObStorageLogWriter();
|
||||
virtual ~ObStorageLogWriter();
|
||||
|
||||
int init(const char* log_dir, const int64_t log_file_size, const int64_t max_log_size, const int64_t max_trans_cnt);
|
||||
void destroy();
|
||||
int start_log(const common::ObLogCursor& cursor);
|
||||
int init(const char *log_dir, const int64_t log_file_size,
|
||||
const int64_t max_log_size, const int64_t max_trans_cnt);
|
||||
void destroy() override;
|
||||
int start_log(const common::ObLogCursor &cursor);
|
||||
// attention: not thread safe
|
||||
int flush_log(
|
||||
const common::LogCommand cmd, const ObBaseStorageLogBuffer& log_buffer, common::ObLogCursor& start_cursor);
|
||||
|
@ -638,90 +638,35 @@ class ObMvccRowCallback : public ObITransCallback {
|
||||
tnode_->set_sql_sequence(sql_no_);
|
||||
}
|
||||
}
|
||||
int callback(const int type, const bool for_replay, const bool need_lock_for_write, ObMemtable* memtable = NULL);
|
||||
int callback(transaction::ObMemtableKeyArray& memtable_key_arr, ObMemtable* memtable);
|
||||
bool on_memtable(const ObMemtable* const memtable) override
|
||||
{
|
||||
return memtable == memtable_;
|
||||
}
|
||||
ObMemtable* get_memtable() const override
|
||||
{
|
||||
return memtable_;
|
||||
};
|
||||
int get_redo(RedoDataNode& node);
|
||||
ObIMvccCtx& get_ctx() const
|
||||
{
|
||||
return ctx_;
|
||||
}
|
||||
const ObRowData& get_old_row() const
|
||||
{
|
||||
return old_row_;
|
||||
}
|
||||
const ObMvccRow& get_mvcc_row() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
ObMvccTransNode* get_trans_node()
|
||||
{
|
||||
return tnode_;
|
||||
}
|
||||
const ObMvccTransNode* get_trans_node() const
|
||||
{
|
||||
return tnode_;
|
||||
}
|
||||
const ObMemtableKey* get_key()
|
||||
{
|
||||
return &key_;
|
||||
}
|
||||
int get_memtable_key(uint64_t& table_id, common::ObStoreRowkey& rowkey) const;
|
||||
|
||||
int callback(const int type, const bool for_replay, const bool need_lock_for_write, ObMemtable *memtable = NULL) override;
|
||||
int callback(transaction::ObMemtableKeyArray &memtable_key_arr, ObMemtable *memtable) override;
|
||||
bool on_memtable(const ObMemtable * const memtable) override { return memtable == memtable_; }
|
||||
ObMemtable *get_memtable() const override { return memtable_; };
|
||||
int get_redo(RedoDataNode &node);
|
||||
ObIMvccCtx &get_ctx() const { return ctx_; }
|
||||
const ObRowData &get_old_row() const { return old_row_; }
|
||||
const ObMvccRow &get_mvcc_row() const { return value_; }
|
||||
ObMvccTransNode *get_trans_node() { return tnode_; }
|
||||
const ObMvccTransNode *get_trans_node() const { return tnode_; }
|
||||
const ObMemtableKey *get_key() { return &key_; }
|
||||
int get_memtable_key(uint64_t &table_id, common::ObStoreRowkey &rowkey) const;
|
||||
uint32_t get_ctx_descriptor() const;
|
||||
void set_stmt_committed(const bool stmt_committed)
|
||||
{
|
||||
stmt_committed_ = stmt_committed;
|
||||
}
|
||||
bool is_stmt_committed() const
|
||||
{
|
||||
return stmt_committed_;
|
||||
}
|
||||
void set_savepoint()
|
||||
{
|
||||
is_savepoint_ = true;
|
||||
}
|
||||
bool is_savepoint() const
|
||||
{
|
||||
return is_savepoint_;
|
||||
}
|
||||
bool need_fill_redo() const
|
||||
{
|
||||
return need_fill_redo_;
|
||||
}
|
||||
int32_t get_sql_no() const
|
||||
{
|
||||
return sql_no_;
|
||||
}
|
||||
int get_trans_id(transaction::ObTransID& trans_id) const;
|
||||
transaction::ObTransCtx* get_trans_ctx() const;
|
||||
int64_t to_string(char* buf, const int64_t buf_len) const;
|
||||
int64_t get_log_ts() const
|
||||
{
|
||||
return log_ts_;
|
||||
}
|
||||
void set_log_ts(const int64_t log_ts)
|
||||
{
|
||||
if (INT64_MAX == log_ts_) {
|
||||
log_ts_ = log_ts;
|
||||
}
|
||||
}
|
||||
bool log_synced() const override
|
||||
{
|
||||
return INT64_MAX != log_ts_;
|
||||
}
|
||||
int64_t get_data_size()
|
||||
{
|
||||
return data_size_;
|
||||
}
|
||||
virtual int del();
|
||||
int check_sequential_relocate(const ObMemtable* memtable, bool& is_sequential_relocate) const;
|
||||
void set_stmt_committed(const bool stmt_committed) { stmt_committed_ = stmt_committed; }
|
||||
bool is_stmt_committed() const { return stmt_committed_; }
|
||||
void set_savepoint() { is_savepoint_ = true; }
|
||||
bool is_savepoint() const override { return is_savepoint_; }
|
||||
bool need_fill_redo() const { return need_fill_redo_; }
|
||||
int32_t get_sql_no() const override { return sql_no_; }
|
||||
int get_trans_id(transaction::ObTransID &trans_id) const;
|
||||
transaction::ObTransCtx *get_trans_ctx() const;
|
||||
int64_t to_string(char *buf, const int64_t buf_len) const override;
|
||||
int64_t get_log_ts() const { return log_ts_; }
|
||||
void set_log_ts(const int64_t log_ts) { if (INT64_MAX == log_ts_) { log_ts_ = log_ts; } }
|
||||
bool log_synced() const override { return INT64_MAX != log_ts_; }
|
||||
int64_t get_data_size() override { return data_size_; }
|
||||
virtual int del() override;
|
||||
int check_sequential_relocate(const ObMemtable *memtable, bool &is_sequential_relocate) const;
|
||||
virtual bool mark_for_logging() override
|
||||
{
|
||||
if (marked_for_logging_) {
|
||||
|
@ -139,75 +139,129 @@ class ObMemtable : public ObIMemtable {
|
||||
typedef common::ObGMemstoreAllocator::AllocHandle ObMemstoreAllocator;
|
||||
ObMemtable();
|
||||
virtual ~ObMemtable();
|
||||
|
||||
public:
|
||||
virtual int init(const ObITable::TableKey& table_key);
|
||||
virtual void destroy();
|
||||
int fake(const ObIMemtable& mt);
|
||||
|
||||
public:
|
||||
int dump2text(const char* fname);
|
||||
virtual int set(const storage::ObStoreCtx& ctx, const uint64_t table_id, const int64_t rowkey_len,
|
||||
const common::ObIArray<share::schema::ObColDesc>& columns, storage::ObStoreRowIterator& row_iter);
|
||||
virtual int set(const storage::ObStoreCtx& ctx, const uint64_t table_id, const int64_t rowkey_len,
|
||||
const common::ObIArray<share::schema::ObColDesc>& columns, const storage::ObStoreRow& row);
|
||||
virtual int set(const storage::ObStoreCtx& ctx, const uint64_t table_id, const int64_t rowkey_len,
|
||||
const common::ObIArray<share::schema::ObColDesc>& columns, const ObIArray<int64_t>& update_idx,
|
||||
const storage::ObStoreRow& old_row, const storage::ObStoreRow& new_row);
|
||||
virtual int lock(const storage::ObStoreCtx& ctx, const uint64_t table_id,
|
||||
const common::ObIArray<share::schema::ObColDesc>& columns, common::ObNewRowIterator& row_iter);
|
||||
virtual int lock(const storage::ObStoreCtx& ctx, const uint64_t table_id,
|
||||
const common::ObIArray<share::schema::ObColDesc>& columns, const common::ObNewRow& row);
|
||||
virtual int lock(const storage::ObStoreCtx& ctx, const uint64_t table_id,
|
||||
const common::ObIArray<share::schema::ObColDesc>& columns, const common::ObStoreRowkey& rowkey);
|
||||
public:
|
||||
virtual int init(const ObITable::TableKey &table_key);
|
||||
virtual void destroy() override;
|
||||
int fake(const ObIMemtable &mt) override;
|
||||
public:
|
||||
int dump2text(const char *fname);
|
||||
virtual int set(
|
||||
const storage::ObStoreCtx &ctx,
|
||||
const uint64_t table_id,
|
||||
const int64_t rowkey_len,
|
||||
const common::ObIArray<share::schema::ObColDesc> &columns,
|
||||
storage::ObStoreRowIterator &row_iter) override;
|
||||
virtual int set(
|
||||
const storage::ObStoreCtx &ctx,
|
||||
const uint64_t table_id,
|
||||
const int64_t rowkey_len,
|
||||
const common::ObIArray<share::schema::ObColDesc> &columns,
|
||||
const storage::ObStoreRow &row) override;
|
||||
virtual int set(
|
||||
const storage::ObStoreCtx &ctx,
|
||||
const uint64_t table_id,
|
||||
const int64_t rowkey_len,
|
||||
const common::ObIArray<share::schema::ObColDesc> &columns,
|
||||
const ObIArray<int64_t> &update_idx,
|
||||
const storage::ObStoreRow &old_row,
|
||||
const storage::ObStoreRow &new_row);
|
||||
virtual int lock(
|
||||
const storage::ObStoreCtx &ctx,
|
||||
const uint64_t table_id,
|
||||
const common::ObIArray<share::schema::ObColDesc> &columns,
|
||||
common::ObNewRowIterator &row_iter) override;
|
||||
virtual int lock(
|
||||
const storage::ObStoreCtx &ctx,
|
||||
const uint64_t table_id,
|
||||
const common::ObIArray<share::schema::ObColDesc> &columns,
|
||||
const common::ObNewRow &row) override;
|
||||
virtual int lock(
|
||||
const storage::ObStoreCtx &ctx,
|
||||
const uint64_t table_id,
|
||||
const common::ObIArray<share::schema::ObColDesc> &columns,
|
||||
const common::ObStoreRowkey &rowkey) override;
|
||||
virtual int64_t get_upper_trans_version() const override;
|
||||
int check_row_locked_by_myself(const storage::ObStoreCtx& ctx, const uint64_t table_id,
|
||||
const common::ObIArray<share::schema::ObColDesc>& columns, const common::ObStoreRowkey& rowkey, bool& locked);
|
||||
int check_row_locked_by_myself(
|
||||
const storage::ObStoreCtx &ctx,
|
||||
const uint64_t table_id,
|
||||
const common::ObIArray<share::schema::ObColDesc> &columns,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
bool &locked);
|
||||
public:
|
||||
int estimate_phy_size(const uint64_t table_id, const common::ObStoreRowkey* start_key, const common::ObStoreRowkey* end_key, int64_t& total_bytes, int64_t& total_rows);
|
||||
int get_split_ranges(const uint64_t table_id, const common::ObStoreRowkey* start_key, const common::ObStoreRowkey* end_key, const int64_t part_cnt, common::ObIArray<common::ObStoreRange> &range_array);
|
||||
virtual int exist(
|
||||
const storage::ObStoreCtx &ctx,
|
||||
const uint64_t table_id,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const common::ObIArray<share::schema::ObColDesc> &column_ids,
|
||||
bool &is_exist,
|
||||
bool &has_found) override;
|
||||
virtual int prefix_exist(
|
||||
storage::ObRowsInfo &rows_info,
|
||||
bool &may_exist) override;
|
||||
virtual int exist(
|
||||
storage::ObRowsInfo &rows_info,
|
||||
bool &is_exist,
|
||||
bool &all_rows_found) override;
|
||||
virtual int get(
|
||||
const storage::ObTableIterParam ¶m,
|
||||
storage::ObTableAccessContext &context,
|
||||
const common::ObExtStoreRowkey &rowkey,
|
||||
storage::ObStoreRow &row) override;
|
||||
virtual int get(
|
||||
const storage::ObTableIterParam ¶m,
|
||||
storage::ObTableAccessContext &context,
|
||||
const common::ObExtStoreRowkey &rowkey,
|
||||
storage::ObStoreRowIterator *&row_iter) override;
|
||||
virtual int scan(
|
||||
const storage::ObTableIterParam ¶m,
|
||||
storage::ObTableAccessContext &context,
|
||||
const common::ObExtStoreRange &range,
|
||||
storage::ObStoreRowIterator *&row_iter) override;
|
||||
virtual int multi_get(
|
||||
const storage::ObTableIterParam ¶m,
|
||||
storage::ObTableAccessContext &context,
|
||||
const common::ObIArray<common::ObExtStoreRowkey> &rowkeys,
|
||||
storage::ObStoreRowIterator *&row_iter) override;
|
||||
virtual int multi_scan(
|
||||
const storage::ObTableIterParam ¶m,
|
||||
storage::ObTableAccessContext &context,
|
||||
const common::ObIArray<common::ObExtStoreRange> &ranges,
|
||||
storage::ObStoreRowIterator *&row_iter) override;
|
||||
virtual int get_row_header(
|
||||
const storage::ObStoreCtx &ctx,
|
||||
const uint64_t table_id,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const common::ObIArray<share::schema::ObColDesc> &column_ids,
|
||||
uint32_t &modify_count,
|
||||
uint32_t &acc_checksum);
|
||||
virtual int replay(
|
||||
const storage::ObStoreCtx &ctx,
|
||||
const char *data,
|
||||
const int64_t data_len);
|
||||
virtual int replay_schema_version_change_log(
|
||||
const int64_t schema_version);
|
||||
|
||||
public:
|
||||
int estimate_phy_size(const uint64_t table_id, const common::ObStoreRowkey* start_key,
|
||||
const common::ObStoreRowkey* end_key, int64_t& total_bytes, int64_t& total_rows);
|
||||
int get_split_ranges(const uint64_t table_id, const common::ObStoreRowkey* start_key,
|
||||
const common::ObStoreRowkey* end_key, const int64_t part_cnt,
|
||||
common::ObIArray<common::ObStoreRange>& range_array);
|
||||
virtual int exist(const storage::ObStoreCtx& ctx, const uint64_t table_id, const common::ObStoreRowkey& rowkey,
|
||||
const common::ObIArray<share::schema::ObColDesc>& column_ids, bool& is_exist, bool& has_found);
|
||||
virtual int prefix_exist(storage::ObRowsInfo& rows_info, bool& may_exist);
|
||||
virtual int exist(storage::ObRowsInfo& rows_info, bool& is_exist, bool& all_rows_found);
|
||||
virtual int get(const storage::ObTableIterParam& param, storage::ObTableAccessContext& context,
|
||||
const common::ObExtStoreRowkey& rowkey, storage::ObStoreRow& row);
|
||||
virtual int get(const storage::ObTableIterParam& param, storage::ObTableAccessContext& context,
|
||||
const common::ObExtStoreRowkey& rowkey, storage::ObStoreRowIterator*& row_iter) override;
|
||||
virtual int scan(const storage::ObTableIterParam& param, storage::ObTableAccessContext& context,
|
||||
const common::ObExtStoreRange& range, storage::ObStoreRowIterator*& row_iter) override;
|
||||
virtual int multi_get(const storage::ObTableIterParam& param, storage::ObTableAccessContext& context,
|
||||
const common::ObIArray<common::ObExtStoreRowkey>& rowkeys, storage::ObStoreRowIterator*& row_iter) override;
|
||||
virtual int multi_scan(const storage::ObTableIterParam& param, storage::ObTableAccessContext& context,
|
||||
const common::ObIArray<common::ObExtStoreRange>& ranges, storage::ObStoreRowIterator*& row_iter) override;
|
||||
virtual int get_row_header(const storage::ObStoreCtx& ctx, const uint64_t table_id,
|
||||
const common::ObStoreRowkey& rowkey, const common::ObIArray<share::schema::ObColDesc>& column_ids,
|
||||
uint32_t& modify_count, uint32_t& acc_checksum);
|
||||
virtual int replay(const storage::ObStoreCtx& ctx, const char* data, const int64_t data_len);
|
||||
virtual int replay_schema_version_change_log(const int64_t schema_version);
|
||||
ObQueryEngine &get_query_engine() { return query_engine_; }
|
||||
ObMvccEngine &get_mvcc_engine() { return mvcc_engine_; }
|
||||
|
||||
ObQueryEngine& get_query_engine()
|
||||
{
|
||||
return query_engine_;
|
||||
}
|
||||
ObMvccEngine& get_mvcc_engine()
|
||||
{
|
||||
return mvcc_engine_;
|
||||
}
|
||||
virtual int estimate_get_row_count(const common::ObQueryFlag query_flag,
|
||||
const uint64_t table_id,
|
||||
const common::ObIArray<common::ObExtStoreRowkey> &rowkeys,
|
||||
storage::ObPartitionEst &part_est) override;
|
||||
|
||||
virtual int estimate_get_row_count(const common::ObQueryFlag query_flag, const uint64_t table_id,
|
||||
const common::ObIArray<common::ObExtStoreRowkey>& rowkeys, storage::ObPartitionEst& part_est);
|
||||
|
||||
virtual int estimate_scan_row_count(const common::ObQueryFlag query_flag, const uint64_t table_id,
|
||||
const common::ObExtStoreRange& key_range, storage::ObPartitionEst& part_est);
|
||||
virtual int estimate_multi_scan_row_count(const common::ObQueryFlag query_flag, const uint64_t table_id,
|
||||
const common::ObIArray<common::ObExtStoreRange>& ranges, storage::ObPartitionEst& part_est);
|
||||
virtual int save_base_storage_info(const storage::ObSavedStorageInfoV2& info);
|
||||
virtual int get_base_storage_info(storage::ObSavedStorageInfoV2& info);
|
||||
virtual int estimate_scan_row_count(const common::ObQueryFlag query_flag,
|
||||
const uint64_t table_id,
|
||||
const common::ObExtStoreRange &key_range,
|
||||
storage::ObPartitionEst &part_est) override;
|
||||
virtual int estimate_multi_scan_row_count(
|
||||
const common::ObQueryFlag query_flag,
|
||||
const uint64_t table_id,
|
||||
const common::ObIArray<common::ObExtStoreRange> &ranges,
|
||||
storage::ObPartitionEst &part_est) override;
|
||||
virtual int save_base_storage_info(const storage::ObSavedStorageInfoV2 &info);
|
||||
virtual int get_base_storage_info(storage::ObSavedStorageInfoV2 &info);
|
||||
int set_emergency(const bool emergency);
|
||||
virtual int minor_freeze(const bool emergency = false);
|
||||
ObMtStat& get_mt_stat()
|
||||
@ -234,8 +288,8 @@ class ObMemtable : public ObIMemtable {
|
||||
int dec_active_trx_count();
|
||||
int dec_pending_cb_count();
|
||||
int add_pending_cb_count(const int64_t cnt, const bool finish);
|
||||
void inc_pending_lob_count();
|
||||
void dec_pending_lob_count();
|
||||
void inc_pending_lob_count() override;
|
||||
void dec_pending_lob_count() override;
|
||||
void inc_pending_batch_commit_count();
|
||||
void dec_pending_batch_commit_count();
|
||||
void inc_pending_elr_count();
|
||||
|
@ -287,71 +287,84 @@ class ObMemtableCtx : public ObIMemtableCtx {
|
||||
ObMemtableCtx();
|
||||
ObMemtableCtx(MemtableIDMap& ctx_map, common::ObIAllocator& allocator);
|
||||
virtual ~ObMemtableCtx();
|
||||
virtual void reset();
|
||||
|
||||
public:
|
||||
int init(const uint64_t tenant_id, MemtableIDMap& ctx_map, common::ObIAllocator& malloc_allocator);
|
||||
virtual int add_crc(const void* key, ObMvccRow* value, ObMvccTransNode* tnode, const int64_t data_size);
|
||||
virtual int add_crc2(ObMvccRow* value, ObMvccTransNode* tnode, int64_t data_size);
|
||||
virtual int add_crc4(ObMvccRow* value, ObMvccTransNode* tnode, int64_t data_size, const int64_t log_ts);
|
||||
virtual void* callback_alloc(const int64_t size);
|
||||
virtual void callback_free(void* cb);
|
||||
virtual void* arena_alloc(const int64_t size);
|
||||
virtual common::ObIAllocator& get_query_allocator();
|
||||
virtual int wait_trans_version(const uint32_t descriptor, const int64_t version);
|
||||
virtual int wait_trans_version_v2(
|
||||
const uint32_t descriptor, const int64_t version, const ObMemtableKey* key, const ObMvccRow& row);
|
||||
virtual int try_elr_when_lock_for_write(
|
||||
const uint32_t descriptor, const int64_t version, const ObMemtableKey* key, const ObMvccRow& row);
|
||||
virtual void inc_lock_for_read_retry_count();
|
||||
virtual int row_compact(ObMvccRow* value, const int64_t snapshot_version);
|
||||
virtual const char* log_conflict_ctx(const uint32_t descriptor);
|
||||
virtual int read_lock_yield();
|
||||
virtual int write_lock_yield();
|
||||
virtual void reset() override;
|
||||
public:
|
||||
int init(const uint64_t tenant_id, MemtableIDMap &ctx_map,common::ObIAllocator &malloc_allocator);
|
||||
virtual int add_crc(const void *key,
|
||||
ObMvccRow *value,
|
||||
ObMvccTransNode *tnode,
|
||||
const int64_t data_size) override;
|
||||
virtual int add_crc2(ObMvccRow *value,
|
||||
ObMvccTransNode *tnode,
|
||||
int64_t data_size) override;
|
||||
virtual int add_crc4(ObMvccRow *value,
|
||||
ObMvccTransNode *tnode,
|
||||
int64_t data_size,
|
||||
const int64_t log_ts) override;
|
||||
virtual void *callback_alloc(const int64_t size) override;
|
||||
virtual void callback_free(void *cb) override;
|
||||
virtual void *arena_alloc(const int64_t size) override;
|
||||
virtual common::ObIAllocator &get_query_allocator() override;
|
||||
virtual int wait_trans_version(const uint32_t descriptor, const int64_t version) override;
|
||||
virtual int wait_trans_version_v2(const uint32_t descriptor, const int64_t version,
|
||||
const ObMemtableKey* key, const ObMvccRow &row) override;
|
||||
virtual int try_elr_when_lock_for_write(const uint32_t descriptor,
|
||||
const int64_t version,
|
||||
const ObMemtableKey* key,
|
||||
const ObMvccRow &row) override;
|
||||
virtual void inc_lock_for_read_retry_count() override;
|
||||
virtual int row_compact(ObMvccRow *value, const int64_t snapshot_version) override;
|
||||
virtual const char *log_conflict_ctx(const uint32_t descriptor) override;
|
||||
virtual int read_lock_yield() override;
|
||||
virtual int write_lock_yield() override;
|
||||
|
||||
virtual int after_link_trans_node(const void* key, ObMvccRow* value);
|
||||
virtual bool has_redo_log() const;
|
||||
virtual int after_link_trans_node(const void *key, ObMvccRow *value) override;
|
||||
virtual bool has_redo_log() const override;
|
||||
virtual void update_max_durable_sql_no(const int64_t sql_no) override;
|
||||
|
||||
public:
|
||||
int set_replay_host(ObMemtable* host, const bool for_replay);
|
||||
int set_leader_host(ObMemtable* host, const bool for_replay);
|
||||
int check_memstore_count(int64_t& count);
|
||||
virtual void set_read_only();
|
||||
virtual void inc_ref();
|
||||
virtual void dec_ref();
|
||||
virtual int write_auth();
|
||||
virtual int write_done();
|
||||
virtual int trans_begin();
|
||||
virtual int sub_trans_begin(const int64_t snapshot, const int64_t abs_expired_time,
|
||||
const bool is_safe_snapshot = false, const int64_t trx_lock_timeout = -1);
|
||||
virtual int sub_trans_end(const bool commit);
|
||||
public:
|
||||
int set_replay_host(ObMemtable *host, const bool for_replay);
|
||||
int set_leader_host(ObMemtable *host, const bool for_replay);
|
||||
int check_memstore_count(int64_t &count);
|
||||
virtual void set_read_only() override;
|
||||
virtual void inc_ref() override;
|
||||
virtual void dec_ref() override;
|
||||
virtual int write_auth() override;
|
||||
virtual int write_done() override;
|
||||
virtual int trans_begin() override;
|
||||
virtual int sub_trans_begin(const int64_t snapshot,
|
||||
const int64_t abs_expired_time,
|
||||
const bool is_safe_snapshot=false,
|
||||
const int64_t trx_lock_timeout = -1) override;
|
||||
virtual int sub_trans_end(const bool commit) override;
|
||||
virtual int sub_stmt_begin() override;
|
||||
virtual int sub_stmt_end(const bool commit) override;
|
||||
virtual int fast_select_trans_begin(
|
||||
const int64_t snapshot, const int64_t abs_expired_time, const int64_t trx_lock_timeout);
|
||||
virtual uint64_t calc_checksum(const int64_t trans_version);
|
||||
virtual uint64_t calc_checksum2(const int64_t trans_version);
|
||||
virtual int fast_select_trans_begin(const int64_t snapshot,
|
||||
const int64_t abs_expired_time,
|
||||
const int64_t trx_lock_timeout) override;
|
||||
virtual uint64_t calc_checksum(const int64_t trans_version) override;
|
||||
virtual uint64_t calc_checksum2(const int64_t trans_version) override;
|
||||
virtual uint64_t calc_checksum3();
|
||||
virtual uint64_t calc_checksum4();
|
||||
virtual int trans_end(const bool commit, const int64_t trans_version);
|
||||
virtual int trans_clear();
|
||||
virtual int elr_trans_preparing();
|
||||
virtual int trans_kill();
|
||||
virtual int trans_end(const bool commit, const int64_t trans_version) override;
|
||||
virtual int trans_clear() override;
|
||||
virtual int elr_trans_preparing() override;
|
||||
virtual int trans_kill() override;
|
||||
// fake kill the trans table even when the transaction may already be committed
|
||||
// only used to set the already committed transaction to be aborted
|
||||
virtual int fake_kill();
|
||||
virtual int trans_publish();
|
||||
virtual int trans_replay_begin();
|
||||
virtual int trans_replay_end(const bool commit, const int64_t trans_version, const uint64_t checksum = 0);
|
||||
// method called when leader takeover
|
||||
virtual int replay_to_commit();
|
||||
// method called when leader revoke
|
||||
virtual int commit_to_replay();
|
||||
virtual int trans_publish() override;
|
||||
virtual int trans_replay_begin() override;
|
||||
virtual int trans_replay_end(const bool commit, const int64_t trans_version,
|
||||
const uint64_t checksum = 0) override;
|
||||
//method called when leader takeover
|
||||
virtual int replay_to_commit() override;
|
||||
//method called when leader revoke
|
||||
virtual int commit_to_replay() override;
|
||||
virtual int trans_link();
|
||||
virtual int get_trans_status() const;
|
||||
virtual int fill_redo_log(char* buf, const int64_t buf_len, int64_t& buf_pos);
|
||||
virtual int undo_fill_redo_log(); // undo the function fill_redo_log(..)
|
||||
virtual int get_trans_status() const override;
|
||||
virtual int fill_redo_log(char *buf, const int64_t buf_len, int64_t &buf_pos) override;
|
||||
virtual int undo_fill_redo_log() override; // undo the function fill_redo_log(..)
|
||||
// the function apply the side effect of dirty txn and return whether
|
||||
// remaining pending callbacks.
|
||||
// NB: the fact whether there remains pending callbacks currently is only used
|
||||
@ -359,71 +372,34 @@ class ObMemtableCtx : public ObIMemtableCtx {
|
||||
void sync_log_succ(const int64_t log_id, const int64_t log_ts);
|
||||
void sync_log_succ(const int64_t log_id, const int64_t log_ts, bool& has_pending_cb);
|
||||
bool is_slow_query() const;
|
||||
void set_handle_start_time(const int64_t start_time)
|
||||
{
|
||||
handle_start_time_ = start_time;
|
||||
}
|
||||
int64_t get_handle_start_time()
|
||||
{
|
||||
return handle_start_time_;
|
||||
}
|
||||
virtual void set_trans_ctx(transaction::ObTransCtx* ctx);
|
||||
virtual transaction::ObTransCtx* get_trans_ctx()
|
||||
{
|
||||
return ctx_;
|
||||
}
|
||||
virtual bool is_multi_version_range_valid() const
|
||||
{
|
||||
return multi_version_range_.is_valid();
|
||||
}
|
||||
virtual const ObVersionRange& get_multi_version_range() const
|
||||
{
|
||||
return multi_version_range_;
|
||||
}
|
||||
virtual int stmt_data_relocate(const int relocate_data_type, ObMemtable* memtable, bool& relocated);
|
||||
virtual void inc_relocate_cnt() override
|
||||
{
|
||||
relocate_cnt_++;
|
||||
}
|
||||
virtual void inc_truncate_cnt() override
|
||||
{
|
||||
truncate_cnt_++;
|
||||
}
|
||||
virtual int64_t get_relocate_cnt() override
|
||||
{
|
||||
return relocate_cnt_;
|
||||
}
|
||||
virtual int audit_partition(const enum transaction::ObPartitionAuditOperator op, const int64_t count);
|
||||
int get_memtable_key_arr(transaction::ObMemtableKeyArray& memtable_key_arr);
|
||||
uint64_t get_lock_for_read_retry_count() const
|
||||
{
|
||||
return lock_for_read_retry_count_;
|
||||
}
|
||||
virtual void add_trans_mem_total_size(const int64_t size);
|
||||
virtual void set_contain_hotspot_row();
|
||||
MemtableIDMap* get_ctx_map()
|
||||
{
|
||||
return ctx_map_;
|
||||
}
|
||||
|
||||
void set_handle_start_time(const int64_t start_time) { handle_start_time_ = start_time; }
|
||||
int64_t get_handle_start_time() { return handle_start_time_; }
|
||||
virtual void set_trans_ctx(transaction::ObTransCtx *ctx) override;
|
||||
virtual transaction::ObTransCtx *get_trans_ctx() override { return ctx_; }
|
||||
virtual bool is_multi_version_range_valid() const override { return multi_version_range_.is_valid(); }
|
||||
virtual const ObVersionRange &get_multi_version_range() const override { return multi_version_range_; }
|
||||
virtual int stmt_data_relocate(const int relocate_data_type, ObMemtable *memtable, bool &relocated) override;
|
||||
virtual void inc_relocate_cnt() override { relocate_cnt_++; }
|
||||
virtual void inc_truncate_cnt() override { truncate_cnt_++; }
|
||||
virtual int64_t get_relocate_cnt() override { return relocate_cnt_; }
|
||||
virtual int audit_partition(const enum transaction::ObPartitionAuditOperator op,
|
||||
const int64_t count) override;
|
||||
int get_memtable_key_arr(transaction::ObMemtableKeyArray &memtable_key_arr);
|
||||
uint64_t get_lock_for_read_retry_count() const { return lock_for_read_retry_count_; }
|
||||
virtual void add_trans_mem_total_size(const int64_t size) override;
|
||||
virtual void set_contain_hotspot_row() override;
|
||||
MemtableIDMap *get_ctx_map(){ return ctx_map_; }
|
||||
void set_need_print_trace_log();
|
||||
int64_t get_ref() const
|
||||
{
|
||||
return ATOMIC_LOAD(&ref_);
|
||||
}
|
||||
uint64_t get_tenant_id() const;
|
||||
bool is_can_elr() const;
|
||||
bool is_elr_prepared() const;
|
||||
ObMemtableMutatorIterator* get_memtable_mutator_iter()
|
||||
{
|
||||
return mutator_iter_;
|
||||
}
|
||||
ObMemtableMutatorIterator* alloc_memtable_mutator_iter();
|
||||
int set_memtable_for_cur_log(ObIMemtable* memtable);
|
||||
ObIMemtable* get_memtable_for_cur_log()
|
||||
{
|
||||
return memtable_for_cur_log_;
|
||||
}
|
||||
void clear_memtable_for_cur_log()
|
||||
int64_t get_ref() const { return ATOMIC_LOAD(&ref_); }
|
||||
uint64_t get_tenant_id() const override;
|
||||
bool is_can_elr() const override;
|
||||
bool is_elr_prepared() const override;
|
||||
ObMemtableMutatorIterator *get_memtable_mutator_iter() { return mutator_iter_; }
|
||||
ObMemtableMutatorIterator *alloc_memtable_mutator_iter();
|
||||
int set_memtable_for_cur_log(ObIMemtable *memtable) override;
|
||||
ObIMemtable *get_memtable_for_cur_log() override { return memtable_for_cur_log_; }
|
||||
void clear_memtable_for_cur_log() override
|
||||
{
|
||||
if (NULL != memtable_for_cur_log_) {
|
||||
memtable_for_cur_log_->dec_pending_lob_count();
|
||||
@ -431,15 +407,18 @@ class ObMemtableCtx : public ObIMemtableCtx {
|
||||
lob_start_log_ts_ = 0;
|
||||
}
|
||||
}
|
||||
int set_memtable_for_batch_commit(ObMemtable* memtable);
|
||||
int set_memtable_for_elr(ObMemtable* memtable);
|
||||
bool has_read_elr_data() const
|
||||
{
|
||||
return read_elr_data_;
|
||||
}
|
||||
int remove_callback_for_uncommited_txn(memtable::ObMemtable* mt, int64_t& cnt);
|
||||
int rollback_to(const int32_t sql_no, const bool is_replay, const bool need_write_log,
|
||||
const int64_t max_durable_log_ts, bool& has_calc_checksum, uint64_t& checksum, int64_t& checksum_log_ts);
|
||||
int set_memtable_for_batch_commit(ObMemtable *memtable);
|
||||
int set_memtable_for_elr(ObMemtable *memtable);
|
||||
bool has_read_elr_data() const override { return read_elr_data_; }
|
||||
int remove_callback_for_uncommited_txn(memtable::ObMemtable* mt,
|
||||
int64_t& cnt);
|
||||
int rollback_to(const int32_t sql_no,
|
||||
const bool is_replay,
|
||||
const bool need_write_log,
|
||||
const int64_t max_durable_log_ts,
|
||||
bool &has_calc_checksum,
|
||||
uint64_t &checksum,
|
||||
int64_t &checksum_log_ts);
|
||||
int truncate_to(const int32_t sql_no);
|
||||
bool is_all_redo_submitted();
|
||||
bool is_for_replay() const
|
||||
@ -447,18 +426,10 @@ class ObMemtableCtx : public ObIMemtableCtx {
|
||||
return trans_mgr_.is_for_replay();
|
||||
}
|
||||
void half_stmt_commit();
|
||||
int64_t get_trans_mem_total_size() const
|
||||
{
|
||||
return trans_mem_total_size_;
|
||||
}
|
||||
void add_lock_for_read_elapse(const int64_t elapse)
|
||||
{
|
||||
lock_for_read_elapse_ += elapse;
|
||||
}
|
||||
int64_t get_lock_for_read_elapse() const
|
||||
{
|
||||
return lock_for_read_elapse_;
|
||||
}
|
||||
|
||||
int64_t get_trans_mem_total_size() const{ return trans_mem_total_size_; }
|
||||
void add_lock_for_read_elapse(const int64_t elapse) override { lock_for_read_elapse_ += elapse; }
|
||||
int64_t get_lock_for_read_elapse() const override { return lock_for_read_elapse_; }
|
||||
// mark the corresponding callback of the dirty data
|
||||
int mark_frozen_data(
|
||||
const ObMemtable* const frozen_memtable, const ObMemtable* const active_memtable, bool& marked, int64_t& cb_cnt);
|
||||
@ -486,40 +457,22 @@ class ObMemtableCtx : public ObIMemtableCtx {
|
||||
return trans_mgr_.count();
|
||||
}
|
||||
void dec_pending_elr_count();
|
||||
|
||||
public:
|
||||
void on_tsc_retry(const ObMemtableKey& key);
|
||||
void on_wlock_retry(const ObMemtableKey& key, const char* conflict_ctx);
|
||||
int insert_prev_trans(const uint32_t ctx_id);
|
||||
virtual int64_t to_string(char* buf, const int64_t buf_len) const;
|
||||
void set_thread_local_ctx(transaction::ObThreadLocalTransCtx* thread_local_ctx)
|
||||
{
|
||||
thread_local_ctx_ = thread_local_ctx;
|
||||
}
|
||||
transaction::ObThreadLocalTransCtx* get_thread_local_ctx() const
|
||||
{
|
||||
return thread_local_ctx_;
|
||||
}
|
||||
transaction::ObTransTableStatusType get_trans_table_status() const
|
||||
{
|
||||
return trans_table_status_;
|
||||
}
|
||||
public:
|
||||
void on_tsc_retry(const ObMemtableKey& key) override;
|
||||
void on_wlock_retry(const ObMemtableKey& key, const char *conflict_ctx) override;
|
||||
int insert_prev_trans(const uint32_t ctx_id) override;
|
||||
virtual int64_t to_string(char *buf, const int64_t buf_len) const override;
|
||||
void set_thread_local_ctx(transaction::ObThreadLocalTransCtx *thread_local_ctx) { thread_local_ctx_ = thread_local_ctx; }
|
||||
transaction::ObThreadLocalTransCtx *get_thread_local_ctx() const { return thread_local_ctx_; }
|
||||
transaction::ObTransTableStatusType get_trans_table_status() const { return trans_table_status_; }
|
||||
void set_trans_table_status(transaction::ObTransTableStatusType trans_table_status)
|
||||
{
|
||||
trans_table_status_ = trans_table_status;
|
||||
}
|
||||
void set_self_alloc_ctx(const bool is_self_alloc_ctx)
|
||||
{
|
||||
is_self_alloc_ctx_ = is_self_alloc_ctx;
|
||||
}
|
||||
bool is_self_alloc_ctx() const
|
||||
{
|
||||
return is_self_alloc_ctx_;
|
||||
}
|
||||
transaction::ObTransStateTableGuard* get_trans_table_guard()
|
||||
{
|
||||
return &trans_table_guard_;
|
||||
}
|
||||
|
||||
void set_self_alloc_ctx(const bool is_self_alloc_ctx) { is_self_alloc_ctx_ = is_self_alloc_ctx; }
|
||||
bool is_self_alloc_ctx() const { return is_self_alloc_ctx_; }
|
||||
transaction::ObTransStateTableGuard *get_trans_table_guard() override { return &trans_table_guard_; }
|
||||
// mainly used by revert ref
|
||||
void reset_trans_table_guard();
|
||||
|
||||
|
@ -31,9 +31,12 @@ class ObMultipleMerge : public ObQueryRowIterator {
|
||||
ObMultipleMerge();
|
||||
virtual ~ObMultipleMerge();
|
||||
virtual int init(
|
||||
const ObTableAccessParam& param, ObTableAccessContext& context, const ObGetTableParam& get_table_param);
|
||||
virtual int get_next_row(ObStoreRow*& row);
|
||||
virtual void reset();
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param
|
||||
);
|
||||
virtual int get_next_row(ObStoreRow *&row) override;
|
||||
virtual void reset() override;
|
||||
virtual void reuse();
|
||||
inline const ObRowStat& get_row_stat() const
|
||||
{
|
||||
|
@ -36,7 +36,8 @@ class ObMultipleScanMerge : public ObMultipleScanMergeImpl {
|
||||
protected:
|
||||
virtual int calc_scan_range() override;
|
||||
virtual int construct_iters() override;
|
||||
virtual int inner_get_next_row(ObStoreRow& row);
|
||||
|
||||
virtual int inner_get_next_row(ObStoreRow &row) override;
|
||||
virtual int is_range_valid() const override;
|
||||
virtual int prepare() override;
|
||||
virtual void collect_merge_stat(ObTableStoreStat& stat) const override;
|
||||
|
@ -93,8 +93,11 @@ class ObMultipleScanMergeImpl : public ObMultipleMerge {
|
||||
virtual ~ObMultipleScanMergeImpl();
|
||||
|
||||
virtual int init(
|
||||
const ObTableAccessParam& param, ObTableAccessContext& context, const ObGetTableParam& get_table_param);
|
||||
virtual int inner_get_next_row(ObStoreRow& row);
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param
|
||||
) override;
|
||||
virtual int inner_get_next_row(ObStoreRow &row) override;
|
||||
virtual void reset() override;
|
||||
virtual void reuse() override;
|
||||
inline bool is_scan_end() const
|
||||
|
@ -183,19 +183,19 @@ class ObPartitionStorage : public ObIPartitionStorage {
|
||||
ObPartitionStorage();
|
||||
virtual ~ObPartitionStorage();
|
||||
|
||||
inline virtual const share::schema::ObMultiVersionSchemaService* get_schema_service() const
|
||||
inline virtual const share::schema::ObMultiVersionSchemaService *get_schema_service() const override
|
||||
{
|
||||
return schema_service_;
|
||||
}
|
||||
virtual int init(const common::ObPartitionKey& pkey, ObIPartitionComponentFactory* cp_fty,
|
||||
share::schema::ObMultiVersionSchemaService* schema_service, transaction::ObTransService* txs,
|
||||
ObPGMemtableMgr& pg_memtable_mgr);
|
||||
virtual int init(
|
||||
const common::ObPartitionKey &pkey,
|
||||
ObIPartitionComponentFactory *cp_fty,
|
||||
share::schema::ObMultiVersionSchemaService *schema_service,
|
||||
transaction::ObTransService *txs,
|
||||
ObPGMemtableMgr &pg_memtable_mgr) override;
|
||||
|
||||
virtual void destroy();
|
||||
virtual const common::ObPartitionKey& get_partition_key() const
|
||||
{
|
||||
return pkey_;
|
||||
}
|
||||
virtual void destroy() override;
|
||||
virtual const common::ObPartitionKey &get_partition_key() const override { return pkey_; }
|
||||
bool is_inited() const;
|
||||
|
||||
TO_STRING_KV(K_(pkey), K_(store));
|
||||
@ -279,23 +279,31 @@ class ObPartitionStorage : public ObIPartitionStorage {
|
||||
// @param affected_rows [out] successfully insert row number
|
||||
// @param duplicated_rows [out] the iterator of the rowkey(s) of conflict row(s)
|
||||
//
|
||||
virtual int insert_row(const ObStoreCtx &ctx,
|
||||
const ObDMLBaseParam &dml_param,
|
||||
const common::ObIArray<uint64_t> &column_ids,
|
||||
const common::ObNewRow &row);
|
||||
|
||||
virtual int insert_row(const ObStoreCtx& ctx, const ObDMLBaseParam& dml_param,
|
||||
const common::ObIArray<uint64_t>& column_ids, const common::ObNewRow& row);
|
||||
|
||||
virtual int insert_row(const ObStoreCtx& ctx, const ObDMLBaseParam& dml_param,
|
||||
const common::ObIArray<uint64_t>& column_ids, const common::ObIArray<uint64_t>& duplicated_column_ids,
|
||||
const common::ObNewRow& row, const ObInsertFlag flag, int64_t& affected_rows,
|
||||
common::ObNewRowIterator*& duplicated_rows) override;
|
||||
// check whether row has conflict in storage
|
||||
// in_column_ids describe columns of the row, begin with rowey, must include local unique index
|
||||
// out_column_ids describe column of conflict row
|
||||
// check_row_iter is the iterator of rows that will be checked
|
||||
// dup_row_iters are iterators of conflict rows, the number of iterators is same with number of checked rows
|
||||
virtual int fetch_conflict_rows(const ObStoreCtx& ctx, const ObDMLBaseParam& dml_param,
|
||||
const common::ObIArray<uint64_t>& in_column_ids, const common::ObIArray<uint64_t>& out_column_ids,
|
||||
common::ObNewRowIterator& check_row_iter, common::ObIArray<common::ObNewRowIterator*>& dup_row_iters);
|
||||
virtual int revert_insert_iter(common::ObNewRowIterator* iter) override;
|
||||
virtual int insert_row(const ObStoreCtx &ctx,
|
||||
const ObDMLBaseParam &dml_param,
|
||||
const common::ObIArray<uint64_t> &column_ids,
|
||||
const common::ObIArray<uint64_t> &duplicated_column_ids,
|
||||
const common::ObNewRow &row,
|
||||
const ObInsertFlag flag,
|
||||
int64_t &affected_rows,
|
||||
common::ObNewRowIterator *&duplicated_rows) override;
|
||||
//check whether row has conflict in storage
|
||||
//in_column_ids describe columns of the row, begin with rowey, must include local unique index
|
||||
//out_column_ids describe column of conflict row
|
||||
//check_row_iter is the iterator of rows that will be checked
|
||||
//dup_row_iters are iterators of conflict rows, the number of iterators is same with number of checked rows
|
||||
virtual int fetch_conflict_rows(const ObStoreCtx &ctx,
|
||||
const ObDMLBaseParam &dml_param,
|
||||
const common::ObIArray<uint64_t> &in_column_ids,
|
||||
const common::ObIArray<uint64_t> &out_column_ids,
|
||||
common::ObNewRowIterator &check_row_iter,
|
||||
common::ObIArray<common::ObNewRowIterator *> &dup_row_iters) override;
|
||||
virtual int revert_insert_iter(common::ObNewRowIterator *iter) override;
|
||||
//
|
||||
// update rows
|
||||
// update table rows and index rows
|
||||
@ -342,19 +350,29 @@ class ObPartitionStorage : public ObIPartitionStorage {
|
||||
// @retval OB_TRANS_IS_READONLY
|
||||
// @retval OB_ERR_EXCLUSIVE_LOCK_CONFLICT
|
||||
//
|
||||
virtual int lock_rows(const ObStoreCtx& ctx, const ObDMLBaseParam& dml_param, const int64_t abs_lock_timeout,
|
||||
common::ObNewRowIterator* row_iter, ObLockFlag lock_flag, int64_t& affected_rows) override;
|
||||
virtual int lock_rows(const ObStoreCtx& ctx, const ObDMLBaseParam& dml_param, const int64_t abs_lock_timeout,
|
||||
const common::ObNewRow& row, ObLockFlag lock_flag);
|
||||
virtual int lock_rows(const ObStoreCtx &ctx,
|
||||
const ObDMLBaseParam &dml_param,
|
||||
const int64_t abs_lock_timeout,
|
||||
common::ObNewRowIterator *row_iter,
|
||||
ObLockFlag lock_flag,
|
||||
int64_t &affected_rows) override;
|
||||
virtual int lock_rows(const ObStoreCtx &ctx,
|
||||
const ObDMLBaseParam &dml_param,
|
||||
const int64_t abs_lock_timeout,
|
||||
const common::ObNewRow &row,
|
||||
ObLockFlag lock_flag) override;
|
||||
|
||||
virtual int get_concurrent_cnt(uint64_t table_id, int64_t schema_version, int64_t& concurrent_cnt);
|
||||
virtual int get_concurrent_cnt(uint64_t table_id, int64_t schema_version, int64_t &concurrent_cnt) override;
|
||||
|
||||
virtual int get_batch_rows(const ObTableScanParam& param, const storage::ObBatch& batch, int64_t& logical_row_count,
|
||||
int64_t& physical_row_count, common::ObIArray<common::ObEstRowCountRecord>& est_records);
|
||||
virtual int get_batch_rows(const ObTableScanParam ¶m,
|
||||
const storage::ObBatch &batch,
|
||||
int64_t &logical_row_count,
|
||||
int64_t &physical_row_count,
|
||||
common::ObIArray<common::ObEstRowCountRecord> &est_records) override;
|
||||
|
||||
virtual int get_table_stat(const uint64_t table_id, common::ObTableStat& stat);
|
||||
virtual int get_table_stat(const uint64_t table_id, common::ObTableStat &stat) override;
|
||||
|
||||
virtual int lock(const ObStoreCtx& ctx);
|
||||
virtual int lock(const ObStoreCtx &ctx) override;
|
||||
|
||||
virtual void set_merge_status(bool merge_success);
|
||||
virtual bool can_schedule_merge();
|
||||
|
@ -117,7 +117,7 @@ class ObSSTable : public ObITable {
|
||||
virtual int open(const ObCreateSSTableParamWithPartition& param);
|
||||
virtual int open(const blocksstable::ObSSTableBaseMeta& meta);
|
||||
virtual int close();
|
||||
virtual void destroy();
|
||||
virtual void destroy() override;
|
||||
|
||||
// if set success, src ObMacroBlocksWriteCtx will be clear
|
||||
// if set failed, dest sstable macro blocks will be clear
|
||||
@ -271,40 +271,35 @@ class ObSSTable : public ObITable {
|
||||
int get_range(
|
||||
const int64_t idx, const int64_t concurrent_cnt, common::ObIAllocator& allocator, common::ObExtStoreRange& range);
|
||||
|
||||
int get_concurrent_cnt(int64_t tablet_size, int64_t& concurrent_cnt);
|
||||
int query_range_to_macros(common::ObIAllocator& allocator, const common::ObIArray<common::ObStoreRange>& ranges,
|
||||
const int64_t type, uint64_t* macros_count, const int64_t* total_task_count,
|
||||
common::ObIArray<common::ObStoreRange>* splitted_ranges, common::ObIArray<int64_t>* split_index);
|
||||
int exist(const ObStoreCtx& ctx, const uint64_t table_id, const common::ObStoreRowkey& rowkey,
|
||||
const common::ObIArray<share::schema::ObColDesc>& column_ids, bool& is_exist, bool& has_found);
|
||||
virtual int prefix_exist(storage::ObRowsInfo& rows_info, bool& may_exist);
|
||||
int exist(ObRowsInfo& rows_info, bool& is_exist, bool& all_rows_found);
|
||||
int64_t get_occupy_size() const
|
||||
{
|
||||
return meta_.occupy_size_;
|
||||
}
|
||||
int64_t get_total_row_count() const
|
||||
{
|
||||
return meta_.row_count_;
|
||||
}
|
||||
int64_t get_macro_block_count() const
|
||||
{
|
||||
return meta_.macro_block_count_;
|
||||
}
|
||||
inline uint64_t get_table_id() const
|
||||
{
|
||||
return meta_.index_id_;
|
||||
}
|
||||
inline int64_t get_rowkey_column_count() const
|
||||
{
|
||||
return meta_.rowkey_column_count_;
|
||||
}
|
||||
OB_INLINE int64_t get_logical_data_version() const
|
||||
{
|
||||
return meta_.logical_data_version_;
|
||||
}
|
||||
int get_table_stat(common::ObTableStat& stat);
|
||||
virtual int get_frozen_schema_version(int64_t& schema_version) const override;
|
||||
int get_concurrent_cnt(int64_t tablet_size, int64_t &concurrent_cnt);
|
||||
int query_range_to_macros(common::ObIAllocator &allocator,
|
||||
const common::ObIArray<common::ObStoreRange> &ranges,
|
||||
const int64_t type,
|
||||
uint64_t *macros_count,
|
||||
const int64_t *total_task_count,
|
||||
common::ObIArray<common::ObStoreRange> *splitted_ranges,
|
||||
common::ObIArray<int64_t> *split_index);
|
||||
int exist(const ObStoreCtx &ctx,
|
||||
const uint64_t table_id,
|
||||
const common::ObStoreRowkey &rowkey,
|
||||
const common::ObIArray<share::schema::ObColDesc> &column_ids,
|
||||
bool &is_exist,
|
||||
bool &has_found) override;
|
||||
virtual int prefix_exist(
|
||||
storage::ObRowsInfo &rows_info,
|
||||
bool &may_exist) override;
|
||||
int exist(
|
||||
ObRowsInfo &rows_info,
|
||||
bool &is_exist,
|
||||
bool &all_rows_found) override;
|
||||
int64_t get_occupy_size() const { return meta_.occupy_size_; }
|
||||
int64_t get_total_row_count() const { return meta_.row_count_; }
|
||||
int64_t get_macro_block_count() const { return meta_.macro_block_count_; }
|
||||
inline uint64_t get_table_id() const {return meta_.index_id_; }
|
||||
inline int64_t get_rowkey_column_count() const { return meta_.rowkey_column_count_; }
|
||||
OB_INLINE int64_t get_logical_data_version() const { return meta_.logical_data_version_; }
|
||||
int get_table_stat(common::ObTableStat &stat);
|
||||
virtual int get_frozen_schema_version(int64_t &schema_version) const override;
|
||||
int fill_old_meta_info(
|
||||
const int64_t schema_version, const int64_t step_merge_start_version, const int64_t step_merge_end_version);
|
||||
virtual int bf_may_contain_rowkey(const common::ObStoreRowkey& rowkey, bool& contain);
|
||||
@ -327,7 +322,7 @@ class ObSSTable : public ObITable {
|
||||
{
|
||||
return is_multi_version_minor_sstable() ? meta_.get_upper_trans_version() : get_snapshot_version();
|
||||
}
|
||||
virtual int64_t get_max_merged_trans_version() const
|
||||
virtual int64_t get_max_merged_trans_version() const override
|
||||
{
|
||||
return is_multi_version_minor_sstable() ? meta_.get_max_merged_trans_version() : get_snapshot_version();
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ class ObRowkeyObjComparerOracle : public ObRowkeyObjComparer {
|
||||
cmp_ctx_.null_pos_ = NULL_LAST;
|
||||
}
|
||||
virtual ~ObRowkeyObjComparerOracle() = default;
|
||||
virtual int init_compare_func_collation_free(const common::ObObjMeta& obj_meta);
|
||||
virtual OB_INLINE int32_t compare_semi_nullsafe(const common::ObObj& obj1, const common::ObObj& obj2) override
|
||||
virtual int init_compare_func_collation_free(const common::ObObjMeta &obj_meta) override;
|
||||
virtual OB_INLINE int32_t compare_semi_nullsafe(const common::ObObj &obj1, const common::ObObj &obj2) override
|
||||
{
|
||||
int32_t cmp_ret = ObObjCmpFuncs::CR_EQ;
|
||||
if (obj2.is_null()) {
|
||||
@ -124,7 +124,7 @@ class ObRowkeyObjComparerNullsafeMysql : public ObRowkeyObjComparer {
|
||||
cmp_ctx_.null_pos_ = NULL_FIRST;
|
||||
}
|
||||
virtual ~ObRowkeyObjComparerNullsafeMysql() = default;
|
||||
virtual OB_INLINE int32_t compare(const common::ObObj& obj1, const common::ObObj& obj2)
|
||||
virtual OB_INLINE int32_t compare(const common::ObObj &obj1, const common::ObObj &obj2) override
|
||||
{
|
||||
int32_t cmp_ret = 0;
|
||||
if (OB_UNLIKELY(obj1.is_null() || obj2.is_null())) {
|
||||
@ -155,7 +155,7 @@ class ObRowkeyObjComparerNullsafeOracle : public ObRowkeyObjComparerOracle {
|
||||
cmp_ctx_.null_pos_ = NULL_LAST;
|
||||
}
|
||||
virtual ~ObRowkeyObjComparerNullsafeOracle() = default;
|
||||
virtual OB_INLINE int32_t compare(const common::ObObj& obj1, const common::ObObj& obj2)
|
||||
virtual OB_INLINE int32_t compare(const common::ObObj &obj1, const common::ObObj &obj2) override
|
||||
{
|
||||
int32_t cmp_ret = 0;
|
||||
if (OB_UNLIKELY(obj1.is_null() || obj2.is_null())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user