Skip to content

Conversation

@swaroopak
Copy link
Contributor

Copy link
Contributor

@twdsilva twdsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swaroopak thanks for the PR, I have left some feedback.


}
@Test
public void testUpsertOnSCNSetMutTable() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a helper function to test the tables that are mutable/immutable and which don't have an index, have a global index or a local index (and pass these options in as parameters).

@Test // See https://issues.apache.org/jira/browse/PHOENIX-4983
public void testUpsertOnSCNSetTxnTable() throws SQLException {

String trnx = "CREATE TABLE transaction_table (METRIC_ID CHAR(15) NOT NULL,\n" +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a generateUniqueName() to create tables with unique names since tests that extend ParallelStatsDisabledIT
share the same cluster.

CANNOT_UPSERT_WITH_SCN_FOR_ROW_TIMSTAMP_COLUMN(901,"43M12",
"Cannot use a connection with SCN set to upsert data for " +
"table with ROW_TIMESTAMP column."),
CANNOT_UPSERT_WITH_SCN_FOR_TXN_TABLE(902,"43M13",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this as its not used

if (plan.getTargetRef() != null && plan.getTargetRef().getTable() != null && plan.getTargetRef().getTable().isTransactional()) {
state.startTransaction(plan.getTargetRef().getTable().getTransactionProvider());
PTable table = plan.getTargetRef().getTable();
if(table != null && connection.getSCN() != null && !connection.isRunningUpgrade() && !connection.isBuildingIndex()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move these checks to UpsertCompiler? Also I think you can remove the second check for mutable tables with indexes here.

@swaroopak swaroopak force-pushed the PHOENIX-4983 branch 2 times, most recently from c6ce8be to c19b2a7 Compare December 5, 2018 23:33

helpTestUpserWithSCNIT(false, true, false, false, false);
exception.expect(SQLException.class);
exception.expectMessage(containsString("ERROR 1075 (44A06): Cannot use a " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't compare error message strings, use errorCode instead.

Copy link
Contributor

@twdsilva twdsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swaroopak looks good, please make the change that karan requested and we can get this committed.

}

@Test
public void testUpsertOnSCNSetMutTable() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename to testUpsertOnSCNSetMutableTableWithoutIndexes

@swaroopak swaroopak force-pushed the PHOENIX-4983 branch 2 times, most recently from cda3ff6 to 6a6c858 Compare December 10, 2018 22:25
@twdsilva
Copy link
Contributor

+1

…o tables EXCEPT transactional tables or mutable tables with indexes or tables with ROW_TIMESTAMP column.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants