From 855e9158e3a7c8f45dbd0eba7cd168ab6cff37d3 Mon Sep 17 00:00:00 2001 From: Enis Soztutar <enis@apache.org> Date: Tue, 21 Jun 2016 13:55:28 -0700 Subject: [PATCH] [core,mongodb] Moved MongoDb BATCHED_OK Status to core, useful for other bindings as well --- core/src/main/java/com/yahoo/ycsb/Status.java | 2 +- .../main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java | 2 +- .../src/main/java/com/yahoo/ycsb/db/MongoDbClient.java | 2 +- .../src/main/java/com/yahoo/ycsb/db/OptionsSupport.java | 9 --------- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/com/yahoo/ycsb/Status.java b/core/src/main/java/com/yahoo/ycsb/Status.java index bc32b86c..5e5b3a88 100644 --- a/core/src/main/java/com/yahoo/ycsb/Status.java +++ b/core/src/main/java/com/yahoo/ycsb/Status.java @@ -87,6 +87,6 @@ public class Status { public static final Status BAD_REQUEST = new Status("BAD_REQUEST", "The request was not valid."); public static final Status FORBIDDEN = new Status("FORBIDDEN", "The operation is forbidden."); public static final Status SERVICE_UNAVAILABLE = new Status("SERVICE_UNAVAILABLE", "Dependant service for the current binding is not available."); - + public static final Status BATCHED_OK = new Status("BATCHED_OK", "The operation has been batched by the binding to be executed later."); } 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 89eb7d25..a50b915a 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 class AsyncMongoDbClient extends DB { batchedWriteCount += 1; if (batchedWriteCount < batchSize) { - return OptionsSupport.BATCHED_OK; + return Status.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 1db8f0e1..2b7cb114 100644 --- a/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java +++ b/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java @@ -286,7 +286,7 @@ public class MongoDbClient extends DB { } bulkInserts.clear(); } else { - return OptionsSupport.BATCHED_OK; + return Status.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 c8aacd46..62092a0d 100644 --- a/mongodb/src/main/java/com/yahoo/ycsb/db/OptionsSupport.java +++ b/mongodb/src/main/java/com/yahoo/ycsb/db/OptionsSupport.java @@ -18,8 +18,6 @@ package com.yahoo.ycsb.db; import java.util.Properties; -import com.yahoo.ycsb.Status; - /** * OptionsSupport provides methods for handling legacy options. * @@ -27,13 +25,6 @@ import com.yahoo.ycsb.Status; */ 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"; -- GitLab