You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2014/10/27 06:41:20 UTC

[1/3] git commit: PHOENIX-1366 Use static constants

Repository: phoenix
Updated Branches:
  refs/heads/master 53c1fd788 -> 79423f801


PHOENIX-1366 Use static constants


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

Branch: refs/heads/master
Commit: 3cbd85b0f1baaa953a3a29d69574fe543bfdc6a0
Parents: 53c1fd7
Author: James Taylor <jt...@salesforce.com>
Authored: Sun Oct 26 22:13:31 2014 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Sun Oct 26 22:39:24 2014 -0700

----------------------------------------------------------------------
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   | 32 +++++++++++---------
 1 file changed, 18 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cbd85b0/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
index ba77f6d..a03cda4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
@@ -29,7 +29,6 @@ import java.util.Collections;
 import java.util.List;
 
 import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -259,6 +258,9 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho
     public static final String PARENT_TENANT_ID = "PARENT_TENANT_ID";
     public static final byte[] PARENT_TENANT_ID_BYTES = Bytes.toBytes(PARENT_TENANT_ID);
         
+    private static final String TENANT_POS_SHIFT = "TENANT_POS_SHIFT";
+    private static final byte[] TENANT_POS_SHIFT_BYTES = Bytes.toBytes(TENANT_POS_SHIFT);
+    
     private final PhoenixConnection connection;
     private final ResultSet emptyResultSet;
 
@@ -405,7 +407,7 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho
                 SQL_DATA_TYPE + "," +
                 SQL_DATETIME_SUB + "," +
                 CHAR_OCTET_LENGTH + "," +
-                "CASE WHEN TENANT_POS_SHIFT THEN ORDINAL_POSITION-1 ELSE ORDINAL_POSITION END AS " + ORDINAL_POSITION + "," +
+                "CASE WHEN " + TENANT_POS_SHIFT + " THEN " + ORDINAL_POSITION + "-1 ELSE " + ORDINAL_POSITION + " END AS " + ORDINAL_POSITION + "," +
                 "CASE " + NULLABLE + " WHEN " + DatabaseMetaData.attributeNoNulls +  " THEN '" + Boolean.FALSE.toString() + "' WHEN " + DatabaseMetaData.attributeNullable + " THEN '" + Boolean.TRUE.toString() + "' END AS " + IS_NULLABLE + "," +
                 SCOPE_CATALOG + "," +
                 SCOPE_SCHEMA + "," +
@@ -417,8 +419,8 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho
                 DATA_TYPE + " " + TYPE_ID + "," +// raw type id for potential internal consumption
                 VIEW_CONSTANT + "," +
                 MULTI_TENANT + "," +
-                "CASE WHEN TENANT_POS_SHIFT THEN KEY_SEQ-1 ELSE KEY_SEQ END AS " + KEY_SEQ +
-                " from " + SYSTEM_CATALOG + " " + SYSTEM_CATALOG_ALIAS + "(TENANT_POS_SHIFT BOOLEAN)");
+                "CASE WHEN " + TENANT_POS_SHIFT + " THEN " + KEY_SEQ + "-1 ELSE " + KEY_SEQ + " END AS " + KEY_SEQ +
+                " from " + SYSTEM_CATALOG + " " + SYSTEM_CATALOG_ALIAS + "(" + TENANT_POS_SHIFT + " BOOLEAN)");
         StringBuilder where = new StringBuilder();
         addTenantIdFilter(where, catalog);
         if (schemaPattern != null) {
@@ -523,23 +525,25 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho
                 tuple = super.next();
             }
 
-            if (tuple != null && inMultiTenantTable && !tenantColumnSkipped
-                    && new Long(1L).equals(getColumn(tuple, keySeqIndex))) {
-                tenantColumnSkipped = true;
-                // skip tenant id primary key column
-                return next();
+            if (tuple != null && inMultiTenantTable && !tenantColumnSkipped) {
+                Object value = getColumn(tuple, keySeqIndex);
+                if (value != null && ((Number)value).longValue() == 1L) {
+                    tenantColumnSkipped = true;
+                    // skip tenant id primary key column
+                    return next();
+                }
             }
 
             if (tuple != null && tenantColumnSkipped) {
                 ResultTuple resultTuple = (ResultTuple)tuple;
-                List<Cell> cells = resultTuple.getResult().listCells();
-                KeyValue kv = new KeyValue(resultTuple.getResult().getRow(), QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES,
-                        Bytes.toBytes("TENANT_POS_SHIFT"), PDataType.TRUE_BYTES);
-                List<Cell> newCells = Lists.newArrayListWithCapacity(cells.size() + 1);
+                List<KeyValue> cells = resultTuple.getResult().list();
+                KeyValue kv = new KeyValue(resultTuple.getResult().getRow(), TABLE_FAMILY_BYTES,
+                        TENANT_POS_SHIFT_BYTES, PDataType.TRUE_BYTES);
+                List<KeyValue> newCells = Lists.newArrayListWithCapacity(cells.size() + 1);
                 newCells.addAll(cells);
                 newCells.add(kv);
                 Collections.sort(newCells, KeyValue.COMPARATOR);
-                resultTuple.setResult(Result.create(newCells));
+                resultTuple.setResult(new Result(newCells));
             }
 
             return tuple;


[3/3] git commit: PHOENIX-1379 Wrong MultiIndexWriteFailureException when recovering local index table (Shunsuke Nakamura)

Posted by ja...@apache.org.
PHOENIX-1379 Wrong MultiIndexWriteFailureException when recovering local index table (Shunsuke Nakamura)


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

Branch: refs/heads/master
Commit: 79423f8011ef35ae5c8509d67e0935fff549e80b
Parents: 1120629
Author: James Taylor <jt...@salesforce.com>
Authored: Sun Oct 26 22:26:41 2014 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Sun Oct 26 22:40:03 2014 -0700

----------------------------------------------------------------------
 .../index/write/recovery/TrackingParallelWriterIndexCommitter.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/79423f80/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java
index 9a61191..9171b53 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java
@@ -158,7 +158,7 @@ public class TrackingParallelWriterIndexCommitter implements IndexCommitter {
                                 if (indexRegion != null) {
                                     throwFailureIfDone();
                                     indexRegion.batchMutate(mutations.toArray(new Mutation[mutations.size()]));
-                                    return null;
+                                    return Boolean.TRUE;
                                 }
                             }
                         } catch (IOException ignord) {


[2/3] git commit: PHOENIX-1366 Use static constants

Posted by ja...@apache.org.
PHOENIX-1366 Use static constants


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

Branch: refs/heads/master
Commit: 11206294c405ea843f0b4b81bdf12a049ba34a19
Parents: 3cbd85b
Author: James Taylor <jt...@salesforce.com>
Authored: Sun Oct 26 22:25:32 2014 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Sun Oct 26 22:39:40 2014 -0700

----------------------------------------------------------------------
 .../java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/11206294/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
index a03cda4..8edc7ae 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
@@ -29,6 +29,7 @@ import java.util.Collections;
 import java.util.List;
 
 import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -536,14 +537,14 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho
 
             if (tuple != null && tenantColumnSkipped) {
                 ResultTuple resultTuple = (ResultTuple)tuple;
-                List<KeyValue> cells = resultTuple.getResult().list();
+                List<Cell> cells = resultTuple.getResult().listCells();
                 KeyValue kv = new KeyValue(resultTuple.getResult().getRow(), TABLE_FAMILY_BYTES,
                         TENANT_POS_SHIFT_BYTES, PDataType.TRUE_BYTES);
-                List<KeyValue> newCells = Lists.newArrayListWithCapacity(cells.size() + 1);
+                List<Cell> newCells = Lists.newArrayListWithCapacity(cells.size() + 1);
                 newCells.addAll(cells);
                 newCells.add(kv);
                 Collections.sort(newCells, KeyValue.COMPARATOR);
-                resultTuple.setResult(new Result(newCells));
+                resultTuple.setResult(Result.create(newCells));
             }
 
             return tuple;