Skip to content

Commit

Permalink
working on issue cmu-db#128; adding exec plugin and fixing getClass m…
Browse files Browse the repository at this point in the history
…ethod (cmu-db#129)

* working on issue cmu-db#128; adding exec plugin and fixing getClass method

* updating readme

* cleaning up readme example
  • Loading branch information
timveil authored Mar 11, 2022
1 parent 6527e17 commit d388a5f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,28 @@ usage: benchbase
-s,--sample <arg> Sampling window
```

### How to Run with Maven

Instead of first building, packaging and extracting before running benchbase, it is possible to execute benchmarks directly against the source code using Maven. Once you have the project cloned you can run any benchmark from the root project directory using the Maven `exec:java` goal. For example, the following command executes the `tpcc` benchmark against `postgres`:

```
mvn clean compile exec:java -P postgres -Dexec.args="-b tpcc -c config/postgres/sample_tpcc_config.xml --create=true --load=true --execute=true"
```

this is equivalent to the steps above but eliminates the need to first package and then extract the distribution.

### How to Enable Logging

To enable logging, e.g., for the PostgreSQL JDBC driver, add the following JVM property when starting...

```
-Djava.util.logging.config.file=src/main/resources/logging.properties
```

To modify the logging level you can update [`logging.properties`](src/main/resources/logging.properties) and/or [`log4j.properties`](src/main/resources/log4j.properties).

### How to Release

```
./mvnw -B release:prepare
./mvnw -B release:perform
Expand Down
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,14 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<mainClass>com.oltpbenchmark.DBWorkload</mainClass>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
10 changes: 3 additions & 7 deletions src/main/java/com/oltpbenchmark/util/ClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,11 @@ public static <T> Constructor<T> getConstructor(Class<T> target_class, Class<?>.
* @return
*/
public static Class<?> getClass(String class_name) {
Class<?> target_class = null;
try {
ClassLoader loader = ClassLoader.getSystemClassLoader();
target_class = loader.loadClass(class_name);
} catch (Exception ex) {
throw new RuntimeException("Failed to retrieve class for " + class_name, ex);
return ClassUtils.getClass(class_name);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
return (target_class);

}

}

0 comments on commit d388a5f

Please sign in to comment.