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

Ankit Singhal commented on PHOENIX-2862:
----------------------------------------

Yes [~jamestaylor], Actually I did the change at server side to restrict 4.7 
client to connect if we see IS_SYSTEM_TABLE_MAPPED_TO_NAMESPACE is true at 
server but under clientServerCompatibilityCheck.

{code}
@Override
-    public void getVersion(RpcController controller, GetVersionRequest request,
-            RpcCallback<GetVersionResponse> done) {
+    public void getVersion(RpcController controller, GetVersionRequest 
request, RpcCallback<GetVersionResponse> done) {
 
         GetVersionResponse.Builder builder = GetVersionResponse.newBuilder();
-        // The first 3 bytes of the long is used to encoding the HBase version 
as major.minor.patch.
-        // The next 4 bytes of the value is used to encode the Phoenix version 
as major.minor.patch.
-        long version = 
MetaDataUtil.encodeHBaseAndPhoenixVersions(this.env.getHBaseVersion());
-
-        // The last byte is used to communicate whether or not mutable 
secondary indexing
-        // was configured properly.
-        version =
-                MetaDataUtil.encodeHasIndexWALCodec(version,
-                    
IndexManagementUtil.isWALEditCodecSet(this.env.getConfiguration()));
+        Configuration config = env.getConfiguration();
+        boolean isSystemTablesMapped = 
SchemaUtil.isNamespaceMappingEnabled(PTableType.SYSTEM,
+                new ReadOnlyProps(config.iterator()));
+        if (isSystemTablesMapped
+                && 
PhoenixDatabaseMetaData.MIN_NAMESPACE_MAPPED_PHOENIX_VERSION > 
request.getClientVersion()) {
+            logger.error("Old client is not compatible when" + " system tables 
are upgraded to map to namespace");
+            ProtobufUtil.setControllerException(controller,
+                    ServerUtil.createIOException(
+                            
SchemaUtil.getPhysicalHBaseTableName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME,
+                                    isSystemTablesMapped, 
PTableType.SYSTEM).getString(),
+                    new DoNotRetryIOException(
+                            "Old client is not compatible when" + " system 
tables are upgraded to map to namespace")));
+        }
+        long version = MetaDataUtil.encodeVersion(env.getHBaseVersion(), 
config);
{code}

If you think , I can use your way to throw UNALLOWED_TABLE_MUTATION.

And, the client side changes are for 4.8 client only to confirm that property 
for systemNamespaceMapping is consistent on client and server at the time of 
upgrading or connecting.



> Do client server compatibility checks before upgrading system tables
> --------------------------------------------------------------------
>
>                 Key: PHOENIX-2862
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2862
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Ankit Singhal
>            Assignee: Ankit Singhal
>             Fix For: 4.8.0
>
>         Attachments: PHOENIX-2862.patch
>
>
> currently , we allow upgrade of system tables to map to system namespace by 
> enabling "phoenix.schema.mapSystemTablesToNamespace" config (conjuction with 
> "phoenix.connection.isNamespaceMappingEnabled") 
> but we need to ensure following things whenever client connects with above 
> config:-
> 1. Server should be upgraded and check consistency of these properties 
> between client and server.
> 2. If above property does not exists but system:catalog exists, we should not 
> start creating system.catalog.
> 3. if old client connects, it should not create system.catalog again ignoring 
> the upgrade and start using it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to