Skip to content
This repository was archived by the owner on Aug 23, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions config/tpcc_config_monetdb.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0"?>
<parameters>

<!-- Connection details -->
<dbtype>MONETDB</dbtype>
<driver>nl.cwi.monetdb.jdbc.MonetDriver</driver>
<DBUrl>jdbc:monetdb://localhost:50000/tpcc</DBUrl>
<username></username>
<password></password>
<isolation>TRANSACTION_READ_COMMITTED</isolation>

<!-- Scale factor is the number of warehouses in TPCC -->
<scalefactor>1</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<works>
<work>
<time>300</time>
<rate>unlimited</rate>
<weights>45,43,4,4,4</weights>
</work>
</works>

<!-- TPCC specific -->
<transactiontypes>
<transactiontype>
<name>NewOrder</name>
</transactiontype>
<transactiontype>
<name>Payment</name>
</transactiontype>
<transactiontype>
<name>OrderStatus</name>
</transactiontype>
<transactiontype>
<name>Delivery</name>
</transactiontype>
<transactiontype>
<name>StockLevel</name>
</transactiontype>
</transactiontypes>
</parameters>
143 changes: 143 additions & 0 deletions config/tpch_config_monetdb.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?xml version="1.0"?>
<parameters>
<parameters>
<!-- Connection details -->
<dbtype>monetdb</dbtype>
<driver>nl.cwi.monetdb.jdbc.MonetDriver</driver>
<DBUrl>jdbc:monetdb://localhost:50000/tpch</DBUrl>
<username></username>
<password></password>
<isolation>TRANSACTION_READ_COMMITTED</isolation>

<!-- Location for the files generated by tpch dbgen -->
<datadir>data</datadir>

<!-- Format of the files that contain the tpch data -->
<!-- Values: csv or tbl-->
<fileFormat>tbl</fileFormat>

<!-- This setting doesn't do anything here -->
<scalefactor>1</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<works>
<work>
<serial>true</serial>
<rate>unlimited</rate>
<weights>all</weights>
</work>
<work>
<serial>true</serial>
<rate>unlimited</rate>
<weights>even</weights>
</work>
<work>
<serial>true</serial>
<rate>unlimited</rate>
<weights>odd</weights>
</work>
</works>

<transactiontypes>
<groupings>
<grouping>
<name>odd</name>
<weights>1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0</weights>
</grouping>
<grouping>
<name>even</name>
<weights>0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1</weights>
</grouping>
</groupings>

<transactiontype>
<name>Q1</name>
<id>1</id>
</transactiontype>
<transactiontype>
<name>Q2</name>
<id>2</id>
</transactiontype>
<transactiontype>
<name>Q3</name>
<id>3</id>
</transactiontype>
<transactiontype>
<name>Q4</name>
<id>4</id>
</transactiontype>
<transactiontype>
<name>Q5</name>
<id>5</id>
</transactiontype>
<transactiontype>
<name>Q6</name>
<id>6</id>
</transactiontype>
<transactiontype>
<name>Q7</name>
<id>7</id>
</transactiontype>
<transactiontype>
<name>Q8</name>
<id>8</id>
</transactiontype>
<transactiontype>
<name>Q9</name>
<id>9</id>
</transactiontype>
<transactiontype>
<name>Q10</name>
<id>10</id>
</transactiontype>
<transactiontype>
<name>Q11</name>
<id>11</id>
</transactiontype>
<transactiontype>
<name>Q12</name>
<id>12</id>
</transactiontype>
<transactiontype>
<name>Q13</name>
<id>13</id>
</transactiontype>
<transactiontype>
<name>Q14</name>
<id>14</id>
</transactiontype>
<transactiontype>
<name>Q15</name>
<id>15</id>
</transactiontype>
<transactiontype>
<name>Q16</name>
<id>16</id>
</transactiontype>
<transactiontype>
<name>Q17</name>
<id>17</id>
</transactiontype>
<transactiontype>
<name>Q18</name>
<id>18</id>
</transactiontype>
<transactiontype>
<name>Q19</name>
<id>19</id>
</transactiontype>
<transactiontype>
<name>Q20</name>
<id>20</id>
</transactiontype>
<transactiontype>
<name>Q21</name>
<id>21</id>
</transactiontype>
<transactiontype>
<name>Q22</name>
<id>22</id>
</transactiontype>
</transactiontypes>
</parameters>
48 changes: 48 additions & 0 deletions config/wikipedia_config_monetdb.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0"?>
<parameters>
<!-- Connection details -->
<dbtype>monetdb</dbtype>
<driver>nl.cwi.monetdb.jdbc.MonetDriver</driver>
<DBUrl>jdbc:monetdb://localhost:50000/wiki</DBUrl>
<username></username>
<password></password>

<isolation>TRANSACTION_SERIALIZABLE</isolation>

<!-- Scale factor is the number of wikipages *1000 -->
<scalefactor>1</scalefactor>

<!-- Wikipedia Trace Options -->
<tracefile>config/traces/wikipedia-100k.trace</tracefile>
<traceOut>10</traceOut>
<base_ip>10.1.</base_ip>

<!-- The workload -->
<terminals>1</terminals>
<works>
<work>
<time>300</time>
<rate>unlimited</rate>
<weights>0.07,7.7425,91.2656,0.9219</weights>
</work>
</works>

<!-- Wikipedia Procedures Declaration -->
<transactiontypes>
<transactiontype>
<name>AddWatchList</name>
</transactiontype>

<transactiontype>
<name>RemoveWatchList</name>
</transactiontype>

<transactiontype>
<name>GetPageAnonymous</name>
</transactiontype>

<transactiontype>
<name>GetPageAuthenticated</name>
</transactiontype>
</transactiontypes>
</parameters>
118 changes: 58 additions & 60 deletions src/com/oltpbenchmark/benchmarks/wikipedia/WikipediaLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ private void loadRevision() throws SQLException {
// Oracle handles quoted object identifiers differently, do not escape names
textSQL = SQLUtil.getInsertSQL(textTable, false);
}

PreparedStatement textInsert = this.conn.prepareStatement(textSQL);

// REVISION
Expand Down Expand Up @@ -452,66 +453,63 @@ private void loadRevision() throws SQLException {
int old_text_length = h_textLength.nextValue().intValue();
assert(old_text_length > 0);
char old_text[] = TextGenerator.randomChars(rng(), old_text_length);

for (int i = 0; i < num_revised; i++) {
// Generate the User who's doing the revision and the Page revised
// Makes sure that we always update their counter
int user_id = h_users.nextInt();
assert(user_id > 0 && user_id <= this.num_users) : "Invalid UserId '" + user_id + "'";
this.user_revision_ctr[user_id-1]++;

// Generate what the new revision is going to be
if (i > 0) {
old_text = b.generateRevisionText(old_text);
old_text_length = old_text.length;
}

int rev_comment_len = Math.min(rev_comment_max, h_commentLength.nextValue().intValue()+1); // HACK
String rev_comment = TextGenerator.randomStr(rng(), rev_comment_len);
assert(rev_comment.length() <= rev_comment_max) :
String.format("[len=%d] ==> %s", rev_comment.length(), rev_comment);

// The REV_USER_TEXT field is usually the username, but we'll just
// put in gibberish for now
String user_text = TextGenerator.randomStr(rng(), h_nameLength.nextValue().intValue()+1);

// Insert the text
int col = 1;
textInsert.setInt(col++, rev_id); // old_id
textInsert.setString(col++, new String(old_text)); // old_text
textInsert.setString(col++, "utf-8"); // old_flags
textInsert.setInt(col++, page_id); // old_page
textInsert.addBatch();

// Insert the revision
col = 1;
revisionInsert.setInt(col++, rev_id); // rev_id
revisionInsert.setInt(col++, page_id); // rev_page
revisionInsert.setInt(col++, rev_id); // rev_text_id
revisionInsert.setString(col++, rev_comment); // rev_comment
revisionInsert.setInt(col++, user_id); // rev_user
revisionInsert.setString(col++, user_text); // rev_user_text
revisionInsert.setString(col++, TimeUtil.getCurrentTimeString14()); // rev_timestamp
revisionInsert.setInt(col++, h_minorEdit.nextValue().intValue()); // rev_minor_edit
revisionInsert.setInt(col++, 0); // rev_deleted
revisionInsert.setInt(col++, 0); // rev_len
revisionInsert.setInt(col++, 0); // rev_parent_id
revisionInsert.addBatch();

// Update Last Revision Stuff
this.page_last_rev_id[page_id-1] = rev_id;
this.page_last_rev_length[page_id-1] = old_text_length;
rev_id++;
if (this.getDatabaseType() == DatabaseType.ORACLE) {
PreparedStatement text_seq=this.conn.prepareStatement("select text_seq.nextval from dual");
text_seq.execute();
text_seq.close();
PreparedStatement revision_seq=this.conn.prepareStatement("select revision_seq.nextval from dual");
revision_seq.execute();
revision_seq.close();
}
batchSize++;
} // FOR (revision)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What changed here? Is it just formatting? What parts are MonetDB specific?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We tried to remove the loop for num_revised, which effectively the same as setting num_revised=1 in all cases. We do this because we found otherwise duplicate tuples will be inserted and causing a primary key violation error. We suspect Monetdb may not have a good support for transaction, but we are not sure...

// Generate the User who's doing the revision and the Page revised
// Makes sure that we always update their counter
int user_id = h_users.nextInt();
assert(user_id > 0 && user_id <= this.num_users) : "Invalid UserId '" + user_id + "'";
this.user_revision_ctr[user_id-1]++;

// Generate what the new revision is going to be
old_text = b.generateRevisionText(old_text);
old_text_length = old_text.length;

int rev_comment_len = Math.min(rev_comment_max, h_commentLength.nextValue().intValue()+1); // HACK
String rev_comment = TextGenerator.randomStr(rng(), rev_comment_len);
assert(rev_comment.length() <= rev_comment_max) :
String.format("[len=%d] ==> %s", rev_comment.length(), rev_comment);

// The REV_USER_TEXT field is usually the username, but we'll just
// put in gibberish for now
String user_text = TextGenerator.randomStr(rng(), h_nameLength.nextValue().intValue()+1);

// Insert the text
int col = 1;
textInsert.setInt(col++, rev_id); // old_id
textInsert.setString(col++, new String(old_text)); // old_text
textInsert.setString(col++, "utf-8"); // old_flags
textInsert.setInt(col++, page_id); // old_page
textInsert.addBatch();

// Insert the revision
col = 1;
revisionInsert.setInt(col++, rev_id); // rev_id
revisionInsert.setInt(col++, page_id); // rev_page
revisionInsert.setInt(col++, rev_id); // rev_text_id
revisionInsert.setString(col++, rev_comment); // rev_comment
revisionInsert.setInt(col++, user_id); // rev_user
revisionInsert.setString(col++, user_text); // rev_user_text
revisionInsert.setString(col++, TimeUtil.getCurrentTimeString14()); // rev_timestamp
revisionInsert.setInt(col++, h_minorEdit.nextValue().intValue()); // rev_minor_edit
revisionInsert.setInt(col++, 0); // rev_deleted
revisionInsert.setInt(col++, 0); // rev_len
revisionInsert.setInt(col++, 0); // rev_parent_id
revisionInsert.addBatch();

// Update Last Revision Stuff
this.page_last_rev_id[page_id-1] = rev_id;
this.page_last_rev_length[page_id-1] = old_text_length;
rev_id++;
if (this.getDatabaseType() == DatabaseType.ORACLE) {
PreparedStatement text_seq=this.conn.prepareStatement("select text_seq.nextval from dual");
text_seq.execute();
text_seq.close();
PreparedStatement revision_seq=this.conn.prepareStatement("select revision_seq.nextval from dual");
revision_seq.execute();
revision_seq.close();
}
batchSize++;

if (batchSize > WikipediaConstants.BATCH_SIZE) {
textInsert.executeBatch();
revisionInsert.executeBatch();
Expand Down
Loading