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

ASF GitHub Bot commented on PHOENIX-1674:
-----------------------------------------

Github user JamesRTaylor commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/127#discussion_r44852599
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java ---
    @@ -415,24 +425,47 @@ private long getClientTimeStamp() {
             long clientTimeStamp = scn == null ? HConstants.LATEST_TIMESTAMP : 
scn;
             return clientTimeStamp;
         }
    -
    +    
    +    private long getCurrentScn() {
    +           Long scn = connection.getSCN();
    +        long currentScn = scn == null ? HConstants.LATEST_TIMESTAMP : scn;
    +        return currentScn;
    +    }
    +    
         private MetaDataMutationResult updateCache(PName tenantId, String 
schemaName, String tableName,
    -            boolean alwaysHitServer) throws SQLException { // TODO: pass 
byte[] herez
    -        long clientTimeStamp = getClientTimeStamp();
    +            boolean alwaysHitServer, Long resolvedTimestamp) throws 
SQLException { // TODO: pass byte[] herez
             boolean systemTable = SYSTEM_CATALOG_SCHEMA.equals(schemaName);
             // System tables must always have a null tenantId
             tenantId = systemTable ? null : tenantId;
             PTable table = null;
    +        PTableRef tableRef = null;
             String fullTableName = SchemaUtil.getTableName(schemaName, 
tableName);
             long tableTimestamp = HConstants.LATEST_TIMESTAMP;
    +        long tableResolvedTimestamp = HConstants.LATEST_TIMESTAMP;
             try {
    -            table = connection.getTable(new PTableKey(tenantId, 
fullTableName));
    +            tableRef = connection.getTableRef(new PTableKey(tenantId, 
fullTableName));
    +            table = tableRef.getTable();
                 tableTimestamp = table.getTimeStamp();
    +            tableResolvedTimestamp = tableRef.getResolvedTimeStamp();
             } catch (TableNotFoundException e) {
             }
    -        // Don't bother with server call: we can't possibly find a newer 
table
    -        if (table != null && !alwaysHitServer && (systemTable || 
tableTimestamp == clientTimeStamp - 1)) {
    -            return new 
MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS,QueryConstants.UNSET_TIMESTAMP,table);
    +        
    --- End diff --
    
    Add a test that gets the current time using a transactional table, like 
this:
        SELECT current_date() FROM transactional_table
    
    and run it after the transaction has started to make sure the date changes 
for each statement. You may need to adjust this logic slightly here and in 
StatementContext.getCurrentTime() if a table is transactional. Perhaps from 
there you can use the alwaysHitServer flag - not sure what the best way is.


> Snapshot isolation transaction support through Tephra
> -----------------------------------------------------
>
>                 Key: PHOENIX-1674
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1674
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: James Taylor
>              Labels: SFDC
>
> Tephra (http://tephra.io/ and https://github.com/caskdata/tephra) is one 
> option for getting transaction support in Phoenix. Let's use this JIRA to 
> discuss the way in which this could be integrated along with the pros and 
> cons.



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

Reply via email to