Github user twdsilva commented on a diff in the pull request: https://github.com/apache/phoenix/pull/133#discussion_r45692528 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java --- @@ -1268,19 +1312,19 @@ public MutationState createIndex(CreateIndexStatement statement, byte[][] splits // as there's no need to burn another sequence value. if (allocateIndexId && indexId == null) { Long scn = connection.getSCN(); - long timestamp = scn == null ? HConstants.LATEST_TIMESTAMP : scn; PName tenantId = connection.getTenantId(); String tenantIdStr = tenantId == null ? null : connection.getTenantId().getString(); PName physicalName = dataTable.getPhysicalName(); int nSequenceSaltBuckets = connection.getQueryServices().getSequenceSaltBuckets(); SequenceKey key = MetaDataUtil.getViewIndexSequenceKey(tenantIdStr, physicalName, nSequenceSaltBuckets); - // Create at parent timestamp as we know that will be earlier than now - // and earlier than any SCN if one is set. + // if scn is set create at scn-1, so we can see the sequence or else use latest timestamp (so that latest server time is used) + long sequenceTimestamp = scn!=null ? scn-1 : HConstants.LATEST_TIMESTAMP; --- End diff -- No, we are just setting the timestamp at which the sequence correctly instead of based on the data table timestamp. This is required so that don't make unnesscary rpc calls while resolving a table. Previously we were just creating the sequence at the parent table tiemstamp, which caused issues
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---