From b2c8e34f1bed9dc2e68a719c3ec5470c5dc595bf Mon Sep 17 00:00:00 2001 From: James Taylor Date: Mon, 7 Aug 2017 23:27:53 -0700 Subject: [PATCH] PHOENIX-4070 Delete row should mask upserts at same timestamp (addendum for typos) --- .../end2end/OutOfOrderMutationsIT.java | 18 +++++++------- .../index/PartialIndexRebuilderIT.java | 24 +++++++++---------- .../org/apache/phoenix/util/TestUtil.java | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/OutOfOrderMutationsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/OutOfOrderMutationsIT.java index 0e038e2df21..5cdc1eebce8 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/OutOfOrderMutationsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/OutOfOrderMutationsIT.java @@ -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(); @@ -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()); @@ -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()); @@ -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()); @@ -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()); @@ -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()); @@ -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()); @@ -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(); @@ -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(); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/PartialIndexRebuilderIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/PartialIndexRebuilderIT.java index cc5f138611b..1e542281399 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/PartialIndexRebuilderIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/PartialIndexRebuilderIT.java @@ -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>"); @@ -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')"); @@ -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(); @@ -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'"); @@ -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); } } @@ -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); } } @@ -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); } } @@ -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); } } @@ -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); } } @@ -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); } } @@ -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); } } @@ -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); } } } diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java index 1716928b0a6..12b1c035a1d 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java @@ -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));