@@ -189,25 +189,7 @@ public class LocationUtil {
189189 + " AND A.tenant_name = ? "
190190 + " AND A.database_name = ? "
191191 + " AND A.table_name = ?;" ;
192- private static final String PROXY_LOCATION_SQL_PARTITION_BY_TABLETID_WITHOUT_V4 = "SELECT /*+READ_CONSISTENCY(WEAK)*/ "
193- + " A.tablet_id as tablet_id, "
194- + " A.svr_ip as svr_ip, "
195- + " A.sql_port as sql_port, "
196- + " A.table_id as table_id, "
197- + " A.role as role, "
198- + " A.replica_num as replica_num, "
199- + " A.part_num as part_num, "
200- + " (SELECT B.svr_port FROM oceanbase.__all_server B WHERE A.svr_ip = B.svr_ip AND A.sql_port = B.inner_port) as svr_port, "
201- + " (SELECT B.status FROM oceanbase.__all_server B WHERE A.svr_ip = B.svr_ip AND A.sql_port = B.inner_port) as status, "
202- + " (SELECT B.stop_time FROM oceanbase.__all_server B WHERE A.svr_ip = B.svr_ip AND A.sql_port = B.inner_port) as stop_time, "
203- + " A.spare1 as replica_type "
204- + "FROM "
205- + " oceanbase.__all_virtual_proxy_schema A "
206- + "WHERE "
207- + " A.tablet_id = ? "
208- + " AND A.tenant_name = ? "
209- + " AND A.database_name = ? "
210- + " AND A.table_name = ?;" ;
192+
211193 private static final String PROXY_FIRST_PARTITION_SQL_V4 = "SELECT /*+READ_CONSISTENCY(WEAK)*/ part_id, part_name, tablet_id, high_bound_val, sub_part_num "
212194 + "FROM oceanbase.__all_virtual_proxy_partition "
213195 + "WHERE tenant_name = ? and table_id = ? LIMIT ?;" ;
@@ -517,8 +499,7 @@ public static TableEntry loadTableEntryLocationWithPriority(final ServerRoster s
517499 final long socketTimeout ,
518500 final long priorityTimeout ,
519501 final long cachingTimeout ,
520- final ObUserAuth sysUA ,
521- boolean withLsId )
502+ final ObUserAuth sysUA )
522503 throws ObTableEntryRefreshException {
523504
524505 return callTableEntryRefreshWithPriority (serverRoster , priorityTimeout , cachingTimeout ,
@@ -531,7 +512,7 @@ TableEntry execute(ObServerAddr obServerAddr) throws ObTableEntryRefreshExceptio
531512 TableEntry execute (Connection connection )
532513 throws ObTablePartitionLocationRefreshException {
533514 return getTableEntryLocationFromRemote (connection , key , tableEntry ,
534- tabletId , withLsId );
515+ tabletId );
535516 }
536517 });
537518 }
@@ -812,14 +793,10 @@ private static TableEntry getTableEntryFromRemote(Connection connection, TableEn
812793 }
813794
814795 // Note: This code is applicable only for refreshing locations based on tablet ID in version 4.x
815- private static String genLocationSQLByTabletId (boolean withLsId ) {
796+ private static String genLocationSQLByTabletId () {
816797 String sql = null ;
817798 if (ObGlobal .obVsnMajor () >= 4 ) {
818- if (withLsId ) {
819- sql = PROXY_LOCATION_SQL_PARTITION_BY_TABLETID_V4 ;
820- } else {
821- sql = PROXY_LOCATION_SQL_PARTITION_BY_TABLETID_WITHOUT_V4 ;
822- }
799+ sql = PROXY_LOCATION_SQL_PARTITION_BY_TABLETID_V4 ;
823800 } else {
824801 throw new FeatureNotSupportedException ("not support ob version less than 4" );
825802 }
@@ -886,13 +863,12 @@ private static String genLocationSQLByOffset(TableEntry tableEntry, int offset,
886863 public static TableEntry getTableEntryLocationFromRemote (Connection connection ,
887864 TableEntryKey key ,
888865 TableEntry tableEntry ,
889- Long tabletId ,
890- boolean withLsId )
866+ Long tabletId )
891867 throws ObTablePartitionLocationRefreshException {
892868 PreparedStatement ps = null ;
893869 ResultSet rs = null ;
894870 ObPartitionEntry partitionEntry = tableEntry .getPartitionEntry ();
895- String sql = genLocationSQLByTabletId (withLsId );
871+ String sql = genLocationSQLByTabletId ();
896872 ObPartitionLocationInfo partitionLocationInfo = partitionEntry .getPartitionInfo (tabletId );
897873 // return quickly if recently refreshed
898874 if (System .currentTimeMillis () - partitionLocationInfo .getLastUpdateTime ()
@@ -907,7 +883,7 @@ public static TableEntry getTableEntryLocationFromRemote(Connection connection,
907883 ps .setString (4 , key .getDatabaseName ());
908884 ps .setString (5 , key .getTableName ());
909885 rs = ps .executeQuery ();
910- getPartitionLocationFromResultSetByTablet (tableEntry , rs , partitionEntry , tabletId , withLsId );
886+ getPartitionLocationFromResultSetByTablet (tableEntry , rs , partitionEntry , tabletId );
911887 } catch (Exception e ) {
912888 RUNTIME .error (LCD .convert ("01-00010" ), key , tableEntry , e );
913889 throw new ObTablePartitionLocationRefreshException (format (
@@ -1241,8 +1217,7 @@ private static TableEntry getTableEntryFromResultSet(TableEntryKey key, ResultSe
12411217 private static ObPartitionEntry getPartitionLocationFromResultSetByTablet (TableEntry tableEntry ,
12421218 ResultSet rs ,
12431219 ObPartitionEntry partitionEntry ,
1244- long tabletId ,
1245- boolean withLsId )
1220+ long tabletId )
12461221 throws SQLException ,
12471222 ObTablePartitionLocationRefreshException {
12481223
@@ -1257,7 +1232,7 @@ private static ObPartitionEntry getPartitionLocationFromResultSetByTablet(TableE
12571232 ReplicaLocation replica = buildReplicaLocation (rs );
12581233 long partitionId = (ObGlobal .obVsnMajor () >= 4 ) ? rs .getLong ("tablet_id" ) : rs
12591234 .getLong ("partition_id" );
1260- long lsId = ObGlobal .obVsnMajor () >= 4 && withLsId ? rs .getLong ("ls_id" ) : INVALID_LS_ID ;
1235+ long lsId = ObGlobal .obVsnMajor () >= 4 ? rs .getLong ("ls_id" ) : INVALID_LS_ID ;
12611236 if (rs .wasNull () && ObGlobal .obVsnMajor () >= 4 ) {
12621237 lsId = INVALID_LS_ID ; // For non-partitioned table
12631238 }
0 commit comments