This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new ad3ffa9 Refactor release ddl lock (#9428)
ad3ffa9 is described below
commit ad3ffa953edfd0e6269852278a0501ad76f8d613
Author: Haoran Meng <[email protected]>
AuthorDate: Fri Feb 19 17:31:36 2021 +0800
Refactor release ddl lock (#9428)
* Refactor release ddl lock
* Refactor release ddl lock
* Refactor release ddl lock
---
.../apache/shardingsphere/driver/executor/DriverJDBCExecutor.java | 5 ++---
.../proxy/backend/communication/DatabaseCommunicationEngine.java | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/DriverJDBCExecutor.java
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/DriverJDBCExecutor.java
index 9f41d32..356ec31 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/DriverJDBCExecutor.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/DriverJDBCExecutor.java
@@ -125,13 +125,12 @@ public final class DriverJDBCExecutor {
try {
locked = tryGlobalLock(sqlStatement,
metaDataContexts.getProps().<Long>getValue(ConfigurationPropertyKey.LOCK_WAIT_TIMEOUT_MILLISECONDS));
results = jdbcExecutor.execute(executionGroups, callback);
- } catch (final SQLException ex) {
+ refreshSchema(metaDataContexts.getDefaultMetaData(), sqlStatement,
routeUnits);
+ } finally {
if (locked) {
releaseGlobalLock();
}
- throw ex;
}
- refreshSchema(metaDataContexts.getDefaultMetaData(), sqlStatement,
routeUnits);
return results;
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
index 432888c..69d1843 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
@@ -108,13 +108,12 @@ public final class DatabaseCommunicationEngine {
try {
locked = tryGlobalLock(executionContext,
ProxyContext.getInstance().getMetaDataContexts().getProps().<Long>getValue(ConfigurationPropertyKey.LOCK_WAIT_TIMEOUT_MILLISECONDS));
executeResults = proxySQLExecutor.execute(executionContext);
- } catch (final SQLException ex) {
+ refreshMetadata(executionContext);
+ } finally {
if (locked) {
releaseGlobalLock();
}
- throw ex;
}
- refreshMetadata(executionContext);
ExecuteResult executeResultSample = executeResults.iterator().next();
return executeResultSample instanceof QueryResult
? processExecuteQuery(executionContext,
executeResults.stream().map(each -> (QueryResult)
each).collect(Collectors.toList()), (QueryResult) executeResultSample)