Sanjeet Malhotra created PHOENIX-7402:
-----------------------------------------

             Summary: Even if a row is updated with TTL its getting expired 
partially
                 Key: PHOENIX-7402
                 URL: https://issues.apache.org/jira/browse/PHOENIX-7402
             Project: Phoenix
          Issue Type: Bug
            Reporter: Sanjeet Malhotra
            Assignee: Sanjeet Malhotra


Even though a row is being updated within TTL but still its getting expired 
partially. Following IT in MaxLookbackExnetedIT can be used to reproduce the 
issue:
{code:java}
@Test
public void testRetainingLastRowVersion() throws Exception {
    if (multiCF) {
        return;
    }
    if(hasTableLevelMaxLookback) {
        optionBuilder.append(", MAX_LOOKBACK_AGE=" + 
TABLE_LEVEL_MAX_LOOKBACK_AGE * 1000);
        tableDDLOptions = optionBuilder.toString();
    }
    try(Connection conn = DriverManager.getConnection(getUrl())) {
        String tableName = generateUniqueName();
        createTable(tableName);
        injectEdge.setValue(System.currentTimeMillis());
        EnvironmentEdgeManager.injectEdge(injectEdge);
        injectEdge.incrementValue(1);
        Statement stmt = conn.createStatement();
        stmt.execute("upsert into " + tableName + " values ('a', 'ab', 'abc', 
'abcd')");
        conn.commit();
        injectEdge.incrementValue(16 * 1000);
        stmt.execute("upsert into " + tableName + " values ('a', 'ab1')");
        conn.commit();
        injectEdge.incrementValue(16 * 1000);
        stmt.execute("upsert into " + tableName + " values ('a', 'ab2')");
        conn.commit();
        injectEdge.incrementValue(16 * 1000);
        stmt.execute("upsert into " + tableName + " values ('a', 'ab3')");
        conn.commit();
        injectEdge.incrementValue(11 * 1000);
        stmt.execute("upsert into " + tableName + " values ('b', 'bc', 'bcd', 
'bcde')");
        conn.commit();
        injectEdge.incrementValue(1);
        TableName dataTableName = TableName.valueOf(tableName);
        TestUtil.dumpTable(conn, dataTableName);
        flush(dataTableName);
        injectEdge.incrementValue(1);
        TestUtil.dumpTable(conn, dataTableName);
        majorCompact(dataTableName);
        TestUtil.dumpTable(conn, dataTableName);
        injectEdge.incrementValue(1);
        ResultSet rs = stmt.executeQuery("select * from " + dataTableName + " 
where id = 'a'");
        //TestUtil.printResultSet(rs);
        while(rs.next()) {
            assertNotNull(rs.getString(3));
            assertNotNull(rs.getString(4));
        }
    }
} {code}
The TTL in above IT is 30 sec and table level max lookback age is 10 sec with 
cluster level max lookback = 15 sec.

The IT is failing at the last two checks:
{code:java}
while(rs.next()) { 
   assertNotNull(rs.getString(3)); 
   assertNotNull(rs.getString(4)); 
} {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to