fix transaction time out
This commit is contained in:
		@ -175,6 +175,7 @@ int ObSnapshotTableProxy::batch_add_snapshot(
 | 
				
			|||||||
    ret = OB_INVALID_ARGUMENT;
 | 
					    ret = OB_INVALID_ARGUMENT;
 | 
				
			||||||
    LOG_WARN("invalid arguments", K(ret), K(tenant_id), K(schema_version), K(snapshot_version), K(tablet_id_array));
 | 
					    LOG_WARN("invalid arguments", K(ret), K(tenant_id), K(schema_version), K(snapshot_version), K(tablet_id_array));
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
 | 
					    int64_t snapshot_gc_scn = 0;
 | 
				
			||||||
    int64_t report_idx = 0;
 | 
					    int64_t report_idx = 0;
 | 
				
			||||||
    const int64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id);
 | 
					    const int64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id);
 | 
				
			||||||
    ObSnapshotInfo info;
 | 
					    ObSnapshotInfo info;
 | 
				
			||||||
@ -184,6 +185,9 @@ int ObSnapshotTableProxy::batch_add_snapshot(
 | 
				
			|||||||
    info.snapshot_ts_ = snapshot_version;
 | 
					    info.snapshot_ts_ = snapshot_version;
 | 
				
			||||||
    info.schema_version_ = schema_version;
 | 
					    info.schema_version_ = schema_version;
 | 
				
			||||||
    info.comment_ = comment;
 | 
					    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()) {
 | 
					    while (OB_SUCC(ret) && report_idx < tablet_id_array.count()) {
 | 
				
			||||||
      sql.reuse();
 | 
					      sql.reuse();
 | 
				
			||||||
      columns.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) {
 | 
					      for (int64_t i = 0; OB_SUCC(ret) && i < cur_batch_cnt; ++i) {
 | 
				
			||||||
        info.tablet_id_ = tablet_id_array.at(report_idx + i).id();
 | 
					        info.tablet_id_ = tablet_id_array.at(report_idx + i).id();
 | 
				
			||||||
        dml.reuse();
 | 
					        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));
 | 
					          LOG_WARN("fail to check snapshot valid", KR(ret), K(info), K(tenant_id));
 | 
				
			||||||
        } else if (!is_valid) {
 | 
					        } else if (!is_valid) {
 | 
				
			||||||
          ret = OB_SNAPSHOT_DISCARDED;
 | 
					          ret = OB_SNAPSHOT_DISCARDED;
 | 
				
			||||||
@ -399,19 +403,15 @@ int ObSnapshotTableProxy::get_all_snapshots(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ObSnapshotTableProxy::check_snapshot_valid(
 | 
					int ObSnapshotTableProxy::check_snapshot_valid(
 | 
				
			||||||
    ObISQLClient &client,
 | 
					    const int64_t snapshot_gc_scn,
 | 
				
			||||||
    const uint64_t tenant_id,
 | 
					 | 
				
			||||||
    const ObSnapshotInfo &info,
 | 
					    const ObSnapshotInfo &info,
 | 
				
			||||||
    bool &is_valid)
 | 
					    bool &is_valid) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  int ret = OB_SUCCESS;
 | 
					  int ret = OB_SUCCESS;
 | 
				
			||||||
  int64_t snapshot_gc_scn = 0;
 | 
					 | 
				
			||||||
  is_valid = false;
 | 
					  is_valid = false;
 | 
				
			||||||
  if (!info.is_valid()) {
 | 
					  if (!info.is_valid()) {
 | 
				
			||||||
    ret = OB_INVALID_ARGUMENT;
 | 
					    ret = OB_INVALID_ARGUMENT;
 | 
				
			||||||
    LOG_WARN("invalid argument", KR(ret), K(info));
 | 
					    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) {
 | 
					  } else if (info.snapshot_ts_ <= snapshot_gc_scn) {
 | 
				
			||||||
    is_valid = false;
 | 
					    is_valid = false;
 | 
				
			||||||
    LOG_WARN("invalid snapshot info", KR(ret), K(info), K(snapshot_gc_scn));
 | 
					    LOG_WARN("invalid snapshot info", KR(ret), K(info), K(snapshot_gc_scn));
 | 
				
			||||||
 | 
				
			|||||||
@ -144,10 +144,9 @@ public:
 | 
				
			|||||||
                         int64_t &count);
 | 
					                         int64_t &count);
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  int gen_event_ts(int64_t &event_ts);
 | 
					  int gen_event_ts(int64_t &event_ts);
 | 
				
			||||||
  int check_snapshot_valid(common::ObISQLClient &client,
 | 
					  int check_snapshot_valid(const int64_t snapshot_gc_scn,
 | 
				
			||||||
                           const uint64_t tenant_id,
 | 
					 | 
				
			||||||
                           const ObSnapshotInfo &info,
 | 
					                           const ObSnapshotInfo &info,
 | 
				
			||||||
                           bool &is_valid);
 | 
					                           bool &is_valid) const;
 | 
				
			||||||
  int fill_snapshot_item(const ObSnapshotInfo &info,
 | 
					  int fill_snapshot_item(const ObSnapshotInfo &info,
 | 
				
			||||||
      share::ObDMLSqlSplicer &dml);
 | 
					      share::ObDMLSqlSplicer &dml);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user