Skip to content

Commit f13ebc8

Browse files
guojn1githubgxll
authored andcommitted
[fix][dingo-common] Adjust the DDL timeout to 180 seconds
1 parent fb4a7b0 commit f13ebc8

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

dingo-common/src/main/java/io/dingodb/common/mysql/scope/ScopeVariables.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ public static int getDingoTrxMaxDigestLength() {
159159

160160
public static long getDdlWaitTimeout() {
161161
try {
162-
String timeoutStr = executorProp.getOrDefault("ddl_timeout", "300000").toString();
162+
String timeoutStr = executorProp.getOrDefault("ddl_timeout", "180000").toString();
163163
return Long.parseLong(timeoutStr);
164164
} catch (Exception e) {
165-
return 300000;
165+
return 180000;
166166
}
167167
}
168168

dingo-executor/src/main/java/io/dingodb/server/executor/ddl/DdlWorker.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,13 @@ public Pair<Long, String> handleDDLJobTable(DdlContext dc, DdlJob job) {
176176
LogUtils.warn(log, "[ddl] job txn rollback done, jobId:{}", job.getId());
177177
schemaVer = 0;
178178
}
179-
long start = System.currentTimeMillis();
180179
String error = registerMDLInfo(job, schemaVer);
181-
long end = System.currentTimeMillis();
182-
DingoMetrics.timer("registerMDLInfo").update((end - start), TimeUnit.MILLISECONDS);
183180
if (error != null) {
184181
session.rollback();
185182
LogUtils.warn(log, "[ddl] registerMdlInfo failed, reason:{}, jobId:{}", error, job.getId());
186183
return Pair.of(0L, error);
187184
}
188185
error = updateDDLJob(job, res.getValue() != null);
189-
long sub = System.currentTimeMillis() - start;
190-
DingoMetrics.timer("updateDDLJob").update(sub, TimeUnit.MILLISECONDS);
191186
if (error != null) {
192187
// session rollback
193188
session.rollback();
@@ -217,13 +212,20 @@ public static void registerSync(DdlContext dc, DdlJob ddlJob) {
217212

218213
public String registerMDLInfo(DdlJob job, long ver) {
219214
if (ver == 0) {
215+
LogUtils.error(log, "registerMdlInfo error,ver is zero, jobId:{}", job.getId());
220216
return null;
221217
}
222218
String ids = job.job2TableIDs();
223-
DingoMetrics.counter("registerMDLInfoNone").inc();
224219
String sql = "insert into mysql.dingo_mdl_info (job_id, version, table_ids) values (%d, %d, %s)";
225220
sql = convertSql(String.format(sql, job.getId(), ver, Utils.quoteForSql(ids)));
226-
return session.executeUpdate(sql);
221+
try {
222+
long count = session.executeUpdate1(sql);
223+
LogUtils.info(log, "registerMdlInfo done, insert count:{},jobId:{}, ver:{}, ids:{}",
224+
count, job.getId(), ver, ids);
225+
return null;
226+
} catch (Exception e) {
227+
return e.getMessage();
228+
}
227229
}
228230

229231
public String updateDDLJob(DdlJob job, boolean error) {

dingo-store-proxy/src/main/java/io/dingodb/store/service/SchemaSyncerService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.google.auto.service.AutoService;
2020
import io.dingodb.cluster.ClusterService;
2121
import io.dingodb.common.Location;
22-
import io.dingodb.common.ddl.ActionType;
2322
import io.dingodb.common.ddl.DdlUtil;
2423
import io.dingodb.common.log.LogUtils;
2524
import io.dingodb.common.store.KeyValue;
@@ -119,7 +118,7 @@ public String ownerCheckAllVersions(long jobId, long latestVer, boolean reorg) {
119118

120119
long end = System.currentTimeMillis();
121120
long cost = end - start;
122-
if (cost > 80000 && !reorg) {
121+
if (cost > 50000 && !reorg) {
123122
LogUtils.error(log, "[ddl] ownerCheckAllVersions take long time, "
124123
+ "jobId:{}, latestVer:{}", jobId, latestVer);
125124
return "Lock wait timeout exceeded";

0 commit comments

Comments
 (0)