You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/07/18 07:15:16 UTC

[GitHub] sijie closed pull request #1554: [table service] Fix Journal replay issue on range deletion

sijie closed pull request #1554: [table service] Fix Journal replay issue on range deletion
URL: https://github.com/apache/bookkeeper/pull/1554
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/MVCCStoreImpl.java b/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/MVCCStoreImpl.java
index e7f115067..fa595dc61 100644
--- a/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/MVCCStoreImpl.java
+++ b/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/MVCCStoreImpl.java
@@ -26,6 +26,7 @@
 import com.google.common.collect.Lists;
 import com.google.common.collect.PeekingIterator;
 import com.google.common.primitives.UnsignedBytes;
+import com.google.protobuf.TextFormat;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.PooledByteBufAllocator;
 import io.netty.buffer.Unpooled;
@@ -763,7 +764,8 @@ boolean processCompareOp(CompareOp<K, V> op) {
             record = getKeyRecord(key, rawKey);
             if (null == record) {
                 if (CompareTarget.VALUE != op.target()) {
-                    throw new MVCCStoreException(Code.KEY_NOT_FOUND, "Key " + key + " is not found");
+                    throw new MVCCStoreException(Code.KEY_NOT_FOUND,
+                        "Key '" + TextFormat.escapeBytes(rawKey) + "' is not found");
                 }
             }
             return processCompareOp(record, op);
diff --git a/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/op/proto/ProtoDeleteOpImpl.java b/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/op/proto/ProtoDeleteOpImpl.java
index 1f5f076dc..130d06cb4 100644
--- a/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/op/proto/ProtoDeleteOpImpl.java
+++ b/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/op/proto/ProtoDeleteOpImpl.java
@@ -80,7 +80,9 @@ private void setCommand(DeleteRangeRequest req) {
         if (null != endKey) {
             return endKey;
         }
-        if (null == req.getRangeEnd()) {
+        if (null == req.getRangeEnd()
+            || 0 == req.getRangeEnd().size()
+            || (1 == req.getRangeEnd().size() && req.getRangeEnd().byteAt(0) == 0)) {
             endKey = null;
         } else {
             endKey = req.getRangeEnd().toByteArray();
diff --git a/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/op/proto/ProtoRangeOpImpl.java b/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/op/proto/ProtoRangeOpImpl.java
index f7327526e..74a849b67 100644
--- a/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/op/proto/ProtoRangeOpImpl.java
+++ b/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/mvcc/op/proto/ProtoRangeOpImpl.java
@@ -91,12 +91,14 @@ public void close() {
         if (null != endKey) {
             return endKey;
         }
-        if (null == req.getRangeEnd()) {
-            key = null;
+        if (null == req.getRangeEnd()
+            || 0 == req.getRangeEnd().size()
+            || (1 == req.getRangeEnd().size() && req.getRangeEnd().byteAt(0) == 0)) {
+            endKey = null;
         } else {
-            key = req.getRangeEnd().toByteArray();
+            endKey = req.getRangeEnd().toByteArray();
         }
-        return key;
+        return endKey;
     }
 
     @Override


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services