From 275806bd7e6e2f7dd50e4cf178064e35970a89c5 Mon Sep 17 00:00:00 2001
From: Michael Nitschinger <michael@nitschinger.at>
Date: Mon, 4 Jul 2016 07:22:01 +0200
Subject: [PATCH] [couchbase] Fix regression on key selection for scan all.

This fixes a regression introduced by switching over to the raw
workload where the key looks different now. The code trims and
removes the " " so that only the proper key is passed for retrieval.
---
 .../java/com/yahoo/ycsb/db/couchbase2/Couchbase2Client.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/couchbase2/src/main/java/com/yahoo/ycsb/db/couchbase2/Couchbase2Client.java b/couchbase2/src/main/java/com/yahoo/ycsb/db/couchbase2/Couchbase2Client.java
index be38888f..dc600011 100644
--- a/couchbase2/src/main/java/com/yahoo/ycsb/db/couchbase2/Couchbase2Client.java
+++ b/couchbase2/src/main/java/com/yahoo/ycsb/db/couchbase2/Couchbase2Client.java
@@ -608,7 +608,6 @@ public class Couchbase2Client extends DB {
   private Status scanAllFields(final String table, final String startkey, final int recordcount,
       final Vector<HashMap<String, ByteIterator>> result) {
     final List<HashMap<String, ByteIterator>> data = new ArrayList<HashMap<String, ByteIterator>>(recordcount);
-
     bucket.async()
         .query(N1qlQuery.parameterized(
           scanAllQuery,
@@ -633,7 +632,8 @@ public class Couchbase2Client extends DB {
         .flatMap(new Func1<AsyncN1qlQueryRow, Observable<RawJsonDocument>>() {
           @Override
           public Observable<RawJsonDocument> call(AsyncN1qlQueryRow row) {
-            return bucket.async().get(new String(row.byteValue()), RawJsonDocument.class);
+            String id = new String(row.byteValue()).trim();
+            return bucket.async().get(id.substring(1, id.length()-1), RawJsonDocument.class);
           }
         })
         .map(new Func1<RawJsonDocument, HashMap<String, ByteIterator>>() {
-- 
GitLab