diff --git a/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java b/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java index d8fe38843a..89eb7d2500 100644 --- a/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java +++ b/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java @@ -286,7 +286,7 @@ public final Status insert(final String table, final String key, batchedWriteCount += 1; if (batchedWriteCount < batchSize) { - return Status.OK; + return OptionsSupport.BATCHED_OK; } long count = collection.write(batchedWrite); diff --git a/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java b/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java index e0654aa2fa..1db8f0e1cf 100644 --- a/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java +++ b/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java @@ -56,7 +56,7 @@ import java.util.concurrent.atomic.AtomicInteger; /** - * MongoDB asynchronous client for YCSB framework using the MongoDB Inc. driver *

* See the README.md for configuration information. @@ -285,6 +285,8 @@ public Status insert(String table, String key, collection.insertMany(bulkInserts, INSERT_UNORDERED); } bulkInserts.clear(); + } else { + return OptionsSupport.BATCHED_OK; } } return Status.OK; diff --git a/mongodb/src/main/java/com/yahoo/ycsb/db/OptionsSupport.java b/mongodb/src/main/java/com/yahoo/ycsb/db/OptionsSupport.java index 62092a0d10..c8aacd464f 100644 --- a/mongodb/src/main/java/com/yahoo/ycsb/db/OptionsSupport.java +++ b/mongodb/src/main/java/com/yahoo/ycsb/db/OptionsSupport.java @@ -18,6 +18,8 @@ import java.util.Properties; +import com.yahoo.ycsb.Status; + /** * OptionsSupport provides methods for handling legacy options. * @@ -25,6 +27,13 @@ */ 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. */ private static final String UNAVAILABLE = "n/a";