You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by xi...@apache.org on 2020/07/14 14:30:59 UTC
[shardingsphere] branch master updated: #6324,
proxy blocked due to unreached notify
This is an automated email from the ASF dual-hosted git repository.
xiaoyu 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 98284ea #6324, proxy blocked due to unreached notify
new 8ac9523 Merge pull request #6349 from tuohai666/issue-6324
98284ea is described below
commit 98284eade870fa9225b9d7cb6706113f94e282ab
Author: tuohai666 <zh...@apache.org>
AuthorDate: Tue Jul 14 21:32:24 2020 +0800
#6324, proxy blocked due to unreached notify
---
.../jdbc/connection/ResourceSynchronizer.java | 16 +---------------
.../mysql/command/MySQLCommandExecuteEngine.java | 4 +++-
.../command/PostgreSQLCommandExecuteEngine.java | 4 +++-
3 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/ResourceSynchronizer.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/ResourceSynchronizer.java
index 2778c64..238197f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/ResourceSynchronizer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/ResourceSynchronizer.java
@@ -34,25 +34,11 @@ public final class ResourceSynchronizer {
private final Condition condition = lock.newCondition();
/**
- * Do await.
- *
- */
- public void doAwait() {
- lock.lock();
- try {
- condition.await();
- } catch (final InterruptedException ignore) {
- } finally {
- lock.unlock();
- }
- }
-
- /**
* Do await until default timeout milliseconds.
*
* @throws InterruptedException interrupted exception
*/
- void doAwaitUntil() throws InterruptedException {
+ public void doAwaitUntil() throws InterruptedException {
lock.lock();
try {
condition.await(DEFAULT_TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecuteEngine.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecuteEngine.java
index f3a7f90..806483f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecuteEngine.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecuteEngine.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.proxy.frontend.mysql.command;
import io.netty.channel.ChannelHandlerContext;
+import lombok.SneakyThrows;
import org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacket;
import org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketFactory;
import org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
@@ -70,6 +71,7 @@ public final class MySQLCommandExecuteEngine implements CommandExecuteEngine {
}
@Override
+ @SneakyThrows
public void writeQueryData(final ChannelHandlerContext context,
final BackendConnection backendConnection, final QueryCommandExecutor queryCommandExecutor, final int headerPackagesCount) throws SQLException {
if (!queryCommandExecutor.isQuery() || !context.channel().isActive()) {
@@ -82,7 +84,7 @@ public final class MySQLCommandExecuteEngine implements CommandExecuteEngine {
count++;
while (!context.channel().isWritable() && context.channel().isActive()) {
context.flush();
- backendConnection.getResourceSynchronizer().doAwait();
+ backendConnection.getResourceSynchronizer().doAwaitUntil();
}
DatabasePacket dataValue = queryCommandExecutor.getQueryData();
context.write(dataValue);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngine.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngine.java
index dc16733..f9888f9 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngine.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngine.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.proxy.frontend.postgresql.command;
import io.netty.channel.ChannelHandlerContext;
+import lombok.SneakyThrows;
import org.apache.shardingsphere.db.protocol.packet.CommandPacket;
import org.apache.shardingsphere.db.protocol.packet.CommandPacketType;
import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
@@ -73,6 +74,7 @@ public final class PostgreSQLCommandExecuteEngine implements CommandExecuteEngin
}
@Override
+ @SneakyThrows
public void writeQueryData(final ChannelHandlerContext context,
final BackendConnection backendConnection, final QueryCommandExecutor queryCommandExecutor, final int headerPackagesCount) throws SQLException {
if (queryCommandExecutor.isQuery() && !context.channel().isActive()) {
@@ -90,7 +92,7 @@ public final class PostgreSQLCommandExecuteEngine implements CommandExecuteEngin
count++;
while (!context.channel().isWritable() && context.channel().isActive()) {
context.flush();
- backendConnection.getResourceSynchronizer().doAwait();
+ backendConnection.getResourceSynchronizer().doAwaitUntil();
}
DatabasePacket resultValue = queryCommandExecutor.getQueryData();
context.write(resultValue);