Skip to content
Snippets Groups Projects
Commit 7438fd62 authored by Robert J. Moore's avatar Robert J. Moore
Browse files

[mongodb] Update to use BATCHED_OK Status for batched inserts.

This ensures that users do not confuse the results from batched
and non-batched operations.

Closes #522
parent 6032ff16
No related branches found
No related tags found
No related merge requests found
...@@ -286,7 +286,7 @@ public class AsyncMongoDbClient extends DB { ...@@ -286,7 +286,7 @@ public class AsyncMongoDbClient extends DB {
batchedWriteCount += 1; batchedWriteCount += 1;
if (batchedWriteCount < batchSize) { if (batchedWriteCount < batchSize) {
return Status.OK; return OptionsSupport.BATCHED_OK;
} }
long count = collection.write(batchedWrite); long count = collection.write(batchedWrite);
......
...@@ -56,7 +56,7 @@ import java.util.Vector; ...@@ -56,7 +56,7 @@ import java.util.Vector;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
/** /**
* MongoDB asynchronous client for YCSB framework using the MongoDB Inc. <a * MongoDB binding for YCSB framework using the MongoDB Inc. <a
* href="http://docs.mongodb.org/ecosystem/drivers/java/">driver</a> * href="http://docs.mongodb.org/ecosystem/drivers/java/">driver</a>
* <p> * <p>
* See the <code>README.md</code> for configuration information. * See the <code>README.md</code> for configuration information.
...@@ -285,6 +285,8 @@ public class MongoDbClient extends DB { ...@@ -285,6 +285,8 @@ public class MongoDbClient extends DB {
collection.insertMany(bulkInserts, INSERT_UNORDERED); collection.insertMany(bulkInserts, INSERT_UNORDERED);
} }
bulkInserts.clear(); bulkInserts.clear();
} else {
return OptionsSupport.BATCHED_OK;
} }
} }
return Status.OK; return Status.OK;
......
...@@ -18,6 +18,8 @@ package com.yahoo.ycsb.db; ...@@ -18,6 +18,8 @@ package com.yahoo.ycsb.db;
import java.util.Properties; import java.util.Properties;
import com.yahoo.ycsb.Status;
/** /**
* OptionsSupport provides methods for handling legacy options. * OptionsSupport provides methods for handling legacy options.
* *
...@@ -25,6 +27,13 @@ import java.util.Properties; ...@@ -25,6 +27,13 @@ import java.util.Properties;
*/ */
public final class OptionsSupport { public final class OptionsSupport {
/**
* Status used for operations that have not been send to the server and have
* only been batched by the client.
*/
public static final Status BATCHED_OK = new Status("BATCHED_OK",
"The operation has been batched by the binding.");
/** Value for an unavailable property. */ /** Value for an unavailable property. */
private static final String UNAVAILABLE = "n/a"; private static final String UNAVAILABLE = "n/a";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment