提交 c71cd910 编写于 作者: O obdev 提交者: wangzelin.wzl

fix transaction time out

上级 aa0443af
......@@ -175,6 +175,7 @@ int ObSnapshotTableProxy::batch_add_snapshot(
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid arguments", K(ret), K(tenant_id), K(schema_version), K(snapshot_version), K(tablet_id_array));
} else {
int64_t snapshot_gc_scn = 0;
int64_t report_idx = 0;
const int64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id);
ObSnapshotInfo info;
......@@ -184,6 +185,9 @@ int ObSnapshotTableProxy::batch_add_snapshot(
info.snapshot_ts_ = snapshot_version;
info.schema_version_ = schema_version;
info.comment_ = comment;
if (OB_FAIL(ObGlobalStatProxy::select_snapshot_gc_scn_for_update(trans, tenant_id, snapshot_gc_scn))) {
LOG_WARN("fail to select gc timstamp for update", KR(ret), K(info), K(tenant_id));
}
while (OB_SUCC(ret) && report_idx < tablet_id_array.count()) {
sql.reuse();
columns.reuse();
......@@ -192,7 +196,7 @@ int ObSnapshotTableProxy::batch_add_snapshot(
for (int64_t i = 0; OB_SUCC(ret) && i < cur_batch_cnt; ++i) {
info.tablet_id_ = tablet_id_array.at(report_idx + i).id();
dml.reuse();
if (OB_FAIL(check_snapshot_valid(trans, info.tenant_id_, info, is_valid))) {
if (OB_FAIL(check_snapshot_valid(snapshot_gc_scn, info, is_valid))) {
LOG_WARN("fail to check snapshot valid", KR(ret), K(info), K(tenant_id));
} else if (!is_valid) {
ret = OB_SNAPSHOT_DISCARDED;
......@@ -399,19 +403,15 @@ int ObSnapshotTableProxy::get_all_snapshots(
}
int ObSnapshotTableProxy::check_snapshot_valid(
ObISQLClient &client,
const uint64_t tenant_id,
const int64_t snapshot_gc_scn,
const ObSnapshotInfo &info,
bool &is_valid)
bool &is_valid) const
{
int ret = OB_SUCCESS;
int64_t snapshot_gc_scn = 0;
is_valid = false;
if (!info.is_valid()) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", KR(ret), K(info));
} else if (OB_FAIL(ObGlobalStatProxy::select_snapshot_gc_scn_for_update(client, tenant_id, snapshot_gc_scn))) {
LOG_WARN("fail to select gc timstamp for update", KR(ret), K(info), K(tenant_id));
} else if (info.snapshot_ts_ <= snapshot_gc_scn) {
is_valid = false;
LOG_WARN("invalid snapshot info", KR(ret), K(info), K(snapshot_gc_scn));
......
......@@ -144,10 +144,9 @@ public:
int64_t &count);
private:
int gen_event_ts(int64_t &event_ts);
int check_snapshot_valid(common::ObISQLClient &client,
const uint64_t tenant_id,
int check_snapshot_valid(const int64_t snapshot_gc_scn,
const ObSnapshotInfo &info,
bool &is_valid);
bool &is_valid) const;
int fill_snapshot_item(const ObSnapshotInfo &info,
share::ObDMLSqlSplicer &dml);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册