From f230114e4c8a4651bc681434896abd0a2a6be88b Mon Sep 17 00:00:00 2001 From: Andy Pavlo Date: Sun, 7 Jul 2013 16:44:15 -0400 Subject: [PATCH] Major Change: INSERT/UPDATE/DELETE queries will now return the logical number of tuples that get modified (rather than the physical). This is the way it's suppose to be. Restored support for TestReplicationSuite to verify this --- build.xml | 3 - .../regressionsuites/TestIndexesSuite.java | 79 +++++++++---------- .../TestReplicationSuite.java | 38 +++++---- 3 files changed, 59 insertions(+), 61 deletions(-) diff --git a/build.xml b/build.xml index 58d6006e54..624afc6df5 100644 --- a/build.xml +++ b/build.xml @@ -1041,7 +1041,6 @@ TEST CASES - @@ -1124,7 +1123,6 @@ TEST CASES - @@ -1202,7 +1200,6 @@ TEST CASES - diff --git a/tests/frontend/org/voltdb/regressionsuites/TestIndexesSuite.java b/tests/frontend/org/voltdb/regressionsuites/TestIndexesSuite.java index 966b26cbe9..024e0992fd 100644 --- a/tests/frontend/org/voltdb/regressionsuites/TestIndexesSuite.java +++ b/tests/frontend/org/voltdb/regressionsuites/TestIndexesSuite.java @@ -25,12 +25,19 @@ import java.io.IOException; -import org.voltdb.*; -import org.voltdb.client.*; +import org.voltdb.BackendTarget; +import org.voltdb.VoltProcedure; +import org.voltdb.VoltTable; +import org.voltdb.client.Client; +import org.voltdb.client.ClientResponse; +import org.voltdb.client.NullCallback; +import org.voltdb.client.ProcCallException; import org.voltdb.compiler.VoltProjectBuilder; import org.voltdb.regressionsuites.indexes.CheckMultiMultiIntGTEFailure; import org.voltdb.regressionsuites.indexes.Insert; +import edu.brown.hstore.Hstoreservice.Status; + /** * Actual regression tests for SQL that I found that was broken and * have fixed. Didn't like any of the other potential homes that already @@ -39,6 +46,8 @@ public class TestIndexesSuite extends RegressionSuite { + private static final String[] ALL_TABLES = {"P1", "R1", "P2", "R2"}; + /** Procedures used by this suite */ @SuppressWarnings("unchecked") static final Class PROCEDURES[] = (Class[])new Class[] { @@ -53,31 +62,32 @@ public class TestIndexesSuite extends RegressionSuite { // - multi-column // - multi-map - public void testParameterizedLimitOnIndexScan() - throws IOException, ProcCallException { - String[] tables = {"P1", "R1", "P2", "R2"}; + public void testParameterizedLimitOnIndexScan() throws IOException, ProcCallException { Client client = getClient(); - for (String table : tables) - { + ClientResponse cr = null; + for (String table : ALL_TABLES) { client.callProcedure("Insert", table, 1, "a", 100, 1, 14.5); client.callProcedure("Insert", table, 2, "b", 100, 2, 15.5); client.callProcedure("Insert", table, 3, "c", 200, 3, 16.5); client.callProcedure("Insert", table, 6, "f", 200, 6, 17.5); client.callProcedure("Insert", table, 7, "g", 300, 7, 18.5); client.callProcedure("Insert", table, 8, "h", 300, 8, 19.5); + + cr = RegressionSuiteUtil.sql(client, "SELECT * FROM " + table); + assertEquals(cr.toString(), Status.OK, cr.getStatus()); - VoltTable[] results = client.callProcedure("Eng397LimitIndex" + table, new Integer(2)).getResults(); - assertEquals(2, results[0].getRowCount()); + cr = client.callProcedure("Eng397LimitIndex"+table, 2); + assertEquals(cr.toString(), Status.OK, cr.getStatus()); + VoltTable[] results = cr.getResults(); + assertEquals(cr.toString(), 2, results[0].getRowCount()); } } public void testOrderedUniqueOneColumnIntIndex() throws IOException, ProcCallException { - String[] tables = {"P1", "R1", "P2", "R2"}; Client client = getClient(); - for (String table : tables) - { + for (String table : ALL_TABLES) { client.callProcedure("Insert", table, 1, "a", 100, 1, 14.5); client.callProcedure("Insert", table, 2, "b", 100, 2, 15.5); client.callProcedure("Insert", table, 3, "c", 200, 3, 16.5); @@ -151,10 +161,8 @@ public void testOrderedUniqueOneColumnIntIndex() public void testOrderedMultiOneColumnIntIndex() throws IOException, ProcCallException { - String[] tables = {"P1", "R1", "P2", "R2"}; Client client = getClient(); - for (String table : tables) - { + for (String table : ALL_TABLES) { client.callProcedure("Insert", table, 1, "a", 100, 1, 14.5); client.callProcedure("Insert", table, 2, "b", 100, 2, 15.5); client.callProcedure("Insert", table, 3, "c", 200, 3, 16.5); @@ -214,9 +222,8 @@ public void testOrderedMultiOneColumnIntIndex() public void testTicket195() throws IOException, ProcCallException { - String[] tables = {"P1", "R1", "P2", "R2"}; Client client = getClient(); - for (String table : tables) + for (String table : ALL_TABLES) { client.callProcedure("Insert", table, 1, "a", 100, 1, 14.5); client.callProcedure("Insert", table, 2, "b", 100, 2, 15.5); @@ -514,8 +521,7 @@ public TestIndexesSuite(String name) { static public junit.framework.Test suite() { VoltServerConfig config = null; - MultiConfigSuiteBuilder builder = - new MultiConfigSuiteBuilder(TestIndexesSuite.class); + MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestIndexesSuite.class); VoltProjectBuilder project = new VoltProjectBuilder("indexes"); project.addSchema(Insert.class.getResource("indexes-ddl.sql")); @@ -523,38 +529,29 @@ static public junit.framework.Test suite() { project.addTablePartitionInfo("P2", "ID"); project.addTablePartitionInfo("P3", "ID"); project.addProcedures(PROCEDURES); - project.addStmtProcedure("Eng397LimitIndexR1", "select * from R1 where R1.ID > 2 Limit ?"); - project.addStmtProcedure("Eng397LimitIndexP1", "select * from P1 where P1.ID > 2 Limit ?"); - project.addStmtProcedure("Eng397LimitIndexR2", "select * from R2 where R2.ID > 2 Limit ?"); - project.addStmtProcedure("Eng397LimitIndexP2", "select * from P2 where P2.ID > 2 Limit ?"); + + for (String tableName : ALL_TABLES) { + String procName = "Eng397LimitIndex" + tableName; + String sql = String.format("SELECT * FROM %s WHERE %s.ID > 2 LIMIT ?", tableName, tableName); + project.addStmtProcedure(procName, sql); + } // FOR project.addStmtProcedure("Eng506UpdateRange", "UPDATE P1IX SET NUM = ? WHERE (P1IX.ID>P1IX.NUM) AND (P1IX.NUM>?)"); project.addStmtProcedure("InsertP1IX", "insert into P1IX values (?, ?, ?, ?);"); boolean success; - /* - // CONFIG #1: Local Site/Partitions running on IPC backend - config = new LocalSingleProcessServer("sqltypes-onesite.jar", 1, BackendTarget.NATIVE_EE_IPC); - config.compile(project); - builder.addServerConfig(config);*/ - // CONFIG #2: HSQL - -// config = new LocalSingleProcessServer("testindexes-hsql.jar", 1, BackendTarget.HSQLDB_BACKEND); -// success = config.compile(project); -// assertTrue(success); -// builder.addServerConfig(config); - - - - // JNI + ///////////////////////////////////////////////////////////// + // CONFIG #1: 1 Local Site/Partition + ///////////////////////////////////////////////////////////// config = new LocalSingleProcessServer("testindexes-onesite.jar", 1, BackendTarget.NATIVE_EE_JNI); success = config.compile(project); assertTrue(success); builder.addServerConfig(config); - // CLUSTER? - config = new LocalCluster("testindexes-cluster.jar", 2, 2, - 1, BackendTarget.NATIVE_EE_JNI); + //////////////////////////////////////////////////////////// + // CONFIG #2: cluster of 2 nodes running 2 site each, one replica + //////////////////////////////////////////////////////////// + config = new LocalCluster("testindexes-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI); success = config.compile(project); assertTrue(success); builder.addServerConfig(config); diff --git a/tests/frontend/org/voltdb/regressionsuites/TestReplicationSuite.java b/tests/frontend/org/voltdb/regressionsuites/TestReplicationSuite.java index 846a8ebe6f..b0f1be9746 100644 --- a/tests/frontend/org/voltdb/regressionsuites/TestReplicationSuite.java +++ b/tests/frontend/org/voltdb/regressionsuites/TestReplicationSuite.java @@ -33,8 +33,10 @@ import org.voltdb.regressionsuites.replication.EvilDeterminism; import org.voltdb.regressionsuites.replication.SelectEmptyTable; -public class TestReplicationSuite extends RegressionSuite -{ +public class TestReplicationSuite extends RegressionSuite { + + private static final String PREFIX = "repl"; + /** Procedures used by this suite */ @SuppressWarnings("unchecked") public static final Class PROCEDURES[] = (Class[])new Class[] { @@ -137,31 +139,33 @@ static public junit.framework.Test suite() "UPDATE R1 SET R1.NUM = ?"); project.addProcedures(PROCEDURES); - + ///////////////////////////////////////////////////////////// // CLUSTER, two hosts, each with two sites, replication of 1 - config = new LocalCluster("replication-1-cluster.jar", 2, 2, - 1, BackendTarget.NATIVE_EE_JNI); - config.compile(project); - builder.addServerConfig(config); - - // CLUSTER, four hosts, each with three sites, replication of 2 - config = new LocalCluster("replication-2-cluster.jar", 3, 4, - 2, BackendTarget.NATIVE_EE_JNI); + ///////////////////////////////////////////////////////////// + config = new LocalCluster(PREFIX+"-1-cluster.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI); config.compile(project); builder.addServerConfig(config); - + + ///////////////////////////////////////////////////////////// // CLUSTER, 3 hosts, each with two sites, replication of 1 - config = new LocalCluster("replication-offset-cluster.jar", 2, 3, - 1, BackendTarget.NATIVE_EE_JNI); + ///////////////////////////////////////////////////////////// + config = new LocalCluster(PREFIX+"-offset-cluster.jar", 2, 3, 1, BackendTarget.NATIVE_EE_JNI); config.compile(project); builder.addServerConfig(config); - + + ///////////////////////////////////////////////////////////// // CLUSTER, 3 hosts, each with one site, replication of 1 - config = new LocalCluster("replication-odd-cluster.jar", 1, 3, - 1, BackendTarget.NATIVE_EE_JNI); + ///////////////////////////////////////////////////////////// + config = new LocalSingleProcessServer(PREFIX+"-odd-local.jar", 3, BackendTarget.NATIVE_EE_JNI); config.compile(project); builder.addServerConfig(config); + // CLUSTER, four hosts, each with three sites, replication of 2 +// config = new LocalCluster("replication-2-cluster.jar", 3, 4, +// 2, BackendTarget.NATIVE_EE_JNI); +// config.compile(project); +// builder.addServerConfig(config); + return builder; } }