[ 
https://issues.apache.org/jira/browse/PHOENIX-7025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17771213#comment-17771213
 ] 

ASF GitHub Bot commented on PHOENIX-7025:
-----------------------------------------

palashc commented on code in PR #1666:
URL: https://github.com/apache/phoenix/pull/1666#discussion_r1342954480


##########
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java:
##########
@@ -5181,6 +5192,24 @@ private void flushTable(byte[] tableName) throws 
SQLException {
         }
     }
 
+    @Override
+    public void refreshLiveRegionServers() throws SQLException {
+        synchronized (liveRegionServersLock) {
+            try (Admin admin = getAdmin()) {
+                this.liveRegionServers = new 
ArrayList<>(admin.getRegionServers(true));
+            }
+            catch (IOException e) {
+                throw ServerUtil.parseServerException(e);
+            }
+        }
+        LOGGER.info("Refreshed list of live region servers.");
+    }
+
+    @Override
+    public List<ServerName> getLiveRegionServers() {
+        return this.liveRegionServers;

Review Comment:
   @shahrs87 I think a client getting a stale copy of region server list should 
be okay. It will pick another region server randomly which will likely be 
different from the regionserver which had issues. Also the list variable is 
`volatile` so that all threads will get the latest updated value. This weaker 
and light-weight form of synchronization should suffice for our purpose, most 
of the shared state in CQSI is handled this way. Let me know if I am missing 
something. 





> Create a new RPC to validate last ddl timestamp for read requests.
> ------------------------------------------------------------------
>
>                 Key: PHOENIX-7025
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7025
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Rushabh Shah
>            Assignee: Palash Chauhan
>            Priority: Major
>
> Introduce a new RPC request from phoenix client to any region server via 
> PhoenixRegionServerEndpoint#validateLastDDLTimestamp. Since the last ddl 
> timestamp cache is maintained by all the regionservers, you can choose any 
> regionserver randomly. In future, we can make this rpc more resilient by 
> sending this rpc to multiple regionservers simultaneously.
> If phoenix client throws StaleMetadataCacheException then invalidate the 
> cache on the client side and retry executeQuery method while fetching the 
> updated metadata from SYSCAT regionserver.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to