From 5d4bcb92a9a8505d57cace0bc718e6f064189a07 Mon Sep 17 00:00:00 2001 From: Rana Alotaibi Date: Mon, 11 Dec 2023 20:48:35 -0800 Subject: [PATCH 01/19] Introduce session setup --- config/sqlserver/sample_tpch_config.xml | 2 ++ .../session_setup_sqlserver_cmds_example.sql | 3 ++ .../java/com/oltpbenchmark/DBWorkload.java | 2 ++ .../oltpbenchmark/WorkloadConfiguration.java | 11 ++++++ .../java/com/oltpbenchmark/api/Worker.java | 35 +++++++++++++++++++ 5 files changed, 53 insertions(+) create mode 100644 data/session-setup-files/session_setup_sqlserver_cmds_example.sql diff --git a/config/sqlserver/sample_tpch_config.xml b/config/sqlserver/sample_tpch_config.xml index 153ba83de..6f49887c0 100644 --- a/config/sqlserver/sample_tpch_config.xml +++ b/config/sqlserver/sample_tpch_config.xml @@ -10,6 +10,8 @@ true TRANSACTION_SERIALIZABLE 1024 + + 0.1 diff --git a/data/session-setup-files/session_setup_sqlserver_cmds_example.sql b/data/session-setup-files/session_setup_sqlserver_cmds_example.sql new file mode 100644 index 000000000..bee4d4633 --- /dev/null +++ b/data/session-setup-files/session_setup_sqlserver_cmds_example.sql @@ -0,0 +1,3 @@ +-- SQL Server Database Console Command statements (DBCC) +DBCC DROPCLEANBUFFERS -- clear buffers (for cold runs) +DBCC FREEPROCCACHE -- clean plan cache \ No newline at end of file diff --git a/src/main/java/com/oltpbenchmark/DBWorkload.java b/src/main/java/com/oltpbenchmark/DBWorkload.java index f4108c27e..7009ec53b 100644 --- a/src/main/java/com/oltpbenchmark/DBWorkload.java +++ b/src/main/java/com/oltpbenchmark/DBWorkload.java @@ -122,6 +122,7 @@ public static void main(String[] args) throws Exception { wrkld.setPassword(xmlConfig.getString("password")); wrkld.setRandomSeed(xmlConfig.getInt("randomSeed", -1)); wrkld.setBatchSize(xmlConfig.getInt("batchsize", 128)); + wrkld.setSessionSetupFile(xmlConfig.getString("sessionsetupfile")); wrkld.setMaxRetries(xmlConfig.getInt("retries", 3)); wrkld.setNewConnectionPerTxn(xmlConfig.getBoolean("newConnectionPerTxn", false)); wrkld.setReconnectOnConnectionFailure( @@ -172,6 +173,7 @@ public static void main(String[] args) throws Exception { initDebug.put("URL", wrkld.getUrl()); initDebug.put("Isolation", wrkld.getIsolationString()); initDebug.put("Batch Size", wrkld.getBatchSize()); + initDebug.put("Session Setup File", wrkld.getSessionSetupFile()); initDebug.put("Scale Factor", wrkld.getScaleFactor()); initDebug.put("Terminals", wrkld.getTerminals()); initDebug.put("New Connection Per Txn", wrkld.getNewConnectionPerTxn()); diff --git a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java index abf327004..f66b36a72 100644 --- a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java +++ b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java @@ -35,6 +35,7 @@ public class WorkloadConfiguration { private String password; private String driverClass; private int batchSize; + private String sessionSetupFile; private int maxRetries; private int randomSeed = -1; private double scaleFactor = 1.0; @@ -121,6 +122,14 @@ public void setBatchSize(int batchSize) { this.batchSize = batchSize; } + public String getSessionSetupFile(){ + return sessionSetupFile; + } + + public void setSessionSetupFile(String sessionSetupFile){ + this.sessionSetupFile = sessionSetupFile; + } + public int getMaxRetries() { return maxRetries; } @@ -389,6 +398,8 @@ public String toString() { + '\'' + ", batchSize=" + batchSize + + ", sessionSetupFile=" + + sessionSetupFile + ", maxRetries=" + maxRetries + ", scaleFactor=" diff --git a/src/main/java/com/oltpbenchmark/api/Worker.java b/src/main/java/com/oltpbenchmark/api/Worker.java index 3cac3882d..b6408d29a 100644 --- a/src/main/java/com/oltpbenchmark/api/Worker.java +++ b/src/main/java/com/oltpbenchmark/api/Worker.java @@ -26,6 +26,9 @@ import com.oltpbenchmark.types.TransactionStatus; import com.oltpbenchmark.util.Histogram; import com.oltpbenchmark.util.SQLUtil; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.sql.Connection; import java.sql.SQLException; import java.sql.SQLRecoverableException; @@ -188,6 +191,13 @@ public final void run() { // In case of reuse reset the measurements latencies = new LatencyRecord(workloadState.getTestStartNs()); + // Invoke setup session + try { + this.setupSession(); + } catch (Throwable ex) { + throw new RuntimeException("Unexpected error when setting up the session " + this, ex); + } + // Invoke initialize callback try { this.initialize(); @@ -723,6 +733,31 @@ protected void initialize() { // The default is to do nothing } + /** + * Set up the session by running a set of statements before benchmark execution begins. + * The path of the file where a set of statements defined should be added + * in <sessionsetupfile> </sessionsetupfile> + */ + protected void setupSession() { + try { + String setupSessionFile = configuration.getSessionSetupFile(); + if (setupSessionFile == null || setupSessionFile.isEmpty()) { + return; + } + + String statements = new String(Files.readAllBytes(Paths.get(setupSessionFile))); + if (statements.isEmpty()) { + return; + } + + try (Statement stmt = conn.createStatement()) { + stmt.execute(statements); + } + } catch (SQLException | IOException ex) { + throw new RuntimeException("Failed setting up session", ex); + } + } + /** * Invoke a single transaction for the given TransactionType * From ed730c6397e04cfef17bd2b3922f8d0c4f95e189 Mon Sep 17 00:00:00 2001 From: Rana Alotaibi Date: Tue, 2 Jan 2024 16:19:07 -0800 Subject: [PATCH 02/19] Fix format --- src/main/java/com/oltpbenchmark/api/Worker.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/api/Worker.java b/src/main/java/com/oltpbenchmark/api/Worker.java index b6408d29a..6a5d3b4cd 100644 --- a/src/main/java/com/oltpbenchmark/api/Worker.java +++ b/src/main/java/com/oltpbenchmark/api/Worker.java @@ -734,9 +734,9 @@ protected void initialize() { } /** - * Set up the session by running a set of statements before benchmark execution begins. - * The path of the file where a set of statements defined should be added - * in <sessionsetupfile> </sessionsetupfile> + * Set up the session by running a set of statements before benchmark execution begins. The path + * of the file where a set of statements defined should be added in <sessionsetupfile> + * </sessionsetupfile> */ protected void setupSession() { try { From 3086786214d42e57e21a7797eaaa1f9a0c96cf63 Mon Sep 17 00:00:00 2001 From: Rana Alotaibi Date: Tue, 2 Jan 2024 17:56:50 -0800 Subject: [PATCH 03/19] Move session setup file to the DB's config directory. --- config/sqlserver/sample_tpch_config.xml | 2 +- .../sqlserver}/session_setup_sqlserver_cmds_example.sql | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {data/session-setup-files => config/sqlserver}/session_setup_sqlserver_cmds_example.sql (100%) diff --git a/config/sqlserver/sample_tpch_config.xml b/config/sqlserver/sample_tpch_config.xml index 6f49887c0..2cefff63b 100644 --- a/config/sqlserver/sample_tpch_config.xml +++ b/config/sqlserver/sample_tpch_config.xml @@ -11,7 +11,7 @@ TRANSACTION_SERIALIZABLE 1024 - + 0.1 diff --git a/data/session-setup-files/session_setup_sqlserver_cmds_example.sql b/config/sqlserver/session_setup_sqlserver_cmds_example.sql similarity index 100% rename from data/session-setup-files/session_setup_sqlserver_cmds_example.sql rename to config/sqlserver/session_setup_sqlserver_cmds_example.sql From b4fbac06be29b3812d4e66795246b2ee87e93014 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Thu, 13 Feb 2025 21:12:06 +0000 Subject: [PATCH 04/19] reformat --- src/main/java/com/oltpbenchmark/WorkloadConfiguration.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java index 3e49f8cf7..f320caeaf 100644 --- a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java +++ b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java @@ -121,11 +121,11 @@ public void setBatchSize(int batchSize) { this.batchSize = batchSize; } - public String getSessionSetupFile(){ + public String getSessionSetupFile() { return sessionSetupFile; } - public void setSessionSetupFile(String sessionSetupFile){ + public void setSessionSetupFile(String sessionSetupFile) { this.sessionSetupFile = sessionSetupFile; } From 216c0dd2dd84c1e43246afb239f2726474ecc66f Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Thu, 13 Feb 2025 21:14:18 +0000 Subject: [PATCH 05/19] enable a test during CI --- config/sqlserver/sample_noop_config.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/sqlserver/sample_noop_config.xml b/config/sqlserver/sample_noop_config.xml index 53cfc54f0..8db7cd4bb 100644 --- a/config/sqlserver/sample_noop_config.xml +++ b/config/sqlserver/sample_noop_config.xml @@ -11,6 +11,10 @@ TRANSACTION_SERIALIZABLE 128 + + + config/sqlserver/session_setup_sqlserver_cmds_example.sql + 1 From 64a592f78362be9b54083d368284e4e187a109ae Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Thu, 13 Feb 2025 21:26:24 +0000 Subject: [PATCH 06/19] add checks for file existence early in the config parsing rather than failing later at runtime --- .../oltpbenchmark/WorkloadConfiguration.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java index f320caeaf..52cd23ca4 100644 --- a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java +++ b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java @@ -17,7 +17,10 @@ import com.oltpbenchmark.api.TransactionTypes; import com.oltpbenchmark.types.DatabaseType; +import com.oltpbenchmark.util.FileUtil; import com.oltpbenchmark.util.ThreadUtil; + +import java.io.FileNotFoundException; import java.sql.Connection; import java.util.ArrayList; import java.util.List; @@ -125,8 +128,21 @@ public String getSessionSetupFile() { return sessionSetupFile; } - public void setSessionSetupFile(String sessionSetupFile) { - this.sessionSetupFile = sessionSetupFile; + private String checkPath(String path, String name) throws FileNotFoundException { + if (path == null) return null; + path = path.trim(); + if (path.isEmpty()) return null; + assert path != null && !path.isEmpty(); + + if (FileUtil.exists(path)) { + return path; + } else { + throw new FileNotFoundException(name + " not found:" + sessionSetupFile); + } + } + + public void setSessionSetupFile(String sessionSetupFile) throws FileNotFoundException{ + this.sessionSetupFile = checkPath(sessionSetupFile, "sessionsetupfile"); } public int getMaxRetries() { @@ -301,8 +317,8 @@ public String getDDLPath() { } /** Set the path in which we can find the ddl script. */ - public void setDDLPath(String ddlPath) { - this.ddlPath = ddlPath; + public void setDDLPath(String ddlPath) throws FileNotFoundException { + this.ddlPath = checkPath(ddlPath, "ddlpath"); } /** A utility method that init the phaseIterator and dialectMap */ From a4e1ca4a541dcdadbfe5ff1820b52b69b6f92b9f Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Thu, 13 Feb 2025 23:00:27 +0000 Subject: [PATCH 07/19] wip: adding unit tests for session setup file --- .../oltpbenchmark/WorkloadConfiguration.java | 3 +- .../resources/benchmarks/noop/ddl-generic.sql | 3 ++ .../oltpbenchmark/api/AbstractTestCase.java | 16 +++++++ .../oltpbenchmark/api/AbstractTestLoader.java | 3 +- .../oltpbenchmark/api/AbstractTestWorker.java | 6 ++- .../benchmarks/noop/TestNoOpLoader.java | 2 +- .../benchmarks/noop/TestNoOpWorker.java | 44 +++++++++++++++++++ 7 files changed, 71 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java index 52cd23ca4..d8da805a1 100644 --- a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java +++ b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java @@ -19,7 +19,6 @@ import com.oltpbenchmark.types.DatabaseType; import com.oltpbenchmark.util.FileUtil; import com.oltpbenchmark.util.ThreadUtil; - import java.io.FileNotFoundException; import java.sql.Connection; import java.util.ArrayList; @@ -141,7 +140,7 @@ private String checkPath(String path, String name) throws FileNotFoundException } } - public void setSessionSetupFile(String sessionSetupFile) throws FileNotFoundException{ + public void setSessionSetupFile(String sessionSetupFile) throws FileNotFoundException { this.sessionSetupFile = checkPath(sessionSetupFile, "sessionsetupfile"); } diff --git a/src/main/resources/benchmarks/noop/ddl-generic.sql b/src/main/resources/benchmarks/noop/ddl-generic.sql index d5d7a476f..c610a7fea 100644 --- a/src/main/resources/benchmarks/noop/ddl-generic.sql +++ b/src/main/resources/benchmarks/noop/ddl-generic.sql @@ -1,4 +1,7 @@ DROP TABLE IF EXISTS FAKE; CREATE TABLE FAKE ( ID INT PRIMARY KEY +); +CREATE TABLE FAKE2 ( + ID INT ); \ No newline at end of file diff --git a/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java b/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java index 37e42ebfa..3003656e2 100644 --- a/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java +++ b/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java @@ -68,6 +68,7 @@ public abstract class AbstractTestCase { protected final boolean createDatabase; protected final boolean loadDatabase; protected final String ddlOverridePath; + protected final String sessionSetupFile; private static final AtomicInteger portCounter = new AtomicInteger(9001); private static final int MAX_PORT_NUMBER = 65535; @@ -77,6 +78,7 @@ public AbstractTestCase(boolean createDatabase, boolean loadDatabase) { this.createDatabase = createDatabase; this.loadDatabase = loadDatabase; this.ddlOverridePath = null; + this.sessionSetupFile = null; } public AbstractTestCase(boolean createDatabase, boolean loadDatabase, String ddlOverridePath) { @@ -84,6 +86,19 @@ public AbstractTestCase(boolean createDatabase, boolean loadDatabase, String ddl this.createDatabase = createDatabase; this.loadDatabase = loadDatabase; this.ddlOverridePath = ddlOverridePath; + this.sessionSetupFile = ddlOverridePath; + } + + public AbstractTestCase( + boolean createDatabase, + boolean loadDatabase, + String ddlOverridePath, + String sessionSetupFile) { + this.benchmark = null; + this.createDatabase = createDatabase; + this.loadDatabase = loadDatabase; + this.ddlOverridePath = ddlOverridePath; + this.sessionSetupFile = sessionSetupFile; } public abstract List> procedures(); @@ -127,6 +142,7 @@ public final void setUp() throws Exception { this.workConf.setBenchmarkName( BenchmarkModule.convertBenchmarkClassToBenchmarkName(benchmarkClass())); this.workConf.setDDLPath(this.ddlOverridePath); + this.workConf.setSessionSetupFile(this.sessionSetupFile); customWorkloadConfiguration(this.workConf); diff --git a/src/test/java/com/oltpbenchmark/api/AbstractTestLoader.java b/src/test/java/com/oltpbenchmark/api/AbstractTestLoader.java index 72b6ad7f8..de242d662 100644 --- a/src/test/java/com/oltpbenchmark/api/AbstractTestLoader.java +++ b/src/test/java/com/oltpbenchmark/api/AbstractTestLoader.java @@ -17,7 +17,6 @@ package com.oltpbenchmark.api; import static org.junit.Assert.*; -import static org.junit.Assert.fail; import com.oltpbenchmark.catalog.Table; import com.oltpbenchmark.util.Histogram; @@ -53,6 +52,8 @@ public void testLoad() throws Exception { validateLoad(); } + // TODO: add another version of this test that uses external files (#600). + /** testLoad with after load script */ @Test public void testLoadWithAfterLoad() throws Exception { diff --git a/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java b/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java index e96ecf333..2f937f20f 100644 --- a/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java +++ b/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java @@ -67,12 +67,14 @@ public void testGetProcedure() { } } - /** testExecuteWork */ + /* testExecuteWork + * Similar to Worker.run() + */ @Test public void testExecuteWork() throws Exception { - Worker w = workers.get(0); assertNotNull(w); + w.setupSession(); w.initialize(); assertFalse(this.conn.isReadOnly()); for (TransactionType txnType : this.workConf.getTransTypes()) { diff --git a/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpLoader.java b/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpLoader.java index 9498e3d4c..39306fd93 100644 --- a/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpLoader.java +++ b/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpLoader.java @@ -34,6 +34,6 @@ public Class benchmarkClass() { @Override public List ignorableTables() { - return List.of("FAKE"); + return List.of("FAKE", "FAKE2"); } } diff --git a/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorker.java b/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorker.java index c03339f20..b0c9bce1e 100644 --- a/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorker.java +++ b/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorker.java @@ -16,9 +16,21 @@ package com.oltpbenchmark.benchmarks.noop; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + import com.oltpbenchmark.api.AbstractTestWorker; +import com.oltpbenchmark.api.BenchmarkModule; import com.oltpbenchmark.api.Procedure; +import com.oltpbenchmark.api.Worker; +import com.oltpbenchmark.catalog.Table; +import com.oltpbenchmark.util.SQLUtil; +import java.sql.ResultSet; +import java.sql.Statement; import java.util.List; +import org.junit.Test; public class TestNoOpWorker extends AbstractTestWorker { @@ -31,4 +43,36 @@ public List> procedures() { public Class benchmarkClass() { return NoOpBenchmark.class; } + + // TODO: Do the same for another test, but this time with a sessionSetupFile + // specified that inserts rows as a dummy operation we can check for. + + @Test + public void testNoSessionSetupFile() throws Exception { + // Check that there is no session setup file assigned to the worker's config + assertNull("Session setup file should be null", this.workConf.getSessionSetupFile()); + + List> workers = this.benchmark.makeWorkers(); + Worker worker = workers.get(0); + assertNull( + "Session setup file should be null", + worker.getWorkloadConfiguration().getSessionSetupFile()); + + // Make sure there are no rows in the table + this.testExecuteWork(); + + Table catalog_tbl = this.catalog.getTable("FAKE2"); + String sql = SQLUtil.getCountSQL(this.workConf.getDatabaseType(), catalog_tbl); + try (Statement stmt = conn.createStatement(); + ResultSet result = stmt.executeQuery(sql); ) { + + assertNotNull(result); + + boolean adv = result.next(); + assertTrue(sql, adv); + + int count = result.getInt(1); + assertEquals(0, count); + } + } } From 83002e61de2cb24d07798a0337656bcbe2dc8a0f Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 00:20:22 +0000 Subject: [PATCH 08/19] add test for session setup script --- .../java/com/oltpbenchmark/api/Worker.java | 1 + .../resources/benchmarks/noop/ddl-generic.sql | 1 + .../oltpbenchmark/api/AbstractTestCase.java | 2 +- .../oltpbenchmark/api/AbstractTestWorker.java | 4 + .../benchmarks/noop/TestNoOpWorker.java | 3 - .../TestNoOpWorkerWithSessionSetupFile.java | 82 +++++++++++++++++++ .../noop/sessionSetupFile-hsqldb.sql | 3 + 7 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorkerWithSessionSetupFile.java create mode 100644 src/test/resources/benchmarks/noop/sessionSetupFile-hsqldb.sql diff --git a/src/main/java/com/oltpbenchmark/api/Worker.java b/src/main/java/com/oltpbenchmark/api/Worker.java index 6a5d3b4cd..e50cbcea6 100644 --- a/src/main/java/com/oltpbenchmark/api/Worker.java +++ b/src/main/java/com/oltpbenchmark/api/Worker.java @@ -753,6 +753,7 @@ protected void setupSession() { try (Statement stmt = conn.createStatement()) { stmt.execute(statements); } + // conn.commit(); } catch (SQLException | IOException ex) { throw new RuntimeException("Failed setting up session", ex); } diff --git a/src/main/resources/benchmarks/noop/ddl-generic.sql b/src/main/resources/benchmarks/noop/ddl-generic.sql index c610a7fea..e738f3201 100644 --- a/src/main/resources/benchmarks/noop/ddl-generic.sql +++ b/src/main/resources/benchmarks/noop/ddl-generic.sql @@ -2,6 +2,7 @@ DROP TABLE IF EXISTS FAKE; CREATE TABLE FAKE ( ID INT PRIMARY KEY ); +DROP TABLE IF EXISTS FAKE2; CREATE TABLE FAKE2 ( ID INT ); \ No newline at end of file diff --git a/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java b/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java index 3003656e2..37593ac59 100644 --- a/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java +++ b/src/test/java/com/oltpbenchmark/api/AbstractTestCase.java @@ -86,7 +86,7 @@ public AbstractTestCase(boolean createDatabase, boolean loadDatabase, String ddl this.createDatabase = createDatabase; this.loadDatabase = loadDatabase; this.ddlOverridePath = ddlOverridePath; - this.sessionSetupFile = ddlOverridePath; + this.sessionSetupFile = null; } public AbstractTestCase( diff --git a/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java b/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java index 2f937f20f..9983be67e 100644 --- a/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java +++ b/src/test/java/com/oltpbenchmark/api/AbstractTestWorker.java @@ -41,6 +41,10 @@ public AbstractTestWorker(String ddlOverridePath) { super(true, true, ddlOverridePath); } + public AbstractTestWorker(String ddlOverridePath, String sessionSetupFile) { + super(true, true, ddlOverridePath, sessionSetupFile); + } + @Override public List ignorableTables() { return null; diff --git a/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorker.java b/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorker.java index b0c9bce1e..a43c1cb68 100644 --- a/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorker.java +++ b/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorker.java @@ -44,9 +44,6 @@ public Class benchmarkClass() { return NoOpBenchmark.class; } - // TODO: Do the same for another test, but this time with a sessionSetupFile - // specified that inserts rows as a dummy operation we can check for. - @Test public void testNoSessionSetupFile() throws Exception { // Check that there is no session setup file assigned to the worker's config diff --git a/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorkerWithSessionSetupFile.java b/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorkerWithSessionSetupFile.java new file mode 100644 index 000000000..8ddd71f9a --- /dev/null +++ b/src/test/java/com/oltpbenchmark/benchmarks/noop/TestNoOpWorkerWithSessionSetupFile.java @@ -0,0 +1,82 @@ +/* + * Copyright 2016 by OLTPBenchmark Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.oltpbenchmark.benchmarks.noop; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import com.oltpbenchmark.api.AbstractTestWorker; +import com.oltpbenchmark.api.BenchmarkModule; +import com.oltpbenchmark.api.Procedure; +import com.oltpbenchmark.api.Worker; +import com.oltpbenchmark.catalog.Table; +import com.oltpbenchmark.util.SQLUtil; +import java.nio.file.Paths; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.List; +import org.junit.Test; + +public class TestNoOpWorkerWithSessionSetupFile extends AbstractTestWorker { + + public TestNoOpWorkerWithSessionSetupFile() { + super( + null, + Paths.get("src", "test", "resources", "benchmarks", "noop", "sessionSetupFile-hsqldb.sql") + .toAbsolutePath() + .toString()); + } + + @Override + public List> procedures() { + return TestNoOpBenchmark.PROCEDURE_CLASSES; + } + + @Override + public Class benchmarkClass() { + return NoOpBenchmark.class; + } + + @Test + public void testSessionSetupFile() throws Exception { + // Check that there is no session setup file assigned to the worker's config + assertNotNull("Session setup file should not be null", this.workConf.getSessionSetupFile()); + + List> workers = this.benchmark.makeWorkers(); + Worker worker = workers.get(0); + assertNotNull( + "Session setup file should not be null", + worker.getWorkloadConfiguration().getSessionSetupFile()); + + // Make sure there are no rows in the table + this.testExecuteWork(); + + Table catalog_tbl = this.catalog.getTable("FAKE2"); + String sql = SQLUtil.getCountSQL(this.workConf.getDatabaseType(), catalog_tbl); + try (Statement stmt = conn.createStatement(); + ResultSet result = stmt.executeQuery(sql); ) { + + assertNotNull(result); + + boolean adv = result.next(); + assertTrue(sql, adv); + + int count = result.getInt(1); + assertTrue("FAKE2 table should have more 0 rows.", count > 0); + } + } +} diff --git a/src/test/resources/benchmarks/noop/sessionSetupFile-hsqldb.sql b/src/test/resources/benchmarks/noop/sessionSetupFile-hsqldb.sql new file mode 100644 index 000000000..78a516e89 --- /dev/null +++ b/src/test/resources/benchmarks/noop/sessionSetupFile-hsqldb.sql @@ -0,0 +1,3 @@ +-- Dummy session setup file for HSQLDB +INSERT INTO FAKE2 (ID) VALUES (1); +COMMIT; \ No newline at end of file From e1477d05dfc7cabfb235c987e33185fb23e47bf8 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 16:22:54 +0000 Subject: [PATCH 09/19] Grant additional rights for dbcc commands --- .github/workflows/maven.yml | 2 +- config/sqlserver/session_setup_sqlserver_cmds_example.sql | 1 + docker/sqlserver-latest/up.sh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 98cedbb35..a5370e48d 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -687,7 +687,7 @@ jobs: uses: docker://mcr.microsoft.com/mssql-tools:latest with: entrypoint: /opt/mssql-tools/bin/sqlcmd - args: -U sa -P SApassword1 -S sqlserver -b -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01';" + args: -U sa -P SApassword1 -S sqlserver -b -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01'; GRANT ALTER SERVER STATE to 'benchuser01';" - name: Run benchmark # Note: user/pass should match those used in sample configs. diff --git a/config/sqlserver/session_setup_sqlserver_cmds_example.sql b/config/sqlserver/session_setup_sqlserver_cmds_example.sql index bee4d4633..c52504ad2 100644 --- a/config/sqlserver/session_setup_sqlserver_cmds_example.sql +++ b/config/sqlserver/session_setup_sqlserver_cmds_example.sql @@ -1,3 +1,4 @@ -- SQL Server Database Console Command statements (DBCC) +-- NOTE: Requires "ALTER SERVER STATE" permission DBCC DROPCLEANBUFFERS -- clear buffers (for cold runs) DBCC FREEPROCCACHE -- clean plan cache \ No newline at end of file diff --git a/docker/sqlserver-latest/up.sh b/docker/sqlserver-latest/up.sh index 77c98c3ab..30bceab82 100755 --- a/docker/sqlserver-latest/up.sh +++ b/docker/sqlserver-latest/up.sh @@ -37,4 +37,4 @@ run_sqlcmd_in_docker -Q "CREATE DATABASE benchbase;" run_sqlcmd_in_docker -Q "CREATE LOGIN benchuser01 WITH PASSWORD='P@ssw0rd';" || true # Setup access -run_sqlcmd_in_docker -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01';" || true +run_sqlcmd_in_docker -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01'; GRANT ALTER SERVER STATE TO 'benchuser01';" || true From 3cad8bdefe2f1d2e5240f0f9facf124a98815822 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 16:24:22 +0000 Subject: [PATCH 10/19] Also fix the performance monitoring permissions --- .github/workflows/maven.yml | 2 +- docker/sqlserver-latest/up.sh | 2 +- .../api/collectors/monitoring/SQLServerMonitor.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index a5370e48d..695cf109a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -687,7 +687,7 @@ jobs: uses: docker://mcr.microsoft.com/mssql-tools:latest with: entrypoint: /opt/mssql-tools/bin/sqlcmd - args: -U sa -P SApassword1 -S sqlserver -b -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01'; GRANT ALTER SERVER STATE to 'benchuser01';" + args: -U sa -P SApassword1 -S sqlserver -b -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01'; GRANT ALTER SERVER STATE, VIEW SERVER PERFORMANCE STATE to 'benchuser01';" - name: Run benchmark # Note: user/pass should match those used in sample configs. diff --git a/docker/sqlserver-latest/up.sh b/docker/sqlserver-latest/up.sh index 30bceab82..a1c54c665 100755 --- a/docker/sqlserver-latest/up.sh +++ b/docker/sqlserver-latest/up.sh @@ -37,4 +37,4 @@ run_sqlcmd_in_docker -Q "CREATE DATABASE benchbase;" run_sqlcmd_in_docker -Q "CREATE LOGIN benchuser01 WITH PASSWORD='P@ssw0rd';" || true # Setup access -run_sqlcmd_in_docker -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01'; GRANT ALTER SERVER STATE TO 'benchuser01';" || true +run_sqlcmd_in_docker -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01'; GRANT ALTER SERVER STATE, VIEW SERVER PERFORMANCE STATE TO 'benchuser01';" || true diff --git a/src/main/java/com/oltpbenchmark/api/collectors/monitoring/SQLServerMonitor.java b/src/main/java/com/oltpbenchmark/api/collectors/monitoring/SQLServerMonitor.java index d3d9143f1..515ed36ef 100644 --- a/src/main/java/com/oltpbenchmark/api/collectors/monitoring/SQLServerMonitor.java +++ b/src/main/java/com/oltpbenchmark/api/collectors/monitoring/SQLServerMonitor.java @@ -22,6 +22,7 @@ /** * Implementation of a monitor specific to SQLServer. Uses SQLServer's system tables to extract * relevant query and system information. + * Note: Requires "VIEW SERVER PERFORMANCE STATE" permissions. */ public class SQLServerMonitor extends DatabaseMonitor { From 3591ccd89ecd954c721630a8bcc7ecf87fbfbded Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 16:31:32 +0000 Subject: [PATCH 11/19] format --- .../api/collectors/monitoring/SQLServerMonitor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/api/collectors/monitoring/SQLServerMonitor.java b/src/main/java/com/oltpbenchmark/api/collectors/monitoring/SQLServerMonitor.java index 515ed36ef..fbff7b81b 100644 --- a/src/main/java/com/oltpbenchmark/api/collectors/monitoring/SQLServerMonitor.java +++ b/src/main/java/com/oltpbenchmark/api/collectors/monitoring/SQLServerMonitor.java @@ -21,8 +21,8 @@ /** * Implementation of a monitor specific to SQLServer. Uses SQLServer's system tables to extract - * relevant query and system information. - * Note: Requires "VIEW SERVER PERFORMANCE STATE" permissions. + * relevant query and system information. Note: Requires "VIEW SERVER PERFORMANCE STATE" + * permissions. */ public class SQLServerMonitor extends DatabaseMonitor { From e3334079edfcba72c6c73a4cf416158aea682824 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 18:05:56 +0000 Subject: [PATCH 12/19] tweaks --- .github/workflows/maven.yml | 9 ++++++++- docker/sqlserver-latest/up.sh | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 695cf109a..96feff39b 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -687,7 +687,14 @@ jobs: uses: docker://mcr.microsoft.com/mssql-tools:latest with: entrypoint: /opt/mssql-tools/bin/sqlcmd - args: -U sa -P SApassword1 -S sqlserver -b -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01'; GRANT ALTER SERVER STATE, VIEW SERVER PERFORMANCE STATE to 'benchuser01';" + args: -U sa -P SApassword1 -S sqlserver -b -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01';" + + - name: Setup privileged access for monitoring and session start tests + uses: docker://mcr.microsoft.com/mssql-tools:latest + with: + entrypoint: /opt/mssql-tools/bin/sqlcmd + args: -U sa -P SApassword1 -S sqlserver -b -Q "USE master; GRANT ALTER SERVER STATE, VIEW SERVER PERFORMANCE STATE to benchuser01;" + - name: Run benchmark # Note: user/pass should match those used in sample configs. diff --git a/docker/sqlserver-latest/up.sh b/docker/sqlserver-latest/up.sh index a1c54c665..dbb7cbe15 100755 --- a/docker/sqlserver-latest/up.sh +++ b/docker/sqlserver-latest/up.sh @@ -37,4 +37,7 @@ run_sqlcmd_in_docker -Q "CREATE DATABASE benchbase;" run_sqlcmd_in_docker -Q "CREATE LOGIN benchuser01 WITH PASSWORD='P@ssw0rd';" || true # Setup access -run_sqlcmd_in_docker -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01'; GRANT ALTER SERVER STATE, VIEW SERVER PERFORMANCE STATE TO 'benchuser01';" || true +run_sqlcmd_in_docker -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01';" || true + +# Setup privileged access for monitoring and session start tests +run_sqlcmd_in_docker -Q "USE master; GRANT ALTER SERVER STATE, VIEW SERVER PERFORMANCE STATE TO benchuser01;" || true From f41d4ba241bc1c4a40cbacba8e7e022cc7436c85 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 18:24:22 +0000 Subject: [PATCH 13/19] fixups --- .github/workflows/maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 96feff39b..2d0f0b048 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -538,7 +538,7 @@ jobs: ./scripts/check_histogram_results.sh results/histograms.json $ERRORS_THRESHOLD # Running the monitor should create at least three files in the 'monitor' directory. - if ![ $(find "./results/monitor" -maxdepth 1 -mindepth 1 | wc -l) -gt 2]; then + if ! [ $(find "./results/monitor" -maxdepth 1 -mindepth 1 | wc -l) -gt 2 ]; then echo "ERROR: Advanced monitoring unsuccessful, file directory and/or appropriate files not created." >&2 exit 1 fi @@ -728,7 +728,7 @@ jobs: ./scripts/check_histogram_results.sh results/histograms.json $ERRORS_THRESHOLD # Running the monitor should create at least three files in the 'monitor' directory. - if ![ $(find "./results/monitor" -maxdepth 1 -mindepth 1 | wc -l) -gt 2]; then + if ! [ $(find "./results/monitor" -maxdepth 1 -mindepth 1 | wc -l) -gt 2 ]; then echo "ERROR: Advanced monitoring unsuccessful, file directory and/or appropriate files not created." >&2 exit 1 fi From ac25e614250bb443bb9984b9a7eae942a6558174 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 18:52:01 +0000 Subject: [PATCH 14/19] Revert "fixups" - move to separate PR This reverts commit f41d4ba241bc1c4a40cbacba8e7e022cc7436c85. --- .github/workflows/maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2d0f0b048..96feff39b 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -538,7 +538,7 @@ jobs: ./scripts/check_histogram_results.sh results/histograms.json $ERRORS_THRESHOLD # Running the monitor should create at least three files in the 'monitor' directory. - if ! [ $(find "./results/monitor" -maxdepth 1 -mindepth 1 | wc -l) -gt 2 ]; then + if ![ $(find "./results/monitor" -maxdepth 1 -mindepth 1 | wc -l) -gt 2]; then echo "ERROR: Advanced monitoring unsuccessful, file directory and/or appropriate files not created." >&2 exit 1 fi @@ -728,7 +728,7 @@ jobs: ./scripts/check_histogram_results.sh results/histograms.json $ERRORS_THRESHOLD # Running the monitor should create at least three files in the 'monitor' directory. - if ! [ $(find "./results/monitor" -maxdepth 1 -mindepth 1 | wc -l) -gt 2 ]; then + if ![ $(find "./results/monitor" -maxdepth 1 -mindepth 1 | wc -l) -gt 2]; then echo "ERROR: Advanced monitoring unsuccessful, file directory and/or appropriate files not created." >&2 exit 1 fi From 4dc073fa32937dc23ea72403508fd08c58f8f9d9 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 19:02:30 +0000 Subject: [PATCH 15/19] log some more details --- src/main/java/com/oltpbenchmark/DBWorkload.java | 3 +++ src/main/java/com/oltpbenchmark/api/BenchmarkModule.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/com/oltpbenchmark/DBWorkload.java b/src/main/java/com/oltpbenchmark/DBWorkload.java index f8122da96..11ab05ca0 100644 --- a/src/main/java/com/oltpbenchmark/DBWorkload.java +++ b/src/main/java/com/oltpbenchmark/DBWorkload.java @@ -197,6 +197,8 @@ public static void main(String[] args) throws Exception { initDebug.put("URL", wrkld.getUrl()); initDebug.put("Isolation", wrkld.getIsolationString()); initDebug.put("Batch Size", wrkld.getBatchSize()); + initDebug.put("DDL Path", wrkld.getDDLPath()); + initDebug.put("Loader Threads", wrkld.getLoaderThreads()); initDebug.put("Session Setup File", wrkld.getSessionSetupFile()); initDebug.put("Scale Factor", wrkld.getScaleFactor()); initDebug.put("Terminals", wrkld.getTerminals()); @@ -249,6 +251,7 @@ public static void main(String[] args) throws Exception { if (xmlConfig.containsKey("afterload")) { bench.setAfterLoadScriptPath(xmlConfig.getString("afterload")); } + initDebug.put("After Load Script", bench.getAfterLoadScriptPath()); TransactionType tmpType = bench.initTransactionType( diff --git a/src/main/java/com/oltpbenchmark/api/BenchmarkModule.java b/src/main/java/com/oltpbenchmark/api/BenchmarkModule.java index 989d6eb9a..193151ccb 100644 --- a/src/main/java/com/oltpbenchmark/api/BenchmarkModule.java +++ b/src/main/java/com/oltpbenchmark/api/BenchmarkModule.java @@ -93,6 +93,10 @@ public final void setAfterLoadScriptPath(String scriptPath) { this.afterLoadScriptPath = scriptPath; } + public String getAfterLoadScriptPath() { + return this.afterLoadScriptPath; + } + // -------------------------------------------------------------------------- // IMPLEMENTING CLASS INTERFACE // -------------------------------------------------------------------------- From 202294eb267dd83fb5a8cdd652037ffe1a05c97f Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 19:04:01 +0000 Subject: [PATCH 16/19] refactor --- .../oltpbenchmark/WorkloadConfiguration.java | 17 ++--------------- .../java/com/oltpbenchmark/util/FileUtil.java | 13 +++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java index d8da805a1..b3f439add 100644 --- a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java +++ b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java @@ -127,21 +127,8 @@ public String getSessionSetupFile() { return sessionSetupFile; } - private String checkPath(String path, String name) throws FileNotFoundException { - if (path == null) return null; - path = path.trim(); - if (path.isEmpty()) return null; - assert path != null && !path.isEmpty(); - - if (FileUtil.exists(path)) { - return path; - } else { - throw new FileNotFoundException(name + " not found:" + sessionSetupFile); - } - } - public void setSessionSetupFile(String sessionSetupFile) throws FileNotFoundException { - this.sessionSetupFile = checkPath(sessionSetupFile, "sessionsetupfile"); + this.sessionSetupFile = FileUtil.checkPath(sessionSetupFile, "sessionsetupfile"); } public int getMaxRetries() { @@ -317,7 +304,7 @@ public String getDDLPath() { /** Set the path in which we can find the ddl script. */ public void setDDLPath(String ddlPath) throws FileNotFoundException { - this.ddlPath = checkPath(ddlPath, "ddlpath"); + this.ddlPath = FileUtil.checkPath(ddlPath, "ddlpath"); } /** A utility method that init the phaseIterator and dialectMap */ diff --git a/src/main/java/com/oltpbenchmark/util/FileUtil.java b/src/main/java/com/oltpbenchmark/util/FileUtil.java index aa4c4eabd..aa0206ebb 100644 --- a/src/main/java/com/oltpbenchmark/util/FileUtil.java +++ b/src/main/java/com/oltpbenchmark/util/FileUtil.java @@ -18,6 +18,7 @@ package com.oltpbenchmark.util; import java.io.File; +import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.util.regex.Pattern; @@ -83,6 +84,18 @@ public static boolean exists(String path) { return (new File(path).exists()); } + public static String checkPath(String path, String name) throws FileNotFoundException { + if (path != null) + path = path.trim(); + if (path == null || path.isEmpty()) + return null; + + if (!FileUtil.exists(path)) { + throw new FileNotFoundException(name + " not found:" + path); + } + return path; + } + /** * Create any directory in the list paths if it doesn't exist * From 5ec00f2083db57ca0ed23be41e816a287d58884e Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 19:04:20 +0000 Subject: [PATCH 17/19] reformat --- src/main/java/com/oltpbenchmark/util/FileUtil.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/util/FileUtil.java b/src/main/java/com/oltpbenchmark/util/FileUtil.java index aa0206ebb..13c47fa53 100644 --- a/src/main/java/com/oltpbenchmark/util/FileUtil.java +++ b/src/main/java/com/oltpbenchmark/util/FileUtil.java @@ -85,10 +85,8 @@ public static boolean exists(String path) { } public static String checkPath(String path, String name) throws FileNotFoundException { - if (path != null) - path = path.trim(); - if (path == null || path.isEmpty()) - return null; + if (path != null) path = path.trim(); + if (path == null || path.isEmpty()) return null; if (!FileUtil.exists(path)) { throw new FileNotFoundException(name + " not found:" + path); From dbec7570e54143c53c03a07abb7058620d01e2d8 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 19:12:30 +0000 Subject: [PATCH 18/19] more logging improvements --- src/main/java/com/oltpbenchmark/WorkloadConfiguration.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java index b3f439add..5914eb6f5 100644 --- a/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java +++ b/src/main/java/com/oltpbenchmark/WorkloadConfiguration.java @@ -405,8 +405,14 @@ public String toString() { + ", driverClass='" + driverClass + '\'' + + ", reconnectOnFailure=" + + reconnectOnConnectionFailure + + ", newConnectionPerTxn=" + + newConnectionPerTxn + ", batchSize=" + batchSize + + ", ddlpath=" + + ddlPath + ", sessionSetupFile=" + sessionSetupFile + ", maxRetries=" From 4cd2c5113af70f249ca151558c47fc2e5b21d1b1 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 14 Feb 2025 19:14:33 +0000 Subject: [PATCH 19/19] comment --- src/test/java/com/oltpbenchmark/api/AbstractTestLoader.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/java/com/oltpbenchmark/api/AbstractTestLoader.java b/src/test/java/com/oltpbenchmark/api/AbstractTestLoader.java index de242d662..83f8e88a8 100644 --- a/src/test/java/com/oltpbenchmark/api/AbstractTestLoader.java +++ b/src/test/java/com/oltpbenchmark/api/AbstractTestLoader.java @@ -52,8 +52,6 @@ public void testLoad() throws Exception { validateLoad(); } - // TODO: add another version of this test that uses external files (#600). - /** testLoad with after load script */ @Test public void testLoadWithAfterLoad() throws Exception {