Skip to content

Commit

Permalink
- config yaml for pg.
Browse files Browse the repository at this point in the history
- changes to datasource object url
  • Loading branch information
Sonal Agarwal committed Jul 2, 2024
1 parent 578a9f0 commit c7ad039
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
56 changes: 56 additions & 0 deletions config/workload_all_pg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0"?>
<parameters>
<dbtype>postgres</dbtype>
<driver>org.postgresql.Driver</driver>
<port>5432</port>
<username>postgres</username>
<DBName>postgres</DBName>
<password>Password321</password>
<isolation>TRANSACTION_REPEATABLE_READ</isolation>

<sslCert></sslCert>
<sslKey></sslKey>
<jdbcURL></jdbcURL>

<batchSize>128</batchSize>
<useKeyingTime>true</useKeyingTime>
<useThinkTime>true</useThinkTime>
<enableForeignKeysAfterLoad>true</enableForeignKeysAfterLoad>
<hikariConnectionTimeoutMs>180000</hikariConnectionTimeoutMs>
<useStoredProcedures>true</useStoredProcedures>
<displayEnhancedLatencyMetrics>false</displayEnhancedLatencyMetrics>
<trackPerSQLStmtLatencies>false</trackPerSQLStmtLatencies>

<transactiontypes>
<transaction>
<name>NewOrder</name>
<weight>45</weight>
</transaction>
<transaction>
<name>Payment</name>
<weight>43</weight>
</transaction>
<transaction>
<name>OrderStatus</name>
<weight>4</weight>
</transaction>
<transaction>
<name>Delivery</name>
<weight>4</weight>
</transaction>
<transaction>
<name>StockLevel</name>
<weight>4</weight>
</transaction>
</transactiontypes>

<runtime>1800</runtime>
<rate>10000</rate>
<!--
Set the number of retries to 0 as retrying when the number of warehouses is
high is pointless as it just leads to more failures.
-->
<maxRetriesPerTransaction>2</maxRetriesPerTransaction>
<maxLoaderRetries>2</maxLoaderRetries>

</parameters>
8 changes: 7 additions & 1 deletion src/com/oltpbenchmark/api/BenchmarkModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,17 @@ public final Connection makeConnection() throws SQLException {
}

int r = dataSourceCounter.getAndIncrement() % workConf.getNodes().size();
String url_db = "";
if(workConf.getDBName()=="yugabyte")
url_db = "yugabytedb";
else if(workConf.getDBName()=="postgres")
url_db = "postgresql";
String connectStr;
if (workConf.getJdbcURL() != null && workConf.getJdbcURL().length()>0) {
connectStr=workConf.getJdbcURL();
} else {
connectStr = String.format("jdbc:yugabytedb://%s:%d/%s",
connectStr = String.format("jdbc:%s://%s:%d/%s",
workConf.getDBName(),
workConf.getNodes().get(r),
workConf.getPort(),
workConf.getDBName());
Expand Down

0 comments on commit c7ad039

Please sign in to comment.