phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Taylor (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-2415) Support ROW_TIMESTAMP with transactional tables
Date Tue, 08 Dec 2015 21:57:11 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15047538#comment-15047538
] 

James Taylor commented on PHOENIX-2415:
---------------------------------------

Yes, that makes sense to raise an error if SCN is specified *and* the user is manually trying
to set the ROW_TIMESTAMP column.

> Support ROW_TIMESTAMP with transactional tables
> -----------------------------------------------
>
>                 Key: PHOENIX-2415
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2415
>             Project: Phoenix
>          Issue Type: Sub-task
>            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)

Mime
View raw message