[CP] [CP] fix bug that a tranction span tenant
This commit is contained in:
@ -1216,6 +1216,12 @@ int ObGlobalIndexBuilder::hold_snapshot(const ObGlobalIndexTask* task, const int
|
|||||||
LOG_WARN("fail to start trans", K(ret));
|
LOG_WARN("fail to start trans", K(ret));
|
||||||
} else if (OB_FAIL(ddl_service_->get_snapshot_mgr().acquire_snapshot(trans, info1))) {
|
} else if (OB_FAIL(ddl_service_->get_snapshot_mgr().acquire_snapshot(trans, info1))) {
|
||||||
LOG_WARN("fail to acquire snapshot", K(ret));
|
LOG_WARN("fail to acquire snapshot", K(ret));
|
||||||
|
} else if (!info2.is_valid()) {
|
||||||
|
ret = OB_INVALID_ARGUMENT;
|
||||||
|
LOG_WARN("invalid argument", K(ret), K(info2));
|
||||||
|
} else if (OB_FAIL(ddl_service_->get_snapshot_mgr().set_index_building_snapshot(
|
||||||
|
proxy, info2.table_id_, info2.snapshot_ts_))) {
|
||||||
|
LOG_WARN("fail to set index building snapshot", KR(ret), K(info2));
|
||||||
} else if (OB_FAIL(ddl_service_->get_snapshot_mgr().acquire_snapshot_for_building_index(
|
} else if (OB_FAIL(ddl_service_->get_snapshot_mgr().acquire_snapshot_for_building_index(
|
||||||
trans, info2, info2.table_id_))) {
|
trans, info2, info2.table_id_))) {
|
||||||
LOG_WARN("fail to acquire snapshot", K(ret));
|
LOG_WARN("fail to acquire snapshot", K(ret));
|
||||||
|
|||||||
@ -931,9 +931,13 @@ int ObRSBuildIndexTask::acquire_snapshot(const int64_t snapshot_version, const i
|
|||||||
info.schema_version_ = schema_version;
|
info.schema_version_ = schema_version;
|
||||||
info.tenant_id_ = extract_tenant_id(index_id_);
|
info.tenant_id_ = extract_tenant_id(index_id_);
|
||||||
info.table_id_ = data_table_id;
|
info.table_id_ = data_table_id;
|
||||||
|
common::ObMySQLProxy &proxy = ddl_service_->get_sql_proxy();
|
||||||
if (!info.is_valid()) {
|
if (!info.is_valid()) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("invalid argument", K(ret), K(info));
|
LOG_WARN("invalid argument", K(ret), K(info));
|
||||||
|
} else if (OB_FAIL(ddl_service_->get_snapshot_mgr().set_index_building_snapshot(
|
||||||
|
proxy, info.table_id_, info.snapshot_ts_))) {
|
||||||
|
LOG_WARN("fail to set index building snapshot", KR(ret), K(info));
|
||||||
} else if (OB_FAIL(ddl_service_->get_snapshot_mgr().acquire_snapshot_for_building_index(trans, info, index_id_))) {
|
} else if (OB_FAIL(ddl_service_->get_snapshot_mgr().acquire_snapshot_for_building_index(trans, info, index_id_))) {
|
||||||
LOG_WARN("fail to acquire snapshot", K(ret), K(index_id_), K(data_table_id), K(info));
|
LOG_WARN("fail to acquire snapshot", K(ret), K(index_id_), K(data_table_id), K(info));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ int ObSnapshotInfoManager::init(const ObAddr& self_addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ObSnapshotInfoManager::set_index_building_snapshot(
|
int ObSnapshotInfoManager::set_index_building_snapshot(
|
||||||
common::ObMySQLTransaction& trans, const int64_t index_table_id, const int64_t snapshot_ts)
|
common::ObMySQLProxy &proxy, const int64_t index_table_id, const int64_t snapshot_ts)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObSqlString sql;
|
ObSqlString sql;
|
||||||
@ -49,7 +49,7 @@ int ObSnapshotInfoManager::set_index_building_snapshot(
|
|||||||
ObSchemaUtils::get_extract_schema_id(tenant_id, index_table_id),
|
ObSchemaUtils::get_extract_schema_id(tenant_id, index_table_id),
|
||||||
ObSchemaUtils::get_extract_tenant_id(tenant_id, tenant_id)))) {
|
ObSchemaUtils::get_extract_tenant_id(tenant_id, tenant_id)))) {
|
||||||
LOG_WARN("fail to update index building snapshot", KR(ret), K(index_table_id), K(snapshot_ts));
|
LOG_WARN("fail to update index building snapshot", KR(ret), K(index_table_id), K(snapshot_ts));
|
||||||
} else if (OB_FAIL(trans.write(tenant_id, sql.ptr(), affected_rows))) {
|
} else if (OB_FAIL(proxy.write(tenant_id, sql.ptr(), affected_rows))) {
|
||||||
LOG_WARN("fail to write sql", KR(ret), K(sql));
|
LOG_WARN("fail to write sql", KR(ret), K(sql));
|
||||||
} else if (1 != affected_rows && 0 != affected_rows) {
|
} else if (1 != affected_rows && 0 != affected_rows) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
@ -66,8 +66,6 @@ int ObSnapshotInfoManager::acquire_snapshot_for_building_index(
|
|||||||
if (!snapshot.is_valid()) {
|
if (!snapshot.is_valid()) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("invalid argument", K(ret), K(snapshot));
|
LOG_WARN("invalid argument", K(ret), K(snapshot));
|
||||||
} else if (OB_FAIL(set_index_building_snapshot(trans, index_table_id, snapshot.snapshot_ts_))) {
|
|
||||||
LOG_WARN("fail to set index building snapshot", KR(ret), K(snapshot));
|
|
||||||
} else if (OB_FAIL(snapshot_proxy.add_snapshot(trans, snapshot))) {
|
} else if (OB_FAIL(snapshot_proxy.add_snapshot(trans, snapshot))) {
|
||||||
LOG_WARN("fail to add snapshot", K(ret));
|
LOG_WARN("fail to add snapshot", K(ret));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,11 +40,9 @@ public:
|
|||||||
int check_restore_point(common::ObMySQLProxy& proxy, const int64_t tenant_id, const int64_t table_id, bool& is_exist);
|
int check_restore_point(common::ObMySQLProxy& proxy, const int64_t tenant_id, const int64_t table_id, bool& is_exist);
|
||||||
int get_snapshot_count(
|
int get_snapshot_count(
|
||||||
common::ObMySQLProxy &proxy, const int64_t tenant_id, share::ObSnapShotType snapshot_type, int64_t &count);
|
common::ObMySQLProxy &proxy, const int64_t tenant_id, share::ObSnapShotType snapshot_type, int64_t &count);
|
||||||
|
int set_index_building_snapshot(common::ObMySQLProxy &proxy, const int64_t index_table_id, const int64_t snapshot_ts);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int set_index_building_snapshot(
|
|
||||||
common::ObMySQLTransaction& trans, const int64_t index_table_id, const int64_t snapshot_ts);
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ObSnapshotInfoManager);
|
DISALLOW_COPY_AND_ASSIGN(ObSnapshotInfoManager);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user