[GitHub] sijie commented on a change in pull request #1140: Issue 1139: Add debug to replication fencing

2018-02-14 Thread GitBox
sijie commented on a change in pull request #1140: Issue 1139: Add debug to 
replication fencing
URL: https://github.com/apache/bookkeeper/pull/1140#discussion_r168245303
 
 

 ##
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java
 ##
 @@ -364,40 +368,52 @@ private void deferLedgerLockRelease(final long ledgerId) 
{
 TimerTask timerTask = new TimerTask() {
 @Override
 public void run() {
+boolean isRecoveryOpen = false;
 LedgerHandle lh = null;
 try {
 lh = admin.openLedgerNoRecovery(ledgerId);
 if (isLastSegmentOpenAndMissingBookies(lh)) {
+// Need recovery open, close the old ledger handle.
+lh.close();
+// Recovery open could result in client write failure.
+LOG.warn("Missing bookie(s) from last segment. Opening 
Ledger{} for Recovery.", ledgerId);
 lh = admin.openLedger(ledgerId);
+isRecoveryOpen = true;
 }
-
-Set fragments = 
getUnderreplicatedFragments(lh);
-for (LedgerFragment fragment : fragments) {
-if (!fragment.isClosed()) {
-lh = admin.openLedger(ledgerId);
-break;
+if (!isRecoveryOpen){
 
 Review comment:
   @jvrao I see.
   
   to make things a bit clear here, it might be good to move line 384 to 395 to 
a function call "hasOpenUnderreplicatedFragements(LedgerHandle lh)`.
   
   and change the if else here to be:
   
   ```
   if (isLastSegmentOpenAndMissingBookies(lh) || 
hasOpenUnderreplicatedFragments(lh)) {
 lh.close();
 lh = admin.openLedger(ledgerId);
 isRecoveryOpen = true;
   }
   ```
   
   not a blocker though.


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


[GitHub] sijie commented on a change in pull request #1140: Issue 1139: Add debug to replication fencing

2018-02-11 Thread GitBox
sijie commented on a change in pull request #1140: Issue 1139: Add debug to 
replication fencing
URL: https://github.com/apache/bookkeeper/pull/1140#discussion_r167468366
 
 

 ##
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java
 ##
 @@ -364,40 +368,52 @@ private void deferLedgerLockRelease(final long ledgerId) 
{
 TimerTask timerTask = new TimerTask() {
 @Override
 public void run() {
+boolean isRecoveryOpen = false;
 LedgerHandle lh = null;
 try {
 lh = admin.openLedgerNoRecovery(ledgerId);
 if (isLastSegmentOpenAndMissingBookies(lh)) {
+// Need recovery open, close the old ledger handle.
+lh.close();
+// Recovery open could result in client write failure.
+LOG.warn("Missing bookie(s) from last segment. Opening 
Ledger{} for Recovery.", ledgerId);
 lh = admin.openLedger(ledgerId);
+isRecoveryOpen = true;
 }
-
-Set fragments = 
getUnderreplicatedFragments(lh);
-for (LedgerFragment fragment : fragments) {
-if (!fragment.isClosed()) {
-lh = admin.openLedger(ledgerId);
-break;
+if (!isRecoveryOpen){
 
 Review comment:
   hmm, it seems this logic is changed, no?


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