phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas D'Silva (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (PHOENIX-2415) Support ROW_TIMESTAMP with transactional tables
Date Fri, 14 Sep 2018 17:58:00 GMT

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

Thomas D'Silva reassigned PHOENIX-2415:
---------------------------------------

    Assignee:     (was: Thomas D'Silva)

> 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
>            Priority: Major
>
> 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
(v7.6.3#76005)

Mime
View raw message