phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [phoenix] priyankporwal commented on a change in pull request #469: PHOENIX-5156 Consistent Global Indexes for Non-Transactional Tables
Date Wed, 08 May 2019 16:53:15 GMT
priyankporwal commented on a change in pull request #469: PHOENIX-5156 Consistent Global Indexes
for Non-Transactional Tables
URL: https://github.com/apache/phoenix/pull/469#discussion_r282155767
 
 

 ##########
 File path: phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
 ##########
 @@ -849,4 +857,59 @@ public static long getIndexPendingDisableCount(PhoenixConnection conn,
String fa
             throw new IOException(e);
         }
     }
+
+    private static boolean containsOneOrMoreColumn(Scan scan) {
+        Map<byte[], NavigableSet<byte[]>> familyMap = scan.getFamilyMap();
+        if (familyMap == null || familyMap.isEmpty()) {
+            return false;
+        }
+        for (Map.Entry<byte[], NavigableSet<byte[]>> entry : familyMap.entrySet())
{
+            NavigableSet<byte[]> family = entry.getValue();
+            if (family != null && !family.isEmpty()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static void updateScan(Scan scan, byte[] emptyCF, byte[] emptyCQ) {
+        if (containsOneOrMoreColumn(scan)) {
+            scan.addColumn(emptyCF, emptyCQ);
+            return;
+        }
+        return;
+    }
+
+    public static void setScanAttributes(Scan scan, PTable table, PhoenixConnection phoenixConnection)
throws SQLException {
+        if (table.isTransactional() || table.isImmutableRows() || table.getType() != PTableType.INDEX)
{
+            return;
+        }
+        PTable indexTable = table;
+        if (indexTable.getIndexType() != PTable.IndexType.GLOBAL) {
+            return;
+        }
+        String schemaName = indexTable.getParentSchemaName().getString();
+        String tableName = indexTable.getParentTableName().getString();
+        PTable dataTable = PhoenixRuntime.getTable(phoenixConnection, SchemaUtil.getTableName(schemaName,
tableName));
 
 Review comment:
   The cache would be on the client side to avoid hitting syscat on each read. I don't think
we should not use the cache. Do we really need to get dataTable? I see it's usage for checking
index really being on it (lines 919-921) and for PHYSICAL_DATA_TABLE_NAME. Can we simply not
do the check on lines 919-921 and use tableName (from line 917)? Alternative solution - wouldn't
the GlobalIndexChecker already have the index-table properties and know the data-table info?
That way we can avoid the clients sending this needless info to server side; and be more fool-proof
as well. [Imagine a rogue client sending a bad physical data-table name to corrupt the index]

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message