swaroopak commented on a change in pull request #473: PHOENIX-5138 -
ViewIndexId sequences created after PHOENIX-5132 shoul…
URL: https://github.com/apache/phoenix/pull/473#discussion_r272742688
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
##########
@@ -2502,6 +2483,32 @@ public void createTable(RpcController controller,
CreateTableRequest request,
}
}
+ private long getViewIndexSequenceValue(PhoenixConnection connection,
String tenantIdStr, PTable parentTable, PName physicalName) throws SQLException
{
+ int nSequenceSaltBuckets =
connection.getQueryServices().getSequenceSaltBuckets();
+
+ SequenceKey key = MetaDataUtil.getViewIndexSequenceKey(tenantIdStr,
physicalName,
+ nSequenceSaltBuckets, parentTable.isNamespaceMapped() );
+ // Earlier sequence was created at (SCN-1/LATEST_TIMESTAMP) and
incremented at the client max(SCN,dataTable.getTimestamp), but it seems we
should
+ // use always LATEST_TIMESTAMP to avoid seeing wrong sequence values
by different connection having SCN
+ // or not.
+ long sequenceTimestamp = HConstants.LATEST_TIMESTAMP;
+ try {
+ connection.getQueryServices().createSequence(key.getTenantId(),
key.getSchemaName(), key.getSequenceName(),
+ Long.MIN_VALUE, 1, 1, Long.MIN_VALUE, Long.MAX_VALUE, false,
sequenceTimestamp);
+ } catch (SequenceAlreadyExistsException e) {
+ }
Review comment:
It would be nice to have a log line added here.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services