Skip to content

Commit

Permalink
Merge branch 'main' into mysql-advanced-monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bpkroth authored Feb 21, 2025
2 parents 80bef73 + c445a85 commit 7cbb2b4
Show file tree
Hide file tree
Showing 103 changed files with 1,607 additions and 1,256 deletions.
11 changes: 9 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@
"--env-file=.env"
],
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker": {},
"ghcr.io/stuartleeks/dev-container-features/shell-history": {}
"ghcr.io/devcontainers/features/docker-outside-of-docker": {
"moby": true,
"installDockerBuildx": true,
"installDockerComposeSwitch": true,
"version": "latest",
"dockerDashComposeVersion": "v2"
},
"ghcr.io/stuartleeks/dev-container-features/shell-history": {},
"ghcr.io/devcontainers/features/git": {}
},
"containerEnv": {
"http_proxy": "${localEnv:http_proxy}",
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:

env:
POM_VERSION: 2023-SNAPSHOT
JAVA_VERSION: 21
JAVA_VERSION: 23
ERRORS_THRESHOLD: 0.01
PYTHON_VERSION: "3.10"

Expand Down Expand Up @@ -61,6 +61,10 @@ jobs:
- name: Compile with Maven
run: mvn -B compile test-compile --file pom.xml

- name: Test exec plugin
run: |
mvn exec:java -P sqlite -Dexec.args="-b noop -c config/sqlite/sample_noop_config.xml --create=true --load=true --execute=true"
- name: Test with Maven
run: mvn -B test --file pom.xml

Expand Down Expand Up @@ -183,8 +187,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# FIXME: Add tpch back in (#333).
benchmark: [ 'auctionmark', 'chbenchmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'templated', 'tpcc', 'tpcc-with-reconnects', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
benchmark: [ 'auctionmark', 'chbenchmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'templated', 'tpcc', 'tpcc-with-reconnects', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
services:
mariadb: # https://hub.docker.com/_/mariadb
image: mariadb:latest
Expand Down Expand Up @@ -686,6 +689,13 @@ jobs:
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';"

- 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.
run: |
Expand Down
8 changes: 8 additions & 0 deletions config/mysql/sample_tpch_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
<!-- Control scale factor to generate different amount of data -->
<scalefactor>0.1</scalefactor>

<!--
The post load script is crucial for creating TPCH indices after loading the database.
Index creation was removed from the DDL script to speed up the load process.
Creating indices post load improves performance by nearly 30%.
See src/main/resources/benchmarks/tpch/postload-mysql.sql
-->
<afterload>/benchmarks/tpch/postload-mysql.sql</afterload>

<!-- The workload -->
<terminals>1</terminals>
<works>
Expand Down
4 changes: 4 additions & 0 deletions config/sqlserver/sample_noop_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<isolation>TRANSACTION_SERIALIZABLE</isolation>
<batchsize>128</batchsize>

<!-- Session setup statements file -->
<!-- uncommented here for CI pipeline testing -->
<sessionsetupfile>config/sqlserver/session_setup_sqlserver_cmds_example.sql</sessionsetupfile>

<!-- This parameter has no affect on this benchmark-->
<!-- There is no data to load -->
<scalefactor>1</scalefactor>
Expand Down
2 changes: 2 additions & 0 deletions config/sqlserver/sample_tpch_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<reconnectOnConnectionFailure>true</reconnectOnConnectionFailure>
<isolation>TRANSACTION_SERIALIZABLE</isolation>
<batchsize>1024</batchsize>
<!-- Session setup statements file -->
<!-- <sessionsetupfile>config/sqlserver/session_setup_sqlserver_cmds_example.sql</sessionsetupfile> -->

<scalefactor>0.1</scalefactor>

Expand Down
4 changes: 4 additions & 0 deletions config/sqlserver/session_setup_sqlserver_cmds_example.sql
Original file line number Diff line number Diff line change
@@ -0,0 +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
3 changes: 2 additions & 1 deletion docker/benchbase/devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# For the devcontainer we need a full JDK.
FROM maven:3-eclipse-temurin-21 AS devcontainer
FROM maven:3-eclipse-temurin-23 AS devcontainer

LABEL org.opencontainers.image.source = "https://github.com/cmu-db/benchbase/"

Expand All @@ -17,6 +17,7 @@ ARG CONTAINERUSER_GID=1000
RUN groupadd --non-unique --gid ${CONTAINERUSER_GID} containergroup \
&& useradd --non-unique --create-home --no-user-group --comment 'Container User' \
--uid ${CONTAINERUSER_UID} --gid ${CONTAINERUSER_GID} containeruser \
&& echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
&& echo 'containeruser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN mkdir -p /benchbase/results && chown -R containeruser:containergroup /benchbase/
USER containeruser
Expand Down
2 changes: 1 addition & 1 deletion docker/benchbase/fullimage/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TODO: Use a multi-stage build to build the fullimage from the devcontainer.

# Use a smaller base image that only has the jre, not the full jdk.
FROM eclipse-temurin:21-jre AS fullimage
FROM eclipse-temurin:23-jre AS fullimage

LABEL org.opencontainers.image.source = "https://github.com/cmu-db/benchbase/"

Expand Down
3 changes: 3 additions & 0 deletions docker/sqlserver-latest/up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ run_sqlcmd_in_docker -Q "CREATE LOGIN benchuser01 WITH PASSWORD='P@ssw0rd';" ||

# Setup access
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
38 changes: 19 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<java.version>23</java.version>
<maven.compiler.source>23</maven.compiler.source>
<maven.compiler.target>23</maven.compiler.target>
<buildDirectory>${project.basedir}/target</buildDirectory>
<!--
Provids a way to limit which assembly package formats we produce.
Expand Down Expand Up @@ -64,7 +64,7 @@
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.46.1.3</version>
<version>3.47.1.0</version>
</dependency>
</dependencies>
</profile>
Expand Down Expand Up @@ -125,7 +125,7 @@
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<version>23.5.0.24.07</version>
<version>23.6.0.24.10</version>
<scope>runtime</scope>
</dependency>
</dependencies>
Expand All @@ -145,7 +145,7 @@
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.4.1</version>
<version>3.5.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
Expand All @@ -165,7 +165,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-jdbc</artifactId>
<version>2.22.1</version>
<version>2.24.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -274,13 +274,13 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.17.0</version>
<version>2.18.0</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -319,7 +319,7 @@
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.7.3</version>
<version>2.7.4</version>
<scope>test</scope>
</dependency>

Expand All @@ -330,13 +330,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.immutables</groupId>
<artifactId>value</artifactId>
<version>2.10.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId>
Expand Down Expand Up @@ -365,7 +358,7 @@
<!-- format/check code via google style format -->
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.23</version>
<version>2.25</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -396,6 +389,13 @@
<!-- Turn all warnings into errors to help keep the code clean. -->
<arg>-Werror</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>org.immutables</groupId>
<artifactId>value</artifactId>
<version>2.10.1</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<!-- TODO: Use PMD to check for various code health things.plugin>
Expand Down Expand Up @@ -501,7 +501,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.0</version>
<version>3.8.1</version>
<executions>
<execution>
<id>analyze</id>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/oltpbenchmark/DBWorkload.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,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(
Expand Down Expand Up @@ -196,6 +197,9 @@ 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());
initDebug.put("New Connection Per Txn", wrkld.getNewConnectionPerTxn());
Expand Down Expand Up @@ -247,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(
Expand Down
23 changes: 21 additions & 2 deletions src/main/java/com/oltpbenchmark/WorkloadConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

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;
Expand All @@ -33,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;
Expand Down Expand Up @@ -120,6 +123,14 @@ public void setBatchSize(int batchSize) {
this.batchSize = batchSize;
}

public String getSessionSetupFile() {
return sessionSetupFile;
}

public void setSessionSetupFile(String sessionSetupFile) throws FileNotFoundException {
this.sessionSetupFile = FileUtil.checkPath(sessionSetupFile, "sessionsetupfile");
}

public int getMaxRetries() {
return maxRetries;
}
Expand Down Expand Up @@ -292,8 +303,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 = FileUtil.checkPath(ddlPath, "ddlpath");
}

/** A utility method that init the phaseIterator and dialectMap */
Expand Down Expand Up @@ -394,8 +405,16 @@ public String toString() {
+ ", driverClass='"
+ driverClass
+ '\''
+ ", reconnectOnFailure="
+ reconnectOnConnectionFailure
+ ", newConnectionPerTxn="
+ newConnectionPerTxn
+ ", batchSize="
+ batchSize
+ ", ddlpath="
+ ddlPath
+ ", sessionSetupFile="
+ sessionSetupFile
+ ", maxRetries="
+ maxRetries
+ ", scaleFactor="
Expand Down
Loading

0 comments on commit 7cbb2b4

Please sign in to comment.