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

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

shahrs87 commented on code in PR #1845:
URL: https://github.com/apache/phoenix/pull/1845#discussion_r1515288037


##########
phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerMetadataCacheTestImpl.java:
##########
@@ -0,0 +1,66 @@
+package org.apache.phoenix.end2end;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ServerName;
+import org.apache.phoenix.cache.ServerMetadataCacheImpl;
+import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
+import org.apache.phoenix.util.QueryUtil;
+import org.apache.phoenix.util.SchemaUtil;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Implementation of {@link ServerMetadataCache} for Integration Tests.
+ * Supports keeping more than one instance keyed on the regionserver 
ServerName.
+ */
+public class ServerMetadataCacheTestImpl extends ServerMetadataCacheImpl {

Review Comment:
   Can you add some more context in the comment something like:
   
   PhoenixRegionServerEndpoint is a region server coproc. There is a 1-1 
correspondence between PhoenixRegionServerEndpoint and ServerMetadataCache.
   In ITs we can have multiple regionservers per cluster so we need multiple 
instances of ServerMetadataCache.
   And HighAvailabilityTestingUtility creates 2 clusters so we need to have one 
instance of ServerMetadataCache for each regionserver in each cluster.





> Refactor server-side code to support multiple ServerMetadataCache for HA tests
> ------------------------------------------------------------------------------
>
>                 Key: PHOENIX-7251
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7251
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Palash Chauhan
>            Assignee: Palash Chauhan
>            Priority: Major
>
> In the metadata caching re-design, `ServerMetadataCache` is required to be a 
> singleton in the implementation. This affects tests for the HA use case 
> because the coprocessors on the 2 clusters end up using the same 
> `ServerMetadataCache`. All tests which execute queries with 1 of the clusters 
> unavailable will fail. 
> We can refactor the implementation in the following way to support HA test 
> cases:
> 1. Create a `ServerMetadataCache` interface and use the current 
> implementation as `ServerMetadataCacheImpl` for all other tests. This would 
> be a singleton.
> 2. Implement `ServerMetadataCacheHAImpl` with a map of instances keyed on 
> config.
> 3. Extend `PhoenixRegionServerEndpoint` and use `ServerMetadataCacheHAImpl`. 
> 4. In HA tests, load this new endpoint on the region servers. 



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

Reply via email to