[ 
https://issues.apache.org/jira/browse/PHOENIX-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Taylor updated PHOENIX-2415:
----------------------------------
    Issue Type: Bug  (was: Sub-task)
        Parent:     (was: PHOENIX-1674)

> Support ROW_TIMESTAMP with transactional tables
> -----------------------------------------------
>
>                 Key: PHOENIX-2415
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2415
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: Thomas D'Silva
>
> Currently transactional tables don't use the ROW_TIMESTAMP optimization, 
> based on this code in BaseQueryPlan:
> {code}
> +        if (!table.isTransactional()) {
> +                     // Get the time range of row_timestamp column
> +             TimeRange rowTimestampRange = 
> context.getScanRanges().getRowTimestampRange();
> +             // Get the already existing time range on the scan.
> +             TimeRange scanTimeRange = scan.getTimeRange();
> +             Long scn = connection.getSCN();
> +             if (scn == null) {
> +                 scn = context.getCurrentTime();
> +             }
> +             try {
> +                 TimeRange timeRangeToUse = 
> ScanUtil.intersectTimeRange(rowTimestampRange, scanTimeRange, scn);
> +                 if (timeRangeToUse == null) {
> +                     return ResultIterator.EMPTY_ITERATOR;
> +                 }
> +                 scan.setTimeRange(timeRangeToUse.getMin(), 
> timeRangeToUse.getMax());
> +             } catch (IOException e) {
> +                 throw new RuntimeException(e);
> +             }
> +         }
> {code}
> Instead, we should allow optimization, but disallow manually setting the 
> ROW_TIMESTAMP column on UPSERT commands for transactional tables. We can use 
> the write pointer of the transaction as the current time and ensure that a 
> checkpoint is done prior to statement execution on a table with ROW_TIMESTAMP 
> to ensure that time is moving forward when a new statement is executed. Here 
> in this code, we'd just set the scn to HConstants.LATEST_TIMESTAMP for 
> transactional tables. Would be good to have a test too, to make sure Tephra 
> doesn't reset the min time range on the scan.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to