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/04/22 06:05:16 UTC

[GitHub] jvrao commented on a change in pull request #1317: BP-14 Force Ledger Bookie side implementation

jvrao commented on a change in pull request #1317: BP-14 Force Ledger Bookie side implementation
URL: https://github.com/apache/bookkeeper/pull/1317#discussion_r183226381
 
 

 ##########
 File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LastAddForcedCursor.java
 ##########
 @@ -0,0 +1,145 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.bookkeeper.bookie;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+import com.google.common.annotations.VisibleForTesting;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import org.apache.bookkeeper.client.api.WriteAdvHandle;
+import org.apache.bookkeeper.proto.BookieProtocol;
+
+/**
+ * Handle the LastAddForced entryId. As entries do not arrive to the Journal in a known order we have to handle
+ * increments of this pointer. This is how it works: we keep a value for the current {@link #lastAddForced} entryId and
+ * a list of continuous ranges of ids which are known to have been persisted but are 'after' {@link #lastAddForced}.
+ * <p>
+ * Examples:
+ * <ul>
+ * <li>0, 1, 2, 3 we have maxAddForced = 3 (all entries from 0 to 3 are stored)</li>
+ * <li>0, 1, 3, 5 we have maxAddForced = 1 (all entries from 0 to 1 are stored, 2 and 4 are not stored)</li>
+ * <li>1, 2, 3 we have maxAddForced = -1 (not available, as 0 is missing, so there is an gap)</li>
 
 Review comment:
   There can never be contiguous entries in the bookie perspective if Ensemble Size > WQ

----------------------------------------------------------------
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