jvrao commented on a change in pull request #1393: BP-14 forceLedger wire 
protocol server side implementation
URL: https://github.com/apache/bookkeeper/pull/1393#discussion_r186944703
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ForceLedgerProcessorV3.java
 ##########
 @@ -0,0 +1,137 @@
+/**
+ *
+ * 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.proto;
+
+import io.netty.channel.Channel;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.bookkeeper.net.BookieSocketAddress;
+import org.apache.bookkeeper.proto.BookkeeperProtocol.ForceLedgerRequest;
+import org.apache.bookkeeper.proto.BookkeeperProtocol.ForceLedgerResponse;
+import org.apache.bookkeeper.proto.BookkeeperProtocol.Request;
+import org.apache.bookkeeper.proto.BookkeeperProtocol.Response;
+import org.apache.bookkeeper.proto.BookkeeperProtocol.StatusCode;
+import org.apache.bookkeeper.util.MathUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+class ForceLedgerProcessorV3 extends PacketProcessorBaseV3 implements Runnable 
{
+    private static final Logger logger = 
LoggerFactory.getLogger(ForceLedgerProcessorV3.class);
+
+    public ForceLedgerProcessorV3(Request request, Channel channel,
+                             BookieRequestProcessor requestProcessor) {
+        super(request, channel, requestProcessor);
+    }
+
+    // Returns null if there is no exception thrown
+    private ForceLedgerResponse getForceLedgerResponse() {
+        final long startTimeNanos = MathUtils.nowInNano();
+        ForceLedgerRequest forceLedgerRequest = 
request.getForceLedgerRequest();
+        long ledgerId = forceLedgerRequest.getLedgerId();
+
+        final ForceLedgerResponse.Builder forceLedgerResponse = 
ForceLedgerResponse.newBuilder().setLedgerId(ledgerId);
+
+        if (!isVersionCompatible()) {
+            forceLedgerResponse.setStatus(StatusCode.EBADVERSION);
+            return forceLedgerResponse.build();
+        }
+
+        BookkeeperInternalCallbacks.WriteCallback wcb = new 
BookkeeperInternalCallbacks.WriteCallback() {
+            @Override
+            public void writeComplete(int rc, long ledgerId, long entryId,
+                                      BookieSocketAddress addr, Object ctx) {
 
 Review comment:
   I said ASSERT. i.e bring down the bookie as it is an indication something 
seriously went wrong. At least add a comment about entryId.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to