[
https://issues.apache.org/jira/browse/PHOENIX-2605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15135508#comment-15135508
]
James Taylor commented on PHOENIX-2605:
---------------------------------------
Looks good. Wondering if we need this code in the if statement, since the
UPSERT SELECT will be run in the same tx as the CREATE INDEX won't it already
use the writePointer as the upper bound? Seems like we'd only need this for the
ASYNC case.
{code}
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -1013,7 +1013,6 @@ public class MetaDataClient {
private MutationState buildIndex(PTable index, TableRef dataTableRef)
throws SQLException {
AlterIndexStatement indexStatement = null;
boolean wasAutoCommit = connection.getAutoCommit();
- connection.rollback();
try {
connection.setAutoCommit(true);
MutationPlan mutationPlan;
@@ -1032,7 +1031,14 @@ public class MetaDataClient {
if (scn == null) {
scn = mutationPlan.getContext().getCurrentTime();
}
- scan.setTimeRange(dataTableRef.getLowerBoundTimeStamp(),
scn);
+ // if the table is transactional we need to set the TX_SCN
attribute so that the max time range is set correctly
+ // by BaseScannerRegionObserver (after TransactionProcess
runs)
+ if (dataTableRef.getTable().isTransactional()) {
+ scan.setAttribute(BaseScannerRegionObserver.TX_SCN,
Bytes.toBytes(TransactionUtil.convertToNanoseconds(scn)));
+ }
+ else {
+
scan.setTimeRange(dataTableRef.getLowerBoundTimeStamp(), scn);
+ }
{code}
> Enhance IndexToolIT to test transactional tables
> ------------------------------------------------
>
> Key: PHOENIX-2605
> URL: https://issues.apache.org/jira/browse/PHOENIX-2605
> Project: Phoenix
> Issue Type: Test
> Reporter: Thomas D'Silva
> Assignee: Thomas D'Silva
> Fix For: 4.7.0
>
> Attachments: PHOENIX-2605-v2.patch, PHOENIX-2605-v3.patch,
> PHOENIX-2605.patch
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)