Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 98b9e3f4b -> 63802652c
PHOENIX-4175 Convert tests using CURRENT_SCN to not use it when possible (addendum) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/63802652 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/63802652 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/63802652 Branch: refs/heads/4.x-HBase-0.98 Commit: 63802652c78c971f93ffbf1a6cdcf3630d9c6849 Parents: 98b9e3f Author: James Taylor <jtay...@salesforce.com> Authored: Thu Sep 7 11:41:30 2017 -0700 Committer: James Taylor <jtay...@salesforce.com> Committed: Thu Sep 7 11:41:30 2017 -0700 ---------------------------------------------------------------------- .../apache/phoenix/end2end/UpsertSelectIT.java | 23 ++++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/63802652/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index e9a514b..aab8729 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -77,20 +77,30 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { @Test public void testUpsertSelectWithNoIndex() throws Exception { - testUpsertSelect(false); + testUpsertSelect(false, false); } @Test public void testUpsertSelecWithIndex() throws Exception { - testUpsertSelect(true); + testUpsertSelect(true, false); } - private void testUpsertSelect(boolean createIndex) throws Exception { + @Test + public void testUpsertSelecWithIndexWithSalt() throws Exception { + testUpsertSelect(true, true); + } + + @Test + public void testUpsertSelecWithNoIndexWithSalt() throws Exception { + testUpsertSelect(false, true); + } + + private void testUpsertSelect(boolean createIndex, boolean saltTable) throws Exception { long ts = nextTimestamp(); String tenantId = getOrganizationId(); byte[][] splits = getDefaultSplits(tenantId); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - String aTable = initATableValues(tenantId, splits, null, ts-1, getUrl(), null); + String aTable = initATableValues(tenantId, saltTable ? null : splits, null, ts-1, getUrl(), saltTable ? "salt_buckets = 2" : null); String customEntityTable = generateUniqueName(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts - 1)); @@ -122,12 +132,11 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { " b.val7 varchar,\n" + " b.val8 varchar,\n" + " b.val9 varchar\n" + - " CONSTRAINT pk PRIMARY KEY (organization_id, key_prefix, custom_entity_data_id))"; + " CONSTRAINT pk PRIMARY KEY (organization_id, key_prefix, custom_entity_data_id)) " + (saltTable ? "salt_buckets = 2" : ""); conn.createStatement().execute(ddl); conn.close(); String indexName = generateUniqueName(); - if (createIndex) { props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); // Execute at timestamp 1 conn = DriverManager.getConnection(getUrl(), props); @@ -1526,4 +1535,4 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { return DriverManager.getConnection(getUrl(), props); } -} +} \ No newline at end of file