Fix memstore not release after table refresh
This commit is contained in:
@ -271,8 +271,8 @@ TEST_F(TestTableScanPureDataTable, table_scan_pure_data_table)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
system("rm -f test_table_scan_pure_data_table.log*");
|
||||
OB_LOGGER.set_log_level("INFO");
|
||||
OB_LOGGER.set_file_name("test_table_scan_pure_data_table.log", true);
|
||||
OB_LOGGER.set_log_level(OB_LOG_LEVEL_INFO);
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ ObMultipleMerge::ObMultipleMerge()
|
||||
need_output_row_with_nop_(false),
|
||||
inited_(false),
|
||||
range_idx_delta_(0),
|
||||
get_table_param_(),
|
||||
get_table_param_(nullptr),
|
||||
read_memtable_only_(false),
|
||||
block_row_store_(nullptr),
|
||||
out_project_cols_(),
|
||||
@ -89,9 +89,9 @@ ObMultipleMerge::~ObMultipleMerge()
|
||||
}
|
||||
|
||||
int ObMultipleMerge::init(
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param)
|
||||
ObGetTableParam &get_table_param)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(inited_)) {
|
||||
@ -138,7 +138,7 @@ int ObMultipleMerge::init(
|
||||
cur_row_.storage_datums_[i].set_nop();
|
||||
}
|
||||
unprojected_row_.count_ = 0;
|
||||
get_table_param_ = get_table_param;
|
||||
get_table_param_ = &get_table_param;
|
||||
const ObITableReadInfo *read_info = access_param_->iter_param_.get_read_info();
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_ISNULL(read_info)) {
|
||||
@ -172,14 +172,14 @@ int ObMultipleMerge::init(
|
||||
}
|
||||
|
||||
int ObMultipleMerge::switch_param(
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param)
|
||||
ObGetTableParam &get_table_param)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
access_param_ = ¶m;
|
||||
access_ctx_ = &context;
|
||||
get_table_param_ = get_table_param;
|
||||
get_table_param_ = &get_table_param;
|
||||
|
||||
if (OB_FAIL(prepare_read_tables())) {
|
||||
STORAGE_LOG(WARN, "Failed to prepare read tables", K(ret), K(*this));
|
||||
@ -1078,7 +1078,7 @@ int ObMultipleMerge::prepare_read_tables(bool refresh)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
tables_.reset();
|
||||
if (OB_UNLIKELY(!get_table_param_.is_valid() || !access_param_->is_valid() || NULL == access_ctx_)) {
|
||||
if (OB_UNLIKELY(OB_ISNULL(get_table_param_) || !access_param_->is_valid() || NULL == access_ctx_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObMultipleMerge has not been inited", K(ret), K_(get_table_param), KP_(access_param),
|
||||
KP_(access_ctx));
|
||||
@ -1086,22 +1086,22 @@ int ObMultipleMerge::prepare_read_tables(bool refresh)
|
||||
0 != access_ctx_->trans_version_range_.base_version_)) {
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_WARN("base version should be 0", K(ret), K(access_ctx_->trans_version_range_.base_version_));
|
||||
} else if (!refresh && get_table_param_.tablet_iter_.table_iter()->is_valid()) {
|
||||
if (OB_FAIL(prepare_tables_from_iterator(*get_table_param_.tablet_iter_.table_iter()))) {
|
||||
LOG_WARN("prepare tables fail", K(ret), K(get_table_param_.tablet_iter_.table_iter()));
|
||||
} else if (!refresh && get_table_param_->tablet_iter_.table_iter()->is_valid()) {
|
||||
if (OB_FAIL(prepare_tables_from_iterator(*get_table_param_->tablet_iter_.table_iter()))) {
|
||||
LOG_WARN("prepare tables fail", K(ret), K(get_table_param_->tablet_iter_.table_iter()));
|
||||
}
|
||||
} else if (OB_FAIL(FALSE_IT(get_table_param_.tablet_iter_.table_iter()->reset()))) {
|
||||
} else if (FALSE_IT(get_table_param_->tablet_iter_.table_iter()->reset())) {
|
||||
} else {
|
||||
if (OB_UNLIKELY(get_table_param_.frozen_version_ != -1)) {
|
||||
if (!get_table_param_.sample_info_.is_no_sample()) {
|
||||
if (OB_UNLIKELY(get_table_param_->frozen_version_ != -1)) {
|
||||
if (!get_table_param_->sample_info_.is_no_sample()) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("sample query does not support frozen_version", K(ret), K_(get_table_param), KP_(access_param));
|
||||
} else if (OB_FAIL(get_table_param_.tablet_iter_.refresh_read_tables_from_tablet(
|
||||
get_table_param_.frozen_version_, false/*allow_not_ready*/, true/*major only*/))) {
|
||||
} else if (OB_FAIL(get_table_param_->tablet_iter_.refresh_read_tables_from_tablet(
|
||||
get_table_param_->frozen_version_, false/*allow_not_ready*/, true/*major only*/))) {
|
||||
LOG_WARN("get table iterator fail", K(ret), K_(get_table_param), KP_(access_param));
|
||||
}
|
||||
} else if (OB_FAIL(get_table_param_.tablet_iter_.refresh_read_tables_from_tablet(
|
||||
get_table_param_.sample_info_.is_no_sample()
|
||||
} else if (OB_FAIL(get_table_param_->tablet_iter_.refresh_read_tables_from_tablet(
|
||||
get_table_param_->sample_info_.is_no_sample()
|
||||
? access_ctx_->store_ctx_->mvcc_acc_ctx_.get_snapshot_version().get_val_for_tx()
|
||||
: INT64_MAX,
|
||||
false/*allow_not_ready*/))) {
|
||||
@ -1109,8 +1109,8 @@ int ObMultipleMerge::prepare_read_tables(bool refresh)
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(prepare_tables_from_iterator(*get_table_param_.tablet_iter_.table_iter(), &get_table_param_.sample_info_))) {
|
||||
LOG_WARN("failed to prepare tables from iter", K(ret), K(get_table_param_.tablet_iter_.table_iter()));
|
||||
if (OB_FAIL(prepare_tables_from_iterator(*get_table_param_->tablet_iter_.table_iter(), &get_table_param_->sample_info_))) {
|
||||
LOG_WARN("failed to prepare tables from iter", K(ret), K(get_table_param_->tablet_iter_.table_iter()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1220,11 +1220,11 @@ int ObMultipleMerge::refresh_tablet_iter()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObLSHandle ls_handle;
|
||||
if (OB_UNLIKELY(!get_table_param_.tablet_iter_.is_valid())) {
|
||||
if (OB_UNLIKELY(!get_table_param_->tablet_iter_.is_valid())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tablet iter is invalid", K(ret), K(get_table_param_.tablet_iter_));
|
||||
LOG_WARN("tablet iter is invalid", K(ret), K(get_table_param_->tablet_iter_));
|
||||
} else {
|
||||
const common::ObTabletID tablet_id = get_table_param_.tablet_iter_.get_tablet()->get_tablet_meta().tablet_id_;
|
||||
const common::ObTabletID tablet_id = get_table_param_->tablet_iter_.get_tablet()->get_tablet_meta().tablet_id_;
|
||||
if (OB_FAIL(MTL(ObLSService*)->get_ls(access_ctx_->ls_id_, ls_handle, ObLSGetMod::STORAGE_MOD))) {
|
||||
LOG_WARN("failed to get ls", K(ret));
|
||||
} else if (OB_ISNULL(ls_handle.get_ls())) {
|
||||
@ -1232,12 +1232,15 @@ int ObMultipleMerge::refresh_tablet_iter()
|
||||
LOG_WARN("ls is null", K(ret), K(ls_handle));
|
||||
} else if (OB_FAIL(ls_handle.get_ls()->get_tablet_svr()->get_read_tables(
|
||||
tablet_id,
|
||||
get_table_param_.sample_info_.is_no_sample()
|
||||
get_table_param_->sample_info_.is_no_sample()
|
||||
? access_ctx_->store_ctx_->mvcc_acc_ctx_.get_snapshot_version().get_val_for_tx()
|
||||
: INT64_MAX,
|
||||
get_table_param_.tablet_iter_,
|
||||
get_table_param_->tablet_iter_,
|
||||
false/*allow_not_ready*/))) {
|
||||
LOG_WARN("failed to refresh tablet iterator", K(ret), K_(get_table_param), KP_(access_param));
|
||||
} else {
|
||||
access_param_->iter_param_.rowkey_read_info_ =
|
||||
&(get_table_param_->tablet_iter_.get_tablet_handle().get_obj()->get_rowkey_read_info());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -44,13 +44,13 @@ public:
|
||||
ObMultipleMerge();
|
||||
virtual ~ObMultipleMerge();
|
||||
virtual int init(
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param);
|
||||
ObGetTableParam &get_table_param);
|
||||
virtual int switch_param(
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param);
|
||||
ObGetTableParam &get_table_param);
|
||||
virtual int get_next_row(blocksstable::ObDatumRow *&row);
|
||||
virtual int get_next_rows(int64_t &count, int64_t capacity) override;
|
||||
virtual void reset();
|
||||
@ -122,7 +122,7 @@ private:
|
||||
protected:
|
||||
common::ObArenaAllocator padding_allocator_;
|
||||
MergeIterators iters_;
|
||||
const ObTableAccessParam *access_param_;
|
||||
ObTableAccessParam *access_param_;
|
||||
ObTableAccessContext *access_ctx_;
|
||||
common::ObSEArray<storage::ObITable *, common::DEFAULT_STORE_CNT_IN_STORAGE> tables_;
|
||||
blocksstable::ObDatumRow cur_row_;
|
||||
@ -139,7 +139,7 @@ protected:
|
||||
bool need_output_row_with_nop_; // for sampling increment data
|
||||
bool inited_;
|
||||
int64_t range_idx_delta_;
|
||||
ObGetTableParam get_table_param_;
|
||||
ObGetTableParam *get_table_param_;
|
||||
bool read_memtable_only_;
|
||||
ObBlockRowStore *block_row_store_;
|
||||
common::ObSEArray<share::schema::ObColDesc, 32> out_project_cols_;
|
||||
@ -159,7 +159,7 @@ private:
|
||||
OB_INLINE int ObMultipleMerge::check_need_refresh_table(bool &need_refresh)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
need_refresh = get_table_param_.tablet_iter_.table_iter()->check_store_expire();
|
||||
need_refresh = get_table_param_->tablet_iter_.table_iter()->check_store_expire();
|
||||
#ifdef ERRSIM
|
||||
ret = OB_E(EventTable::EN_FORCE_REFRESH_TABLE) ret;
|
||||
if (OB_FAIL(ret)) {
|
||||
|
@ -28,9 +28,9 @@ ObMultipleMultiSkipScanMerge::~ObMultipleMultiSkipScanMerge()
|
||||
}
|
||||
|
||||
int ObMultipleMultiSkipScanMerge::init(
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param)
|
||||
ObGetTableParam &get_table_param)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(ObMultipleSkipScanMerge::init(param, context, get_table_param))) {
|
||||
|
@ -23,9 +23,9 @@ public:
|
||||
ObMultipleMultiSkipScanMerge();
|
||||
virtual ~ObMultipleMultiSkipScanMerge();
|
||||
virtual int init(
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param) override;
|
||||
ObGetTableParam &get_table_param) override;
|
||||
virtual void reset() override;
|
||||
virtual void reuse() override;
|
||||
int open(
|
||||
|
@ -65,9 +65,9 @@ int ObMultipleScanMerge::open(const ObDatumRange &range)
|
||||
}
|
||||
|
||||
int ObMultipleScanMerge::init(
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param)
|
||||
ObGetTableParam &get_table_param)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(ObMultipleMerge::init(param, context, get_table_param))) {
|
||||
|
@ -34,9 +34,9 @@ public:
|
||||
public:
|
||||
int open(const blocksstable::ObDatumRange &range);
|
||||
virtual int init(
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param);
|
||||
ObGetTableParam &get_table_param);
|
||||
virtual void reset() override;
|
||||
virtual void reuse() override;
|
||||
inline void set_iter_del_row(const bool iter_del_row) { iter_del_row_ = iter_del_row; }
|
||||
|
@ -39,9 +39,9 @@ ObMultipleSkipScanMerge::~ObMultipleSkipScanMerge()
|
||||
}
|
||||
|
||||
int ObMultipleSkipScanMerge::init(
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param)
|
||||
ObGetTableParam &get_table_param)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
context.range_allocator_ = &range_allocator_;
|
||||
|
@ -26,9 +26,9 @@ public:
|
||||
ObMultipleSkipScanMerge();
|
||||
virtual ~ObMultipleSkipScanMerge();
|
||||
virtual int init(
|
||||
const ObTableAccessParam ¶m,
|
||||
ObTableAccessParam ¶m,
|
||||
ObTableAccessContext &context,
|
||||
const ObGetTableParam &get_table_param) override;
|
||||
ObGetTableParam &get_table_param) override;
|
||||
virtual void reset() override;
|
||||
virtual void reuse() override;
|
||||
int open(const blocksstable::ObDatumRange &range) { return OB_NOT_SUPPORTED; }
|
||||
|
@ -34,6 +34,13 @@ ObRowsInfo::ExistHelper::~ExistHelper()
|
||||
{
|
||||
}
|
||||
|
||||
void ObRowsInfo::ExistHelper::reset()
|
||||
{
|
||||
table_iter_param_.reset();
|
||||
table_access_context_.reset();
|
||||
is_inited_ = false;
|
||||
}
|
||||
|
||||
int ObRowsInfo::ExistHelper::init(const ObRelativeTable &table,
|
||||
ObStoreCtx &store_ctx,
|
||||
const ObITableReadInfo &rowkey_read_info,
|
||||
@ -98,6 +105,26 @@ ObRowsInfo::~ObRowsInfo()
|
||||
{
|
||||
}
|
||||
|
||||
void ObRowsInfo::reset()
|
||||
{
|
||||
exist_helper_.reset();
|
||||
min_key_.set_max_rowkey();
|
||||
rows_ = nullptr;
|
||||
delete_count_ = 0;
|
||||
rowkey_column_num_ = 0;
|
||||
rows_ = nullptr;
|
||||
datum_utils_ = nullptr;
|
||||
tablet_id_.reset();
|
||||
permutation_.reset();
|
||||
rowkeys_.reset();
|
||||
scan_mem_allocator_.reset();
|
||||
key_allocator_.reset();
|
||||
delete_count_ = 0;
|
||||
error_code_ = 0;
|
||||
conflict_rowkey_idx_ = -1;
|
||||
is_inited_ = false;
|
||||
}
|
||||
|
||||
int ObRowsInfo::init(
|
||||
const ObRelativeTable &table,
|
||||
ObStoreCtx &store_ctx,
|
||||
|
@ -59,8 +59,9 @@ public:
|
||||
static const int MAX_ROW_KEYS_ON_STACK = 16;
|
||||
using ObRowkeyAndLockStates = common::ObSEArray<ObMarkedRowkeyAndLockState, MAX_ROW_KEYS_ON_STACK>;
|
||||
using ObPermutation = common::ObSEArray<uint32_t, MAX_ROW_KEYS_ON_STACK>;
|
||||
explicit ObRowsInfo();
|
||||
ObRowsInfo();
|
||||
~ObRowsInfo();
|
||||
void reset();
|
||||
OB_INLINE bool is_valid() const
|
||||
{
|
||||
return is_inited_ && exist_helper_.is_valid() && delete_count_ >= 0
|
||||
@ -197,13 +198,14 @@ public:
|
||||
void return_exist_iter(ObStoreRowIterator *exist_iter);
|
||||
void reuse_scan_mem_allocator() { scan_mem_allocator_.reuse(); }
|
||||
ObTableAccessContext &get_access_context() { return exist_helper_.table_access_context_; }
|
||||
bool is_inited() const { return is_inited_; }
|
||||
TO_STRING_KV(K_(rowkeys), K_(permutation), K_(min_key), K_(delete_count), K_(conflict_rowkey_idx), K_(error_code),
|
||||
K_(exist_helper));
|
||||
public:
|
||||
struct ExistHelper final {
|
||||
struct ExistHelper final
|
||||
{
|
||||
ExistHelper();
|
||||
~ExistHelper();
|
||||
void reset();
|
||||
int init(
|
||||
const ObRelativeTable &table,
|
||||
ObStoreCtx &store_ctx,
|
||||
@ -215,6 +217,7 @@ public:
|
||||
ObTableIterParam table_iter_param_;
|
||||
ObTableAccessContext table_access_context_;
|
||||
bool is_inited_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ExistHelper);
|
||||
};
|
||||
private:
|
||||
struct RowsCompare {
|
||||
|
@ -41,11 +41,11 @@ int ObSingleMerge::open(const ObDatumRowkey &rowkey)
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(ObMultipleMerge::open())) {
|
||||
STORAGE_LOG(WARN, "Fail to open ObMultipleMerge, ", K(ret));
|
||||
} else if (OB_UNLIKELY(!get_table_param_.is_valid())) {
|
||||
} else if (OB_ISNULL(get_table_param_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObSingleMerge has not been inited", K(ret), K_(get_table_param));
|
||||
} else {
|
||||
const ObTabletMeta &tablet_meta = get_table_param_.tablet_iter_.get_tablet()->get_tablet_meta();
|
||||
const ObTabletMeta &tablet_meta = get_table_param_->tablet_iter_.get_tablet()->get_tablet_meta();
|
||||
if (!full_row_.is_valid()) {
|
||||
if (OB_FAIL(full_row_.init(*access_ctx_->stmt_allocator_, access_param_->get_max_out_col_cnt()))) {
|
||||
STORAGE_LOG(WARN, "Failed to init datum row", K(ret));
|
||||
@ -245,7 +245,7 @@ int ObSingleMerge::inner_get_next_row(ObDatumRow &row)
|
||||
ObITable *table = tables_.at(0);
|
||||
bool have_uncommited_row = false;
|
||||
const ObITableReadInfo *read_info = access_param_->iter_param_.get_read_info();
|
||||
const ObTabletMeta &tablet_meta = get_table_param_.tablet_iter_.get_tablet()->get_tablet_meta();
|
||||
const ObTabletMeta &tablet_meta = get_table_param_->tablet_iter_.get_tablet()->get_tablet_meta();
|
||||
const int64_t read_snapshot_version = access_ctx_->trans_version_range_.snapshot_version_;
|
||||
const bool enable_fuse_row_cache = access_ctx_->use_fuse_row_cache_ &&
|
||||
access_param_->iter_param_.enable_fuse_row_cache(access_ctx_->query_flag_) &&
|
||||
|
@ -2663,20 +2663,24 @@ int ObLSTabletService::insert_rows(
|
||||
if (OB_FAIL(prepare_dml_running_ctx(&column_ids, nullptr, tablet_handle, run_ctx))) {
|
||||
LOG_WARN("failed to prepare dml running ctx", K(ret));
|
||||
} else {
|
||||
ObTabletHandle tmp_handle;
|
||||
SMART_VAR(ObRowsInfo, rows_info) {
|
||||
const ObRelativeTable &data_table = run_ctx.relative_table_;
|
||||
while (OB_SUCC(ret) && OB_SUCC(get_next_rows(row_iter, rows, row_count))) {
|
||||
ObStoreRow reserved_row;
|
||||
if (row_count <= 0) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("row_count should be greater than 0", K(ret));
|
||||
} else if (!rows_info.is_inited()) {
|
||||
const ObITableReadInfo &rowkey_read_info = tablet_handle.get_obj()->get_rowkey_read_info();
|
||||
if(OB_FAIL(rows_info.init(data_table, ctx, rowkey_read_info))) {
|
||||
// Let ObStorageTableGuard refresh retired memtable, should not hold origin tablet handle
|
||||
// outside the while loop.
|
||||
if (tmp_handle.get_obj() != run_ctx.relative_table_.tablet_iter_.get_tablet_handle().get_obj()) {
|
||||
tmp_handle = run_ctx.relative_table_.tablet_iter_.get_tablet_handle();
|
||||
rows_info.reset();
|
||||
if (OB_FAIL(rows_info.init(data_table, ctx, tmp_handle.get_obj()->get_rowkey_read_info()))) {
|
||||
LOG_WARN("Failed to init rows info", K(ret), K(data_table));
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (row_count <= 0) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("row_count should be greater than 0", K(ret));
|
||||
} else if (1 == row_count) {
|
||||
tbl_rows = &reserved_row;
|
||||
tbl_rows[0].flag_.set_flag(ObDmlFlag::DF_INSERT);
|
||||
@ -2918,6 +2922,7 @@ int ObLSTabletService::update_rows(
|
||||
const ObRelativeTable &relative_table = run_ctx.relative_table_;
|
||||
if (OB_FAIL(prepare_dml_running_ctx(&column_ids, &updated_column_ids, tablet_handle, run_ctx))) {
|
||||
LOG_WARN("failed to prepare dml running ctx", K(ret));
|
||||
} else if (FALSE_IT(tablet_handle.reset())) {
|
||||
} else if (FALSE_IT(timeguard.click("Prepare"))) {
|
||||
} else if (OB_UNLIKELY(!relative_table.is_valid())) {
|
||||
ret = OB_ERR_SYS;
|
||||
@ -2946,10 +2951,16 @@ int ObLSTabletService::update_rows(
|
||||
}
|
||||
|
||||
int64_t cur_time = 0;
|
||||
ObTabletHandle tmp_handle;
|
||||
while (OB_SUCC(ret)
|
||||
&& OB_SUCC(get_next_row_from_iter(row_iter, old_tbl_row, true))
|
||||
&& OB_SUCC(get_next_row_from_iter(row_iter, new_tbl_row, false))) {
|
||||
LOG_DEBUG("get_dml_update_row", KP(row_iter), K(old_tbl_row), K(new_tbl_row));
|
||||
// Let ObStorageTableGuard refresh retired memtable, should not hold origin tablet handle
|
||||
// outside the while loop.
|
||||
if (tmp_handle.get_obj() != run_ctx.relative_table_.tablet_iter_.get_tablet_handle().get_obj()) {
|
||||
tmp_handle = run_ctx.relative_table_.tablet_iter_.get_tablet_handle();
|
||||
}
|
||||
bool duplicate = false;
|
||||
++got_row_count;
|
||||
cur_time = ObClockGenerator::getClock();
|
||||
@ -2957,7 +2968,7 @@ int ObLSTabletService::update_rows(
|
||||
//checking timeout cost too much, so check every 512 rows
|
||||
ret = OB_TIMEOUT;
|
||||
LOG_WARN("query timeout", K(cur_time), K(dml_param), K(ret));
|
||||
} else if (OB_FAIL(update_row_to_tablet(tablet_handle,
|
||||
} else if (OB_FAIL(update_row_to_tablet(tmp_handle,
|
||||
run_ctx,
|
||||
rowkey_change,
|
||||
update_idx,
|
||||
@ -2990,10 +3001,16 @@ int ObLSTabletService::update_rows(
|
||||
timeguard.click("AllocNew");
|
||||
new_tbl_row.row_val_.cells_ = new(ptr1) ObObj[num]();
|
||||
ObRowStore::Iterator row_iter2 = row_store.begin();
|
||||
ObTabletHandle tmp_handle;
|
||||
// when total_quantity_log is true, we should iterate new_tbl_row and old_tbl_row, and
|
||||
// dispose these two rows together, otherwise, when total_quantity_log is false,
|
||||
// row_iter2 doesn't contain old rows, and old_tbl_row is a dummy param in process_new_row
|
||||
while (OB_SUCC(ret) && OB_SUCC(row_iter2.get_next_row(new_tbl_row.row_val_))) {
|
||||
// Let ObStorageTableGuard refresh retired memtable, should not hold origin tablet handle
|
||||
// outside the while loop.
|
||||
if (tmp_handle.get_obj() != run_ctx.relative_table_.tablet_iter_.get_tablet_handle().get_obj()) {
|
||||
tmp_handle = run_ctx.relative_table_.tablet_iter_.get_tablet_handle();
|
||||
}
|
||||
int64_t data_tbl_rowkey_len = relative_table.get_rowkey_column_num();
|
||||
bool tbl_rowkey_change = false;
|
||||
if (OB_FAIL(row_iter2.get_next_row(old_tbl_row.row_val_))) {
|
||||
@ -3005,7 +3022,7 @@ int ObLSTabletService::update_rows(
|
||||
tbl_rowkey_change))) {
|
||||
LOG_WARN("check data table rowkey change failed", K(ret), K(old_tbl_row),
|
||||
K(new_tbl_row), K(data_tbl_rowkey_len));
|
||||
} else if (OB_FAIL(process_new_row(tablet_handle,
|
||||
} else if (OB_FAIL(process_new_row(tmp_handle,
|
||||
run_ctx,
|
||||
update_idx,
|
||||
old_tbl_row,
|
||||
@ -3080,17 +3097,24 @@ int ObLSTabletService::put_rows(
|
||||
if (OB_FAIL(prepare_dml_running_ctx(&column_ids, nullptr, tablet_handle, run_ctx))) {
|
||||
LOG_WARN("failed to prepare dml running ctx", K(ret));
|
||||
} else {
|
||||
tablet_handle.reset();
|
||||
tbl_row.flag_.set_flag(ObDmlFlag::DF_UPDATE);
|
||||
}
|
||||
|
||||
int64_t cur_time = 0;
|
||||
ObTabletHandle tmp_handle;
|
||||
while (OB_SUCC(ret) && OB_SUCC(row_iter->get_next_row(row))) {
|
||||
// Let ObStorageTableGuard refresh retired memtable, should not hold origin tablet handle
|
||||
// outside the while loop.
|
||||
if (tmp_handle.get_obj() != run_ctx.relative_table_.tablet_iter_.get_tablet_handle().get_obj()) {
|
||||
tmp_handle = run_ctx.relative_table_.tablet_iter_.get_tablet_handle();
|
||||
}
|
||||
cur_time = ObClockGenerator::getClock();
|
||||
tbl_row.row_val_ = *row;
|
||||
if (cur_time > dml_param.timeout_) {
|
||||
ret = OB_TIMEOUT;
|
||||
LOG_WARN("query timeout", K(ret), K(cur_time), K(dml_param));
|
||||
} else if (OB_FAIL(insert_row_to_tablet(tablet_handle, run_ctx, tbl_row))) {
|
||||
} else if (OB_FAIL(insert_row_to_tablet(tmp_handle, run_ctx, tbl_row))) {
|
||||
if (OB_TRY_LOCK_ROW_CONFLICT != ret && OB_TRANSACTION_SET_VIOLATION != ret) {
|
||||
LOG_WARN("failed to write row", K(ret));
|
||||
}
|
||||
@ -3145,10 +3169,18 @@ int ObLSTabletService::delete_rows(
|
||||
ObNewRow *row = nullptr;
|
||||
if (OB_FAIL(prepare_dml_running_ctx(&column_ids, nullptr, tablet_handle, run_ctx))) {
|
||||
LOG_WARN("failed to prepare dml running ctx", K(ret));
|
||||
} else {
|
||||
tablet_handle.reset();
|
||||
}
|
||||
// delete table rows
|
||||
int64_t cur_time = 0;
|
||||
ObTabletHandle tmp_handle;
|
||||
while (OB_SUCC(ret) && OB_SUCC(row_iter->get_next_row(row))) {
|
||||
// Let ObStorageTableGuard refresh retired memtable, should not hold origin tablet handle
|
||||
// outside the while loop.
|
||||
if (tmp_handle.get_obj() != run_ctx.relative_table_.tablet_iter_.get_tablet_handle().get_obj()) {
|
||||
tmp_handle = run_ctx.relative_table_.tablet_iter_.get_tablet_handle();
|
||||
}
|
||||
cur_time = ObClockGenerator::getClock();
|
||||
if (cur_time > run_ctx.dml_param_.timeout_) {
|
||||
ret = OB_TIMEOUT;
|
||||
@ -3156,7 +3188,7 @@ int ObLSTabletService::delete_rows(
|
||||
} else if (OB_ISNULL(row)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get next row from iterator failed", KP(row), K(ret));
|
||||
} else if (OB_FAIL(delete_row_in_tablet(tablet_handle, run_ctx, *row))) {
|
||||
} else if (OB_FAIL(delete_row_in_tablet(tmp_handle, run_ctx, *row))) {
|
||||
LOG_WARN("fail to delete row", K(ret), K(row));
|
||||
} else {
|
||||
++afct_num;
|
||||
@ -3215,6 +3247,7 @@ int ObLSTabletService::lock_rows(
|
||||
ObNewRow *row = nullptr;
|
||||
if (OB_FAIL(prepare_dml_running_ctx(nullptr, nullptr, tablet_handle, run_ctx))) {
|
||||
LOG_WARN("failed to prepare dml running ctx", K(ret));
|
||||
} else if (FALSE_IT(tablet_handle.reset())) {
|
||||
} else if (FALSE_IT(timeguard.click("Prepare"))) {
|
||||
} else if (OB_FAIL(run_ctx.relative_table_.get_rowkey_column_ids(col_desc))) {
|
||||
LOG_WARN("Fail to get column desc", K(ret));
|
||||
@ -3225,7 +3258,13 @@ int ObLSTabletService::lock_rows(
|
||||
run_ctx.column_ids_ = &column_ids;
|
||||
ctx.mvcc_acc_ctx_.abs_lock_timeout_ =
|
||||
ObTablet::get_lock_wait_timeout(abs_lock_timeout, dml_param.timeout_);
|
||||
ObTabletHandle tmp_handle;
|
||||
while (OB_SUCCESS == ret && OB_SUCC(row_iter->get_next_row(row))) {
|
||||
// Let ObStorageTableGuard refresh retired memtable, should not hold origin tablet handle
|
||||
// outside the while loop.
|
||||
if (tmp_handle.get_obj() != run_ctx.relative_table_.tablet_iter_.get_tablet_handle().get_obj()) {
|
||||
tmp_handle = run_ctx.relative_table_.tablet_iter_.get_tablet_handle();
|
||||
}
|
||||
ObRelativeTable &relative_table = run_ctx.relative_table_;
|
||||
bool is_exists = true;
|
||||
if (ObTimeUtility::current_time() > dml_param.timeout_) {
|
||||
@ -3233,13 +3272,13 @@ int ObLSTabletService::lock_rows(
|
||||
int64_t cur_time = ObClockGenerator::getClock();
|
||||
LOG_WARN("query timeout", K(cur_time), K(dml_param), K(ret));
|
||||
} else if (GCONF.enable_defensive_check()
|
||||
&& OB_FAIL(check_old_row_legitimacy(tablet_handle, run_ctx, *row))) {
|
||||
&& OB_FAIL(check_old_row_legitimacy(tmp_handle, run_ctx, *row))) {
|
||||
LOG_WARN("check row legitimacy failed", K(ret), KPC(row));
|
||||
} else if (GCONF.enable_defensive_check()
|
||||
&& OB_FAIL(check_new_row_nullable_value(col_desc, relative_table, *row))) {
|
||||
LOG_WARN("check lock row nullable failed", K(ret));
|
||||
} else if (FALSE_IT(timeguard.click("Check"))) {
|
||||
} else if (OB_FAIL(tablet_handle.get_obj()->lock_row(run_ctx.relative_table_, ctx, *row))) {
|
||||
} else if (OB_FAIL(tmp_handle.get_obj()->lock_row(run_ctx.relative_table_, ctx, *row))) {
|
||||
if (OB_TRY_LOCK_ROW_CONFLICT != ret) {
|
||||
LOG_WARN("failed to lock row", K(*row), K(ret));
|
||||
}
|
||||
|
@ -120,6 +120,7 @@ public:
|
||||
int64_t frozen_version_;
|
||||
common::SampleInfo sample_info_;
|
||||
ObTabletTableIterator tablet_iter_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObGetTableParam);
|
||||
};
|
||||
|
||||
} // namespace storage
|
||||
|
@ -236,6 +236,7 @@ int ObAccessService::table_scan(
|
||||
const share::ObLSID &ls_id = vparam.ls_id_;
|
||||
const common::ObTabletID &data_tablet_id = vparam.tablet_id_;
|
||||
ObTableScanIterator *iter = nullptr;
|
||||
ObTabletHandle tablet_handle;
|
||||
ObLS *ls = nullptr;
|
||||
ObLSTabletService *tablet_service = nullptr;
|
||||
ObTableScanParam ¶m = static_cast<ObTableScanParam &>(vparam);
|
||||
@ -266,6 +267,7 @@ int ObAccessService::table_scan(
|
||||
data_tablet_id,
|
||||
access_type,
|
||||
param,
|
||||
tablet_handle,
|
||||
iter->get_ctx_guard(),
|
||||
user_specified_snapshot_scn))) {
|
||||
if (OB_TABLET_NOT_EXIST != ret) {
|
||||
@ -278,7 +280,7 @@ int ObAccessService::table_scan(
|
||||
} else if (OB_ISNULL(tablet_service = ls->get_tablet_svr())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("tablet service should not be null.", K(ret), K(ls_id));
|
||||
} else if (OB_FAIL(tablet_service->table_scan(iter->get_ctx_guard().get_tablet_handle(), *iter, param))) {
|
||||
} else if (OB_FAIL(tablet_service->table_scan(tablet_handle, *iter, param))) {
|
||||
if (OB_TABLET_NOT_EXIST != ret) {
|
||||
LOG_WARN("Fail to scan table, ", K(ret), K(ls_id), K(param));
|
||||
}
|
||||
@ -295,6 +297,7 @@ int ObAccessService::table_rescan(
|
||||
ACTIVE_SESSION_FLAG_SETTER_GUARD(in_storage_read);
|
||||
int ret = OB_SUCCESS;
|
||||
ObTableScanParam ¶m = static_cast<ObTableScanParam &>(vparam);
|
||||
ObTabletHandle tablet_handle;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ob access service is not running.", K(ret));
|
||||
@ -326,6 +329,7 @@ int ObAccessService::table_rescan(
|
||||
data_tablet_id,
|
||||
access_type,
|
||||
param, /*scan_param*/
|
||||
tablet_handle,
|
||||
iter->get_ctx_guard(),
|
||||
user_specified_snapshot_scn))) {
|
||||
if (OB_TABLET_NOT_EXIST != ret) {
|
||||
@ -338,7 +342,7 @@ int ObAccessService::table_rescan(
|
||||
} else if (OB_ISNULL(tablet_service = ls->get_tablet_svr())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("tablet service should not be null.", K(ret), K(ls_id));
|
||||
} else if (OB_FAIL(tablet_service->table_rescan(iter->get_ctx_guard().get_tablet_handle(), param, result))) {
|
||||
} else if (OB_FAIL(tablet_service->table_rescan(tablet_handle, param, result))) {
|
||||
if (OB_TABLET_NOT_EXIST != ret) {
|
||||
LOG_WARN("Fail to scan table, ", K(ret), K(result), K(ls_id), K(param));
|
||||
}
|
||||
@ -382,15 +386,17 @@ int ObAccessService::get_write_store_ctx_guard_(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObAccessService::get_source_ls_tx_table_guard_(ObStoreCtxGuard &ctx_guard)
|
||||
int ObAccessService::get_source_ls_tx_table_guard_(
|
||||
const ObTabletHandle &tablet_handle,
|
||||
ObStoreCtxGuard &ctx_guard)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletCreateDeleteMdsUserData user_data;
|
||||
ObTablet *tablet = nullptr;
|
||||
if (OB_ISNULL(tablet = ctx_guard.get_tablet_handle().get_obj())) {
|
||||
const ObTablet *tablet = nullptr;
|
||||
if (OB_ISNULL(tablet = tablet_handle.get_obj())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tablet should not be NULL", K(ret), KPC(tablet));
|
||||
} else if (!tablet->get_tablet_meta().has_transfer_table()) {
|
||||
LOG_WARN("tablet should not be NULL", K(ret), KPC(tablet), K(tablet_handle));
|
||||
} else if (OB_LIKELY(!tablet->get_tablet_meta().has_transfer_table())) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(tablet->ObITabletMdsInterface::get_tablet_status(share::SCN::max_scn(), user_data, ObTabletCommon::DEFAULT_GET_TABLET_DURATION_US))) {
|
||||
LOG_WARN("failed to get tablet status", K(ret), KPC(tablet), K(user_data));
|
||||
@ -434,6 +440,7 @@ int ObAccessService::construct_store_ctx_other_variables_(
|
||||
const common::ObTabletID &tablet_id,
|
||||
const int64_t timeout,
|
||||
const share::SCN &snapshot,
|
||||
ObTabletHandle &tablet_handle,
|
||||
ObStoreCtxGuard &ctx_guard)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -450,9 +457,9 @@ int ObAccessService::construct_store_ctx_other_variables_(
|
||||
LOG_ERROR("failed to check allow to read", K(ret), K(ls_id), K(tablet_id));
|
||||
}
|
||||
} else if (OB_FAIL(tablet_service->get_tablet_with_timeout(
|
||||
tablet_id, ctx_guard.get_tablet_handle(), timeout, ObMDSGetTabletMode::READ_READABLE_COMMITED, snapshot))) {
|
||||
tablet_id, tablet_handle, timeout, ObMDSGetTabletMode::READ_READABLE_COMMITED, snapshot))) {
|
||||
LOG_WARN("failed to check and get tablet", K(ret), K(ls_id), K(tablet_id), K(timeout), K(snapshot));
|
||||
} else if (OB_FAIL(get_source_ls_tx_table_guard_(ctx_guard))) {
|
||||
} else if (OB_FAIL(get_source_ls_tx_table_guard_(tablet_handle, ctx_guard))) {
|
||||
LOG_WARN("failed to get src ls tx table guard", K(ret), K(ls_id), K(tablet_id));
|
||||
}
|
||||
return ret;
|
||||
@ -467,6 +474,7 @@ int ObAccessService::check_read_allowed_(
|
||||
const common::ObTabletID &tablet_id,
|
||||
const ObStoreAccessType access_type,
|
||||
const ObTableScanParam &scan_param,
|
||||
ObTabletHandle &tablet_handle,
|
||||
ObStoreCtxGuard &ctx_guard,
|
||||
SCN user_specified_snapshot)
|
||||
{
|
||||
@ -542,7 +550,7 @@ int ObAccessService::check_read_allowed_(
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(construct_store_ctx_other_variables_(*ls, tablet_id, scan_param.timeout_,
|
||||
ctx.mvcc_acc_ctx_.get_snapshot_version(), ctx_guard))) {
|
||||
ctx.mvcc_acc_ctx_.get_snapshot_version(), tablet_handle, ctx_guard))) {
|
||||
LOG_WARN("failed to check replica allow to read", K(ret), K(tablet_id), "timeout", scan_param.timeout_);
|
||||
}
|
||||
}
|
||||
@ -561,6 +569,7 @@ int ObAccessService::check_write_allowed_(
|
||||
const ObStoreAccessType access_type,
|
||||
const ObDMLBaseParam &dml_param,
|
||||
transaction::ObTxDesc &tx_desc,
|
||||
ObTabletHandle &tablet_handle,
|
||||
ObStoreCtxGuard &ctx_guard)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -621,7 +630,7 @@ int ObAccessService::check_write_allowed_(
|
||||
// After locking the table, it can prevent the tablet from being deleted.
|
||||
// It is necessary to obtain the tablet handle after locking the table to avoid operating the deleted tablet.
|
||||
if (OB_SUCC(ret) && OB_FAIL(construct_store_ctx_other_variables_(*ls, tablet_id, dml_param.timeout_,
|
||||
share::SCN::max_scn(), ctx_guard))) {
|
||||
share::SCN::max_scn(), tablet_handle, ctx_guard))) {
|
||||
LOG_WARN("failed to check replica allow to read", K(ret), K(tablet_id));
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
@ -644,6 +653,8 @@ int ObAccessService::delete_rows(
|
||||
ObStoreCtxGuard ctx_guard;
|
||||
ObLS *ls = nullptr;
|
||||
ObLSTabletService *tablet_service = nullptr;
|
||||
// Attention!!! This handle is only used for ObLSTabletService, will be reset inside ObLSTabletService.
|
||||
ObTabletHandle tablet_handle;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ob access service is not running.", K(ret));
|
||||
@ -661,6 +672,7 @@ int ObAccessService::delete_rows(
|
||||
ObStoreAccessType::MODIFY,
|
||||
dml_param,
|
||||
tx_desc,
|
||||
tablet_handle,
|
||||
ctx_guard))) {
|
||||
LOG_WARN("fail to check query allowed", K(ret), K(ls_id), K(tablet_id));
|
||||
} else if (OB_ISNULL(ls = ctx_guard.get_ls_handle().get_ls())) {
|
||||
@ -670,7 +682,7 @@ int ObAccessService::delete_rows(
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("tablet service should not be null.", K(ret), K(ls_id));
|
||||
} else {
|
||||
ret = tablet_service->delete_rows(ctx_guard.get_tablet_handle(),
|
||||
ret = tablet_service->delete_rows(tablet_handle,
|
||||
ctx_guard.get_store_ctx(),
|
||||
dml_param,
|
||||
column_ids,
|
||||
@ -700,6 +712,8 @@ int ObAccessService::put_rows(
|
||||
ObStoreCtxGuard ctx_guard;
|
||||
ObLS *ls = nullptr;
|
||||
ObLSTabletService *tablet_service = nullptr;
|
||||
// Attention!!! This handle is only used for ObLSTabletService, will be reset inside ObLSTabletService.
|
||||
ObTabletHandle tablet_handle;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ob access service is not running.", K(ret));
|
||||
@ -717,6 +731,7 @@ int ObAccessService::put_rows(
|
||||
ObStoreAccessType::MODIFY,
|
||||
dml_param,
|
||||
tx_desc,
|
||||
tablet_handle,
|
||||
ctx_guard))) {
|
||||
LOG_WARN("fail to check query allowed", K(ret), K(ls_id), K(tablet_id));
|
||||
} else if (OB_ISNULL(ls = ctx_guard.get_ls_handle().get_ls())) {
|
||||
@ -726,7 +741,7 @@ int ObAccessService::put_rows(
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("tablet service should not be null.", K(ret), K(ls_id));
|
||||
} else {
|
||||
ret = tablet_service->put_rows(ctx_guard.get_tablet_handle(),
|
||||
ret = tablet_service->put_rows(tablet_handle,
|
||||
ctx_guard.get_store_ctx(),
|
||||
dml_param,
|
||||
column_ids,
|
||||
@ -756,6 +771,8 @@ int ObAccessService::insert_rows(
|
||||
ObStoreCtxGuard ctx_guard;
|
||||
ObLS *ls = nullptr;
|
||||
ObLSTabletService *tablet_service = nullptr;
|
||||
// Attention!!! This handle is only used for ObLSTabletService, will be reset inside ObLSTabletService.
|
||||
ObTabletHandle tablet_handle;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ob access service is not running.", K(ret));
|
||||
@ -773,6 +790,7 @@ int ObAccessService::insert_rows(
|
||||
ObStoreAccessType::MODIFY,
|
||||
dml_param,
|
||||
tx_desc,
|
||||
tablet_handle,
|
||||
ctx_guard))) {
|
||||
LOG_WARN("fail to check query allowed", K(ret), K(ls_id), K(tablet_id));
|
||||
} else if (OB_ISNULL(ls = ctx_guard.get_ls_handle().get_ls())) {
|
||||
@ -782,7 +800,7 @@ int ObAccessService::insert_rows(
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("tablet service should not be null.", K(ret), K(ls_id));
|
||||
} else {
|
||||
ret = tablet_service->insert_rows(ctx_guard.get_tablet_handle(),
|
||||
ret = tablet_service->insert_rows(tablet_handle,
|
||||
ctx_guard.get_store_ctx(),
|
||||
dml_param,
|
||||
column_ids,
|
||||
@ -815,6 +833,8 @@ int ObAccessService::insert_row(
|
||||
ObStoreCtxGuard ctx_guard;
|
||||
ObLS *ls = nullptr;
|
||||
ObLSTabletService *tablet_service = nullptr;
|
||||
// Attention!!! This handle is only used for ObLSTabletService, will be reset inside ObLSTabletService.
|
||||
ObTabletHandle tablet_handle;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ob access service is not running.", K(ret));
|
||||
@ -833,6 +853,7 @@ int ObAccessService::insert_row(
|
||||
ObStoreAccessType::MODIFY,
|
||||
dml_param,
|
||||
tx_desc,
|
||||
tablet_handle,
|
||||
ctx_guard))) {
|
||||
LOG_WARN("fail to check query allowed", K(ret), K(ls_id), K(tablet_id));
|
||||
} else if (OB_ISNULL(ls = ctx_guard.get_ls_handle().get_ls())) {
|
||||
@ -842,7 +863,7 @@ int ObAccessService::insert_row(
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("tablet service should not be null.", K(ret), K(ls_id));
|
||||
} else {
|
||||
ret = tablet_service->insert_row(ctx_guard.get_tablet_handle(),
|
||||
ret = tablet_service->insert_row(tablet_handle,
|
||||
ctx_guard.get_store_ctx(),
|
||||
dml_param,
|
||||
column_ids,
|
||||
@ -886,6 +907,8 @@ int ObAccessService::update_rows(
|
||||
ObStoreCtxGuard ctx_guard;
|
||||
ObLS *ls = nullptr;
|
||||
ObLSTabletService *tablet_service = nullptr;
|
||||
// Attention!!! This handle is only used for ObLSTabletService, will be reset inside ObLSTabletService.
|
||||
ObTabletHandle tablet_handle;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ob access service is not running.", K(ret));
|
||||
@ -903,6 +926,7 @@ int ObAccessService::update_rows(
|
||||
ObStoreAccessType::MODIFY,
|
||||
dml_param,
|
||||
tx_desc,
|
||||
tablet_handle,
|
||||
ctx_guard))) {
|
||||
LOG_WARN("fail to check query allowed", K(ret), K(ls_id), K(tablet_id));
|
||||
} else if (OB_ISNULL(ls = ctx_guard.get_ls_handle().get_ls())) {
|
||||
@ -912,7 +936,7 @@ int ObAccessService::update_rows(
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("tablet service should not be null.", K(ret), K(ls_id));
|
||||
} else {
|
||||
ret = tablet_service->update_rows(ctx_guard.get_tablet_handle(),
|
||||
ret = tablet_service->update_rows(tablet_handle,
|
||||
ctx_guard.get_store_ctx(),
|
||||
dml_param,
|
||||
column_ids,
|
||||
@ -944,6 +968,8 @@ int ObAccessService::lock_rows(
|
||||
ObStoreCtxGuard ctx_guard;
|
||||
ObLS *ls = nullptr;
|
||||
ObLSTabletService *tablet_service = nullptr;
|
||||
// Attention!!! This handle is only used for ObLSTabletService, will be reset inside ObLSTabletService.
|
||||
ObTabletHandle tablet_handle;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ob access service is not running.", K(ret));
|
||||
@ -960,6 +986,7 @@ int ObAccessService::lock_rows(
|
||||
ObStoreAccessType::ROW_LOCK,
|
||||
dml_param,
|
||||
tx_desc,
|
||||
tablet_handle,
|
||||
ctx_guard))) {
|
||||
LOG_WARN("fail to check query allowed", K(ret), K(ls_id), K(tablet_id));
|
||||
} else if (OB_ISNULL(ls = ctx_guard.get_ls_handle().get_ls())) {
|
||||
@ -969,7 +996,7 @@ int ObAccessService::lock_rows(
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("tablet service should not be null.", K(ret), K(ls_id));
|
||||
} else {
|
||||
ret = tablet_service->lock_rows(ctx_guard.get_tablet_handle(),
|
||||
ret = tablet_service->lock_rows(tablet_handle,
|
||||
ctx_guard.get_store_ctx(),
|
||||
dml_param,
|
||||
abs_lock_timeout,
|
||||
@ -995,6 +1022,8 @@ int ObAccessService::lock_row(
|
||||
ObStoreCtxGuard ctx_guard;
|
||||
ObLS *ls = nullptr;
|
||||
ObLSTabletService *tablet_service = nullptr;
|
||||
// Attention!!! This handle is only used for ObLSTabletService, will be reset inside ObLSTabletService.
|
||||
ObTabletHandle tablet_handle;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ob access service is not running.", K(ret));
|
||||
@ -1011,6 +1040,7 @@ int ObAccessService::lock_row(
|
||||
ObStoreAccessType::ROW_LOCK,
|
||||
dml_param,
|
||||
tx_desc,
|
||||
tablet_handle,
|
||||
ctx_guard))) {
|
||||
LOG_WARN("fail to check query allowed", K(ret), K(ls_id), K(tablet_id));
|
||||
} else if (OB_ISNULL(ls = ctx_guard.get_ls_handle().get_ls())) {
|
||||
@ -1020,7 +1050,7 @@ int ObAccessService::lock_row(
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("tablet service should not be null.", K(ret), K(ls_id));
|
||||
} else {
|
||||
ret = tablet_service->lock_row(ctx_guard.get_tablet_handle(),
|
||||
ret = tablet_service->lock_row(tablet_handle,
|
||||
ctx_guard.get_store_ctx(),
|
||||
dml_param,
|
||||
abs_lock_timeout,
|
||||
@ -1225,7 +1255,6 @@ void ObAccessService::ObStoreCtxGuard::reset()
|
||||
LOG_WARN_RET(OB_ERR_TOO_MUCH_TIME, "guard used too much time", K(guard_used_us), K_(ls_id), K(lbt()));
|
||||
}
|
||||
ls_id_.reset();
|
||||
tablet_handle_.reset();
|
||||
is_inited_ = false;
|
||||
}
|
||||
}
|
||||
|
@ -64,13 +64,11 @@ public:
|
||||
void reset();
|
||||
ObStoreCtx &get_store_ctx() { return ctx_; }
|
||||
ObLSHandle &get_ls_handle() { return handle_; }
|
||||
ObTabletHandle &get_tablet_handle() { return tablet_handle_; }
|
||||
private:
|
||||
bool is_inited_;
|
||||
ObStoreCtx ctx_;
|
||||
share::ObLSID ls_id_;
|
||||
ObLSHandle handle_;
|
||||
ObTabletHandle tablet_handle_;
|
||||
int64_t init_ts_;
|
||||
};
|
||||
public:
|
||||
@ -215,6 +213,7 @@ protected:
|
||||
const common::ObTabletID &tablet_id,
|
||||
const ObStoreAccessType access_type,
|
||||
const ObTableScanParam &scan_param,
|
||||
ObTabletHandle &tablet_handle,
|
||||
ObStoreCtxGuard &ctx_guard,
|
||||
share::SCN user_specified_snapshot);
|
||||
int check_write_allowed_(
|
||||
@ -223,18 +222,22 @@ protected:
|
||||
const ObStoreAccessType access_type,
|
||||
const ObDMLBaseParam &dml_param,
|
||||
transaction::ObTxDesc &tx_desc,
|
||||
ObTabletHandle &tablet_handle,
|
||||
ObStoreCtxGuard &ctx_guard);
|
||||
int audit_tablet_opt_dml_stat(
|
||||
const ObDMLBaseParam &dml_param,
|
||||
const common::ObTabletID &tablet_id,
|
||||
const common::ObOptDmlStatType dml_stat_type,
|
||||
const int64_t affected_rows);
|
||||
int get_source_ls_tx_table_guard_(ObStoreCtxGuard &ctx_guard);
|
||||
int get_source_ls_tx_table_guard_(
|
||||
const ObTabletHandle &tablet_handle,
|
||||
ObStoreCtxGuard &ctx_guard);
|
||||
int construct_store_ctx_other_variables_(
|
||||
ObLS &ls,
|
||||
const common::ObTabletID &tablet_id,
|
||||
const int64_t timeout,
|
||||
const share::SCN &snapshot,
|
||||
ObTabletHandle &tablet_handle,
|
||||
ObStoreCtxGuard &ctx_guard);
|
||||
private:
|
||||
bool is_inited_;
|
||||
|
@ -38,6 +38,7 @@ int MockObAccessService::insert_rows(
|
||||
int ret = OB_SUCCESS;
|
||||
ObStoreCtxGuard ctx_guard;
|
||||
ObLSHandle handle;
|
||||
ObTabletHandle tablet_handle;
|
||||
|
||||
if (OB_UNLIKELY(!ls_id.is_valid())
|
||||
|| OB_UNLIKELY(!tablet_id.is_valid())
|
||||
@ -56,10 +57,11 @@ int MockObAccessService::insert_rows(
|
||||
ObStoreAccessType::MODIFY,
|
||||
dml_param,
|
||||
tx_desc,
|
||||
tablet_handle,
|
||||
ctx_guard))) {
|
||||
LOG_WARN("fail to check query allowed", K(ret), K(ls_id), K(tablet_id));
|
||||
} else {
|
||||
ret = tablet_service_->insert_rows(ctx_guard.get_tablet_handle(),
|
||||
ret = tablet_service_->insert_rows(tablet_handle,
|
||||
ctx_guard.get_store_ctx(),
|
||||
dml_param,
|
||||
column_ids,
|
||||
|
@ -60,6 +60,7 @@ int MockInsertRowsLSTabletService::prepare_dml_running_ctx(
|
||||
} else if (NULL != column_ids && OB_FAIL(run_ctx.prepare_column_info(*column_ids))) {
|
||||
LOG_WARN("fail to get column descriptions and column map", K(ret), K(*column_ids));
|
||||
} else {
|
||||
relative_table.tablet_iter_.set_tablet_handle(tablet_handle);
|
||||
store_ctx.table_version_ = dml_param.schema_version_;
|
||||
run_ctx.column_ids_ = column_ids;
|
||||
}
|
||||
|
Reference in New Issue
Block a user