[
https://issues.apache.org/jira/browse/PHOENIX-3817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16622682#comment-16622682
]
ASF GitHub Bot commented on PHOENIX-3817:
-----------------------------------------
Github user karanmehta93 commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/309#discussion_r219310231
--- Diff: phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
---
@@ -1894,10 +1877,36 @@ protected static void
splitSystemCatalog(Map<String, List<String>> tenantToTable
}
}
}
+
+ }
+
+ /**
+ * Splits SYSTEM.CATALOG into multiple regions based on the table or
view names passed in.
+ * Metadata for each table or view is moved to a separate region,
+ * @param tenantToTableAndViewMap map from tenant to tables and views
owned by the tenant
+ */
+ protected static void splitSystemCatalog(Map<String, List<String>>
tenantToTableAndViewMap) throws Exception {
+ List<byte[]> splitPoints = Lists.newArrayListWithExpectedSize(5);
+ // add the rows keys of the table or view metadata rows
+ Set<String> schemaNameSet=Sets.newHashSetWithExpectedSize(15);
+ for (Entry<String, List<String>> entrySet :
tenantToTableAndViewMap.entrySet()) {
+ String tenantId = entrySet.getKey();
+ for (String fullName : entrySet.getValue()) {
+ String schemaName =
SchemaUtil.getSchemaNameFromFullName(fullName);
+ // we don't allow SYSTEM.CATALOG to split within a schema,
so to ensure each table
+ // or view is on a separate region they need to have a
unique tenant and schema name
+ assertTrue("Schema names of tables/view must be unique ",
schemaNameSet.add(tenantId+"."+schemaName));
+ String tableName =
SchemaUtil.getTableNameFromFullName(fullName);
+ splitPoints.add(
+ SchemaUtil.getTableKey(tenantId, "".equals(schemaName)
? null : schemaName, tableName));
+ }
+ }
+ Collections.sort(splitPoints, Bytes.BYTES_COMPARATOR);
+
splitTable(PhoenixDatabaseMetaData.SYSTEM_CATALOG_HBASE_TABLE_NAME,
splitPoints);
--- End diff --
Does calling `split()` method explicitly check whether the table is allowed
to split on that key or not by consulting the `MetaDataSplitPolicy `
> VerifyReplication using SQL
> ---------------------------
>
> Key: PHOENIX-3817
> URL: https://issues.apache.org/jira/browse/PHOENIX-3817
> Project: Phoenix
> Issue Type: Improvement
> Reporter: Alex Araujo
> Assignee: Akshita Malhotra
> Priority: Minor
> Fix For: 4.15.0
>
> Attachments: PHOENIX-3817-final.patch, PHOENIX-3817-final2.patch,
> PHOENIX-3817.v1.patch, PHOENIX-3817.v2.patch, PHOENIX-3817.v3.patch,
> PHOENIX-3817.v4.patch, PHOENIX-3817.v5.patch, PHOENIX-3817.v6.patch,
> PHOENIX-3817.v7.patch
>
>
> Certain use cases may copy or replicate a subset of a table to a different
> table or cluster. For example, application topologies may map data for
> specific tenants to different peer clusters.
> It would be useful to have a Phoenix VerifyReplication tool that accepts an
> SQL query, a target table, and an optional target cluster. The tool would
> compare data returned by the query on the different tables and update various
> result counters (similar to HBase's VerifyReplication).
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)