Repository: phoenix
Updated Branches:
  refs/heads/txn 8119bee57 -> 52c1d4550


Add TRANSACTIONAL table to SYSTEM.CATALOG table conditionally for b/w compat


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/52c1d455
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/52c1d455
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/52c1d455

Branch: refs/heads/txn
Commit: 52c1d4550c87e75bbc9cd5661252694b7db329a0
Parents: 8119bee
Author: James Taylor <[email protected]>
Authored: Wed Mar 11 16:34:28 2015 -0700
Committer: James Taylor <[email protected]>
Committed: Wed Mar 11 16:34:28 2015 -0700

----------------------------------------------------------------------
 .../phoenix/coprocessor/MetaDataProtocol.java   |  1 +
 .../query/ConnectionQueryServicesImpl.java      | 45 +++++++++++---------
 2 files changed, 25 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/52c1d455/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index cf0aabb..de7be27 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -71,6 +71,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
     public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_2_0 = 
MIN_TABLE_TIMESTAMP + 4;
     public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_2_1 = 
MIN_TABLE_TIMESTAMP + 5;
     public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_3_0 = 
MIN_TABLE_TIMESTAMP + 7;
+    public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_4_0 = 
MIN_TABLE_TIMESTAMP + 8;
     
     // TODO: pare this down to minimum, as we don't need duplicates for both 
table and column errors, nor should we need
     // a different code for every type of error.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/52c1d455/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index f005c3d..8a1671b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -1881,29 +1881,32 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
                                 long currentServerSideTableTimeStamp = 
e.getTable().getTimeStamp();
 
                                 String columnsToAdd = "";
-                                if(currentServerSideTableTimeStamp < 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_3_0) {
-                                    // We know that we always need to add the 
STORE_NULLS column for 4.3 release
-                                    columnsToAdd = 
PhoenixDatabaseMetaData.STORE_NULLS + " " + PBoolean.INSTANCE.getSqlTypeName();
-                                    HBaseAdmin admin = null;
-                                    try {
-                                        admin = getAdmin();
-                                        HTableDescriptor[] localIndexTables = 
admin.listTables(MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX+".*");
-                                        for (HTableDescriptor table : 
localIndexTables) {
-                                            if 
(table.getValue(MetaDataUtil.PARENT_TABLE_KEY) == null
-                                                    && 
table.getValue(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_NAME) != null) {
-                                                
table.setValue(MetaDataUtil.PARENT_TABLE_KEY,
-                                                    
MetaDataUtil.getUserTableName(table
-                                                        .getNameAsString()));
-                                                // Explicitly disable, modify 
and enable the table to ensure co-location of data
-                                                // and index regions. If we 
just modify the table descriptor when online schema
-                                                // change enabled may reopen 
the region in same region server instead of following data region.
-                                                
admin.disableTable(table.getTableName());
-                                                
admin.modifyTable(table.getTableName(), table);
-                                                
admin.enableTable(table.getTableName());
+                                if(currentServerSideTableTimeStamp < 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_4_0) {
+                                    columnsToAdd = 
PhoenixDatabaseMetaData.TRANSACTIONAL + " " + 
PBoolean.INSTANCE.getSqlTypeName();
+                                    if(currentServerSideTableTimeStamp < 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_3_0) {
+                                        // We know that we always need to add 
the STORE_NULLS column for 4.3 release
+                                        columnsToAdd += "," + 
PhoenixDatabaseMetaData.STORE_NULLS + " " + PBoolean.INSTANCE.getSqlTypeName();
+                                        HBaseAdmin admin = null;
+                                        try {
+                                            admin = getAdmin();
+                                            HTableDescriptor[] 
localIndexTables = admin.listTables(MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX+".*");
+                                            for (HTableDescriptor table : 
localIndexTables) {
+                                                if 
(table.getValue(MetaDataUtil.PARENT_TABLE_KEY) == null
+                                                        && 
table.getValue(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_NAME) != null) {
+                                                    
table.setValue(MetaDataUtil.PARENT_TABLE_KEY,
+                                                        
MetaDataUtil.getUserTableName(table
+                                                            
.getNameAsString()));
+                                                    // Explicitly disable, 
modify and enable the table to ensure co-location of data
+                                                    // and index regions. If 
we just modify the table descriptor when online schema
+                                                    // change enabled may 
reopen the region in same region server instead of following data region.
+                                                    
admin.disableTable(table.getTableName());
+                                                    
admin.modifyTable(table.getTableName(), table);
+                                                    
admin.enableTable(table.getTableName());
+                                                }
                                             }
+                                        } finally {
+                                            if (admin != null) admin.close();
                                         }
-                                    } finally {
-                                        if (admin != null) admin.close();
                                     }
                                 }
 

Reply via email to