You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Taylor (JIRA)" <ji...@apache.org> on 2015/11/14 01:34:11 UTC

[jira] [Created] (PHOENIX-2415) Support ROW_TIMESTAMP with transactional tables

James Taylor created PHOENIX-2415:
-------------------------------------

             Summary: 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


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. 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)