You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2023/04/11 01:53:53 UTC

[shardingsphere] branch master updated: Unify Proxy backend thread model (#25084)

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 f7eb8828324 Unify Proxy backend thread model (#25084)
f7eb8828324 is described below

commit f7eb88283242ffa60fcf6f7c6e74aa4c269b0d67
Author: 吴伟杰 <wu...@apache.org>
AuthorDate: Tue Apr 11 09:53:35 2023 +0800

    Unify Proxy backend thread model (#25084)
---
 .../executor/ConnectionThreadExecutorGroup.java    |  2 +-
 .../proxy/frontend/state/impl/OKProxyState.java    |  8 +---
 .../frontend/command/CommandExecutorTaskTest.java  |  5 ---
 .../DatabaseProtocolFrontendEngineFixture.java     |  6 ---
 .../frontend/state/impl/OKProxyStateTest.java      | 17 -------
 .../proxy/frontend/context/FrontendContext.java    | 32 -------------
 .../spi/DatabaseProtocolFrontendEngine.java        |  8 ----
 .../proxy/frontend/mysql/MySQLFrontendContext.java | 42 -----------------
 .../proxy/frontend/mysql/MySQLFrontendEngine.java  |  3 --
 .../frontend/mysql/MySQLFrontendContextTest.java   | 52 ----------------------
 .../opengauss/OpenGaussFrontendEngine.java         |  6 ---
 .../opengauss/OpenGaussFrontendEngineTest.java     |  6 ---
 .../postgresql/PostgreSQLFrontendContext.java      | 31 -------------
 .../postgresql/PostgreSQLFrontendEngine.java       |  3 --
 .../postgresql/PostgreSQLFrontendContextTest.java  | 30 -------------
 15 files changed, 2 insertions(+), 249 deletions(-)

diff --git a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/executor/ConnectionThreadExecutorGroup.java b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/executor/ConnectionThreadExecutorGroup.java
index d89d7bdd7c5..50f91bdba81 100644
--- a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/executor/ConnectionThreadExecutorGroup.java
+++ b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/executor/ConnectionThreadExecutorGroup.java
@@ -61,7 +61,7 @@ public final class ConnectionThreadExecutorGroup {
     }
     
     private ExecutorService newSingleThreadExecutorService(final int connectionId) {
-        return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), runnable -> new Thread(runnable, String.format("Connection-%d-ThreadExecutor", connectionId)));
+        return new ThreadPoolExecutor(0, 1, 1L, TimeUnit.HOURS, new LinkedBlockingQueue<>(), runnable -> new Thread(runnable, String.format("Connection-%d-ThreadExecutor", connectionId)));
     }
     
     /**
diff --git a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyState.java b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyState.java
index 91003559872..c0fd1853c78 100644
--- a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyState.java
+++ b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyState.java
@@ -49,13 +49,7 @@ public final class OKProxyState implements ProxyState {
         if (requireOccupyThreadForConnection(connectionSession)) {
             return ConnectionThreadExecutorGroup.getInstance().get(connectionSession.getConnectionId());
         }
-        if (isPreferNettyEventLoop()) {
-            return context.executor();
-        }
-        if (databaseProtocolFrontendEngine.getFrontendContext().isRequiredSameThreadForConnection(message)) {
-            return ConnectionThreadExecutorGroup.getInstance().get(connectionSession.getConnectionId());
-        }
-        return UserExecutorGroup.getInstance().getExecutorService();
+        return isPreferNettyEventLoop() ? context.executor() : UserExecutorGroup.getInstance().getExecutorService();
     }
     
     private boolean requireOccupyThreadForConnection(final ConnectionSession connectionSession) {
diff --git a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTaskTest.java b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTaskTest.java
index e257e6f313b..e0e0f18751c 100644
--- a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTaskTest.java
+++ b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTaskTest.java
@@ -35,7 +35,6 @@ import org.apache.shardingsphere.proxy.backend.exception.BackendConnectionExcept
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
 import org.apache.shardingsphere.proxy.frontend.command.executor.CommandExecutor;
 import org.apache.shardingsphere.proxy.frontend.command.executor.QueryCommandExecutor;
-import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
 import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
 import org.apache.shardingsphere.test.mock.AutoMockExtension;
 import org.apache.shardingsphere.test.mock.StaticMockSettings;
@@ -95,9 +94,6 @@ class CommandExecutorTaskTest {
     @Mock
     private DatabasePacket databasePacket;
     
-    @Mock
-    private FrontendContext frontendContext;
-    
     @BeforeEach
     void setup() {
         when(connectionSession.getBackendConnection()).thenReturn(backendConnection);
@@ -139,7 +135,6 @@ class CommandExecutorTaskTest {
     @SuppressWarnings("unchecked")
     @Test
     void assertRunByCommandExecutor() throws SQLException, BackendConnectionException {
-        when(engine.getFrontendContext()).thenReturn(frontendContext);
         when(commandExecutor.execute()).thenReturn(Collections.singleton(databasePacket));
         when(engine.getCommandExecuteEngine().getCommandPacket(payload, commandPacketType, connectionSession)).thenReturn(commandPacket);
         when(engine.getCommandExecuteEngine().getCommandExecutor(commandPacketType, commandPacket, connectionSession)).thenReturn(commandExecutor);
diff --git a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
index e6e6099cfcb..49ce7be91e7 100644
--- a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
+++ b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
@@ -21,17 +21,11 @@ import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
 import org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
 import org.apache.shardingsphere.proxy.frontend.command.CommandExecuteEngine;
-import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
 import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
 import org.apache.shardingsphere.test.fixture.infra.database.type.MockedDatabaseType;
 
 public final class DatabaseProtocolFrontendEngineFixture implements DatabaseProtocolFrontendEngine {
     
-    @Override
-    public FrontendContext getFrontendContext() {
-        return null;
-    }
-    
     @Override
     public DatabasePacketCodecEngine<?> getCodecEngine() {
         return null;
diff --git a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyStateTest.java b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyStateTest.java
index bdfa02fc25b..f8339f3399e 100644
--- a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyStateTest.java
+++ b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyStateTest.java
@@ -104,23 +104,6 @@ class OKProxyStateTest {
         verify(eventExecutor).execute(any(CommandExecutorTask.class));
     }
     
-    @Test
-    void assertExecuteWithProxyBackendExecutorSuitableForOLAPAndRequiredSameThreadForConnection() {
-        ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
-        when(contextManager.getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.PROXY_HINT_ENABLED)).thenReturn(false);
-        when(contextManager.getMetaDataContexts().getMetaData().getProps().<BackendExecutorType>getValue(
-                ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE)).thenReturn(BackendExecutorType.OLAP);
-        when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
-        ConnectionSession connectionSession = mock(ConnectionSession.class, RETURNS_DEEP_STUBS);
-        when(connectionSession.getConnectionId()).thenReturn(1);
-        DatabaseProtocolFrontendEngine frontendEngine = mock(DatabaseProtocolFrontendEngine.class, RETURNS_DEEP_STUBS);
-        when(frontendEngine.getFrontendContext().isRequiredSameThreadForConnection(null)).thenReturn(true);
-        ExecutorService executorService = registerMockExecutorService(1);
-        new OKProxyState().execute(context, null, frontendEngine, connectionSession);
-        verify(executorService).execute(any(CommandExecutorTask.class));
-        ConnectionThreadExecutorGroup.getInstance().unregisterAndAwaitTermination(1);
-    }
-    
     @SuppressWarnings({"unchecked", "SameParameterValue"})
     @SneakyThrows(ReflectiveOperationException.class)
     private ExecutorService registerMockExecutorService(final int connectionId) {
diff --git a/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/context/FrontendContext.java b/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/context/FrontendContext.java
deleted file mode 100644
index c79544e4bb6..00000000000
--- a/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/context/FrontendContext.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.proxy.frontend.context;
-
-/**
- * Frontend context.
- */
-public interface FrontendContext {
-    
-    /**
-     * Whether Proxy should use same thread to execute tasks.
-     *
-     * @param message message
-     * @return is same thread required
-     */
-    boolean isRequiredSameThreadForConnection(Object message);
-}
diff --git a/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/spi/DatabaseProtocolFrontendEngine.java b/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/spi/DatabaseProtocolFrontendEngine.java
index 2c79559bd0c..f1d001604bc 100644
--- a/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/spi/DatabaseProtocolFrontendEngine.java
+++ b/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/spi/DatabaseProtocolFrontendEngine.java
@@ -22,7 +22,6 @@ import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
 import org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
 import org.apache.shardingsphere.proxy.frontend.command.CommandExecuteEngine;
-import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
 import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPI;
 
 /**
@@ -47,13 +46,6 @@ public interface DatabaseProtocolFrontendEngine extends TypedSPI {
     default void setDatabaseVersion(String databaseName, String databaseVersion) {
     }
     
-    /**
-     * Get frontend context.
-     *
-     * @return frontend context
-     */
-    FrontendContext getFrontendContext();
-    
     /**
      * Get database packet codec engine.
      * 
diff --git a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendContext.java b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendContext.java
deleted file mode 100644
index 697ad39610d..00000000000
--- a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendContext.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.proxy.frontend.mysql;
-
-import io.netty.buffer.ByteBuf;
-import org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
-import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
-
-/**
- * {@link FrontendContext} implementations for MySQL.
- */
-public final class MySQLFrontendContext implements FrontendContext {
-    
-    private boolean previousCommandRequiresNoServerResponse;
-    
-    @Override
-    public boolean isRequiredSameThreadForConnection(final Object message) {
-        ByteBuf byteBuf = (ByteBuf) message;
-        if (byteBuf.readableBytes() < 2) {
-            return false;
-        }
-        int commandType = byteBuf.getUnsignedByte(byteBuf.readerIndex() + 1);
-        boolean result = previousCommandRequiresNoServerResponse;
-        previousCommandRequiresNoServerResponse = MySQLCommandPacketType.COM_STMT_CLOSE.getValue() == commandType || MySQLCommandPacketType.COM_STMT_SEND_LONG_DATA.getValue() == commandType;
-        return previousCommandRequiresNoServerResponse || result;
-    }
-}
diff --git a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java
index 4debe8e9ee7..15c5eb2eab0 100644
--- a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java
+++ b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java
@@ -29,7 +29,6 @@ import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
 import org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
 import org.apache.shardingsphere.proxy.frontend.command.CommandExecuteEngine;
-import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
 import org.apache.shardingsphere.proxy.frontend.mysql.authentication.MySQLAuthenticationEngine;
 import org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecuteEngine;
 import org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.MySQLStatementIDGenerator;
@@ -45,8 +44,6 @@ import java.util.concurrent.atomic.AtomicInteger;
 @Getter
 public final class MySQLFrontendEngine implements DatabaseProtocolFrontendEngine {
     
-    private final FrontendContext frontendContext = new MySQLFrontendContext();
-    
     private final AuthenticationEngine authenticationEngine = new MySQLAuthenticationEngine();
     
     private final CommandExecuteEngine commandExecuteEngine = new MySQLCommandExecuteEngine();
diff --git a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendContextTest.java b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendContextTest.java
deleted file mode 100644
index f1f0a5f6385..00000000000
--- a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendContextTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.proxy.frontend.mysql;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import org.apache.shardingsphere.db.protocol.mysql.packet.command.MySQLCommandPacketType;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-class MySQLFrontendContextTest {
-    
-    @Test
-    void assertIsRequiredSameThreadForConnection() {
-        MySQLFrontendContext actual = new MySQLFrontendContext();
-        ByteBuf comStmtExecuteMessage = Unpooled.wrappedBuffer(new byte[]{0x00, (byte) MySQLCommandPacketType.COM_STMT_EXECUTE.getValue()});
-        ByteBuf comStmtSendLongData = Unpooled.wrappedBuffer(new byte[]{0x00, (byte) MySQLCommandPacketType.COM_STMT_SEND_LONG_DATA.getValue()});
-        assertFalse(actual.isRequiredSameThreadForConnection(comStmtExecuteMessage));
-        assertTrue(actual.isRequiredSameThreadForConnection(comStmtSendLongData));
-        assertTrue(actual.isRequiredSameThreadForConnection(comStmtSendLongData));
-        assertTrue(actual.isRequiredSameThreadForConnection(comStmtExecuteMessage));
-        assertFalse(actual.isRequiredSameThreadForConnection(comStmtExecuteMessage));
-        ByteBuf comStmtCloseMessage = Unpooled.wrappedBuffer(new byte[]{0x00, (byte) MySQLCommandPacketType.COM_STMT_CLOSE.getValue()});
-        assertTrue(actual.isRequiredSameThreadForConnection(comStmtCloseMessage));
-        assertTrue(actual.isRequiredSameThreadForConnection(comStmtCloseMessage));
-        assertTrue(actual.isRequiredSameThreadForConnection(comStmtExecuteMessage));
-        assertFalse(actual.isRequiredSameThreadForConnection(comStmtExecuteMessage));
-    }
-    
-    @Test
-    void assertNoEnoughReadableBytes() {
-        MySQLFrontendContext actual = new MySQLFrontendContext();
-        assertFalse(actual.isRequiredSameThreadForConnection(Unpooled.wrappedBuffer(new byte[1])));
-    }
-}
diff --git a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java
index 54124420592..9e760686df9 100644
--- a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java
+++ b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.db.protocol.opengauss.codec.OpenGaussPacketCode
 import org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLServerInfo;
 import org.apache.shardingsphere.dialect.exception.transaction.InTransactionException;
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
 import org.apache.shardingsphere.proxy.frontend.opengauss.authentication.OpenGaussAuthenticationEngine;
 import org.apache.shardingsphere.proxy.frontend.opengauss.command.OpenGaussCommandExecuteEngine;
 import org.apache.shardingsphere.proxy.frontend.postgresql.PostgreSQLFrontendEngine;
@@ -44,11 +43,6 @@ public final class OpenGaussFrontendEngine implements DatabaseProtocolFrontendEn
     
     private final OpenGaussPacketCodecEngine codecEngine = new OpenGaussPacketCodecEngine();
     
-    @Override
-    public FrontendContext getFrontendContext() {
-        return postgreSQLFrontendEngine.getFrontendContext();
-    }
-    
     @Override
     public void setDatabaseVersion(final String databaseName, final String databaseVersion) {
         PostgreSQLServerInfo.setServerVersion(databaseVersion);
diff --git a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngineTest.java b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngineTest.java
index 605a4cb9819..51ebaff8c06 100644
--- a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngineTest.java
+++ b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngineTest.java
@@ -52,12 +52,6 @@ class OpenGaussFrontendEngineTest {
         assertThat(openGaussFrontendEngine.getCommandExecuteEngine(), instanceOf(OpenGaussCommandExecuteEngine.class));
     }
     
-    @Test
-    void assertGetFrontendContext() {
-        openGaussFrontendEngine.getFrontendContext();
-        verify(mockPostgreSQLFrontendEngine).getFrontendContext();
-    }
-    
     @Test
     void assertGetCodecEngine() {
         assertThat(openGaussFrontendEngine.getCodecEngine(), instanceOf(OpenGaussPacketCodecEngine.class));
diff --git a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendContext.java b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendContext.java
deleted file mode 100644
index d79b8ce9a7b..00000000000
--- a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendContext.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.proxy.frontend.postgresql;
-
-import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
-
-/**
- * {@link FrontendContext} implementations for PostgreSQL.
- */
-public final class PostgreSQLFrontendContext implements FrontendContext {
-    
-    @Override
-    public boolean isRequiredSameThreadForConnection(final Object message) {
-        return true;
-    }
-}
diff --git a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
index 82819c99843..906f7123fbd 100644
--- a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
+++ b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
@@ -26,7 +26,6 @@ import org.apache.shardingsphere.dialect.exception.transaction.InTransactionExce
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
 import org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
 import org.apache.shardingsphere.proxy.frontend.command.CommandExecuteEngine;
-import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
 import org.apache.shardingsphere.proxy.frontend.postgresql.authentication.PostgreSQLAuthenticationEngine;
 import org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine;
 import org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLPortalContextRegistry;
@@ -38,8 +37,6 @@ import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngi
 @Getter
 public final class PostgreSQLFrontendEngine implements DatabaseProtocolFrontendEngine {
     
-    private final FrontendContext frontendContext = new PostgreSQLFrontendContext();
-    
     private final AuthenticationEngine authenticationEngine = new PostgreSQLAuthenticationEngine();
     
     private final CommandExecuteEngine commandExecuteEngine = new PostgreSQLCommandExecuteEngine();
diff --git a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendContextTest.java b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendContextTest.java
deleted file mode 100644
index 29f8be3bfe9..00000000000
--- a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendContextTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.proxy.frontend.postgresql;
-
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-class PostgreSQLFrontendContextTest {
-    
-    @Test
-    void assertIsRequiredSameThreadForConnection() {
-        assertTrue(new PostgreSQLFrontendContext().isRequiredSameThreadForConnection(null));
-    }
-}