[
https://issues.apache.org/jira/browse/PHOENIX-6587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17518306#comment-17518306
]
ASF GitHub Bot commented on PHOENIX-6587:
-----------------------------------------
joshelser commented on code in PR #1353:
URL: https://github.com/apache/phoenix/pull/1353#discussion_r844175591
##########
phoenix-core/src/main/java/org/apache/phoenix/schema/SaltingUtil.java:
##########
@@ -123,4 +130,29 @@ public static void
addRegionStartKeyToScanStartAndStopRows(byte[] startKey, byte
scan.setStopRow(newStopRow);
}
}
+
+ public static void checkTableIsSalted(Admin admin, TableName tableName,
int buckets) throws IOException, SQLException {
+ // Heuristics to check if and existing HBase table can be a salted
Phoenix table
+ // with the specified number of buckets.
+ // May give false negatives.
+ byte[] maxStartKey = new byte[] {0} ;
+ List<RegionInfo> regionInfos =
+ admin.getRegions(tableName);
+ for (RegionInfo regionInfo : regionInfos) {
+ if (Bytes.compareTo(regionInfo.getStartKey(), maxStartKey) > 0) {
+ maxStartKey = regionInfo.getStartKey();
+ }
+ }
+ byte lastRegionStartSaltKey = maxStartKey[0];
+ if (lastRegionStartSaltKey == (byte) (buckets - 1)) {
Review Comment:
> Technically it is possible, but it would be a lot of work as we'd need to
start from the grammar to add a force option.
I see that sqlline has some functionality to pass down generic properties,
but we don't have that hooked up through sqlline.py
Can defer this until it bites us, I guess.
> Handle explicit pre-splits for new salted tables and validate splits when
> creating salted tables on existing HBase tables
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: PHOENIX-6587
> URL: https://issues.apache.org/jira/browse/PHOENIX-6587
> Project: Phoenix
> Issue Type: Bug
> Components: core
> Affects Versions: 5.2.0
> Reporter: Istvan Toth
> Assignee: Istvan Toth
> Priority: Minor
>
> Specifying the split points manually on salted tables can break them.
> The easiest thing to do is to disallow it, which ensures that the table is
> created with the default per bucket presplit.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)