Skip to content

Commit

Permalink
PHOENIX-4070 Delete row should mask upserts at same timestamp (addend…
Browse files Browse the repository at this point in the history
…um for typos)
  • Loading branch information
JamesRTaylor committed Aug 8, 2017
1 parent 19de020 commit b2c8e34
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
Expand Up @@ -91,7 +91,7 @@ public void testOutOfOrderDelete() throws Exception {
props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts));
conn = DriverManager.getConnection(getUrl(), props);

TestUtil.scutinizeIndex(conn, tableName, indexName);
TestUtil.scrutinizeIndex(conn, tableName, indexName);
assertNoTimeStampAt(conn, indexName, 1030);
conn.close();

Expand Down Expand Up @@ -175,7 +175,7 @@ public void testOutOfOrderUpsert() throws Exception {
props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts));
conn = DriverManager.getConnection(getUrl(), props);

TestUtil.scutinizeIndex(conn, tableName, indexName);
TestUtil.scrutinizeIndex(conn, tableName, indexName);

ResultSet rs = conn.createStatement().executeQuery("SELECT /*+ NO_INDEX */ ts FROM " + tableName);
assertTrue(rs.next());
Expand Down Expand Up @@ -265,7 +265,7 @@ public void testSetIndexedColumnToNull() throws Exception {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(tableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(indexName)));

TestUtil.scutinizeIndex(conn, tableName, indexName);
TestUtil.scrutinizeIndex(conn, tableName, indexName);

ResultSet rs = conn.createStatement().executeQuery("SELECT /*+ NO_INDEX */ ts FROM " + tableName);
assertTrue(rs.next());
Expand Down Expand Up @@ -331,7 +331,7 @@ public void testSetIndexedColumnToNull2() throws Exception {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(tableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(indexName)));

TestUtil.scutinizeIndex(conn, tableName, indexName);
TestUtil.scrutinizeIndex(conn, tableName, indexName);

ResultSet rs = conn.createStatement().executeQuery("SELECT /*+ NO_INDEX */ ts FROM " + tableName);
assertTrue(rs.next());
Expand Down Expand Up @@ -393,7 +393,7 @@ public void testSetIndexedColumnToNullAndValueAtSameTS() throws Exception {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(tableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(indexName)));

TestUtil.scutinizeIndex(conn, tableName, indexName);
TestUtil.scrutinizeIndex(conn, tableName, indexName);

ResultSet rs = conn.createStatement().executeQuery("SELECT /*+ NO_INDEX */ ts,v FROM " + tableName);
assertTrue(rs.next());
Expand Down Expand Up @@ -458,7 +458,7 @@ public void testSetIndexedColumnToNullAndValueAtSameTSWithStoreNulls1() throws E
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(tableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(indexName)));

TestUtil.scutinizeIndex(conn, tableName, indexName);
TestUtil.scrutinizeIndex(conn, tableName, indexName);

ResultSet rs = conn.createStatement().executeQuery("SELECT /*+ NO_INDEX */ ts,v FROM " + tableName);
assertTrue(rs.next());
Expand Down Expand Up @@ -523,7 +523,7 @@ public void testSetIndexedColumnToNullAndValueAtSameTSWithStoreNulls2() throws E
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(tableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(indexName)));

TestUtil.scutinizeIndex(conn, tableName, indexName);
TestUtil.scrutinizeIndex(conn, tableName, indexName);

ResultSet rs = conn.createStatement().executeQuery("SELECT /*+ NO_INDEX */ ts,v FROM " + tableName);
assertTrue(rs.next());
Expand Down Expand Up @@ -587,7 +587,7 @@ public void testDeleteRowAndUpsertValueAtSameTS1() throws Exception {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(tableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(indexName)));

long rowCount = TestUtil.scutinizeIndex(conn, tableName, indexName);
long rowCount = TestUtil.scrutinizeIndex(conn, tableName, indexName);
assertEquals(0,rowCount);

conn.close();
Expand Down Expand Up @@ -640,7 +640,7 @@ public void testDeleteRowAndUpsertValueAtSameTS2() throws Exception {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(tableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(indexName)));

long rowCount = TestUtil.scutinizeIndex(conn, tableName, indexName);
long rowCount = TestUtil.scrutinizeIndex(conn, tableName, indexName);
assertEquals(0,rowCount);

conn.close();
Expand Down
Expand Up @@ -74,7 +74,7 @@ public void testRowCountIndexScrutiny() throws Throwable {
assertEquals(1,count);
conn.commit();
try {
TestUtil.scutinizeIndex(conn, fullTableName, fullIndexName);
TestUtil.scrutinizeIndex(conn, fullTableName, fullIndexName);
fail();
} catch (AssertionError e) {
assertEquals(e.getMessage(),"Expected data table row count to match expected:<1> but was:<2>");
Expand All @@ -98,7 +98,7 @@ public void testExtraRowIndexScrutiny() throws Throwable {
conn.createStatement().executeUpdate("UPSERT INTO " + fullIndexName + " VALUES ('bbb','x','0')");
conn.commit();
try {
TestUtil.scutinizeIndex(conn, fullTableName, fullIndexName);
TestUtil.scrutinizeIndex(conn, fullTableName, fullIndexName);
fail();
} catch (AssertionError e) {
assertEquals(e.getMessage(),"Expected to find PK in data table: ('x')");
Expand All @@ -107,7 +107,7 @@ public void testExtraRowIndexScrutiny() throws Throwable {
}

@Test
public void testValuetIndexScrutiny() throws Throwable {
public void testValueIndexScrutiny() throws Throwable {
String schemaName = generateUniqueName();
String tableName = generateUniqueName();
String indexName = generateUniqueName();
Expand All @@ -123,7 +123,7 @@ public void testValuetIndexScrutiny() throws Throwable {
conn.createStatement().executeUpdate("UPSERT INTO " + fullIndexName + " VALUES ('ccc','a','2')");
conn.commit();
try {
TestUtil.scutinizeIndex(conn, fullTableName, fullIndexName);
TestUtil.scrutinizeIndex(conn, fullTableName, fullIndexName);
fail();
} catch (AssertionError e) {
assertEquals(e.getMessage(),"Expected equality for V2, but '2'!='1'");
Expand Down Expand Up @@ -156,7 +156,7 @@ public void testMultiVersionsAfterFailure() throws Throwable {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullTableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullIndexName)));

TestUtil.scutinizeIndex(conn, fullTableName, fullIndexName);
TestUtil.scrutinizeIndex(conn, fullTableName, fullIndexName);
}
}

Expand Down Expand Up @@ -185,7 +185,7 @@ public void testUpsertNullAfterFailure() throws Throwable {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullTableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullIndexName)));

TestUtil.scutinizeIndex(conn, fullTableName, fullIndexName);
TestUtil.scrutinizeIndex(conn, fullTableName, fullIndexName);
}
}

Expand Down Expand Up @@ -214,7 +214,7 @@ public void testUpsertNullTwiceAfterFailure() throws Throwable {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullTableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullIndexName)));

TestUtil.scutinizeIndex(conn, fullTableName, fullIndexName);
TestUtil.scrutinizeIndex(conn, fullTableName, fullIndexName);
}
}

Expand All @@ -241,7 +241,7 @@ public void testDeleteAfterFailure() throws Throwable {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullTableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullIndexName)));

TestUtil.scutinizeIndex(conn, fullTableName, fullIndexName);
TestUtil.scrutinizeIndex(conn, fullTableName, fullIndexName);
}
}

Expand All @@ -268,7 +268,7 @@ public void testDeleteBeforeFailure() throws Throwable {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullTableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullIndexName)));

TestUtil.scutinizeIndex(conn, fullTableName, fullIndexName);
TestUtil.scrutinizeIndex(conn, fullTableName, fullIndexName);
}
}

Expand Down Expand Up @@ -299,7 +299,7 @@ public void testMultiValuesAtSameTS() throws Throwable {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullTableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullIndexName)));

TestUtil.scutinizeIndex(conn, fullTableName, fullIndexName);
TestUtil.scrutinizeIndex(conn, fullTableName, fullIndexName);
}
}

Expand Down Expand Up @@ -330,7 +330,7 @@ public void testDeleteAndUpsertValuesAtSameTS1() throws Throwable {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullTableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullIndexName)));

TestUtil.scutinizeIndex(conn, fullTableName, fullIndexName);
TestUtil.scrutinizeIndex(conn, fullTableName, fullIndexName);
}
}

Expand Down Expand Up @@ -361,7 +361,7 @@ public void testDeleteAndUpsertValuesAtSameTS2() throws Throwable {
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullTableName)));
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(fullIndexName)));

TestUtil.scutinizeIndex(conn, fullTableName, fullIndexName);
TestUtil.scrutinizeIndex(conn, fullTableName, fullIndexName);
}
}
}
Expand Up @@ -882,7 +882,7 @@ public static void waitForIndexRebuild(Connection conn, String fullIndexName, PI
}
}

public static long scutinizeIndex(Connection conn, String fullTableName, String fullIndexName) throws SQLException {
public static long scrutinizeIndex(Connection conn, String fullTableName, String fullIndexName) throws SQLException {
PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class);
PTable ptable = pconn.getTable(new PTableKey(pconn.getTenantId(), fullTableName));
PTable pindex = pconn.getTable(new PTableKey(pconn.getTenantId(), fullIndexName));
Expand Down

0 comments on commit b2c8e34

Please sign in to comment.