[GitHub] [pulsar] jerrypeng commented on a change in pull request #5322: Fix bk write failure part 2

2019-10-07 Thread GitBox
jerrypeng commented on a change in pull request #5322: Fix bk write failure 
part 2
URL: https://github.com/apache/pulsar/pull/5322#discussion_r332250591
 
 

 ##
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
 ##
 @@ -342,15 +345,13 @@ public void addComplete(Position pos, Object ctx) {
 
 @Override
 public synchronized void addFailed(ManagedLedgerException exception, 
Object ctx) {
-
-// fence topic when failed to write a message to BK
-isFenced = true;
-
 if (exception instanceof ManagedLedgerFencedException) {
 // If the managed ledger has been fenced, we cannot continue using 
it. We need to close and reopen
 close();
 } else {
 
+// fence topic when failed to write a message to BK
+isFenced = true;
 
 Review comment:
   @rdhabalia I add this set here in a previous PR part of a line of PRs to fix 
problems in message deduplication (#5218). Setting "isFenced = true;" there 
when the exception is ManagedLedgerFencedException is inappropriate because of 
this check in close():
   
   
https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java#L895
   
   There is already logic in the close() method to fence the topic


This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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] [pulsar] jerrypeng commented on a change in pull request #5322: Fix bk write failure part 2

2019-10-07 Thread GitBox
jerrypeng commented on a change in pull request #5322: Fix bk write failure 
part 2
URL: https://github.com/apache/pulsar/pull/5322#discussion_r332208797
 
 

 ##
 File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
 ##
 @@ -624,6 +617,12 @@ private synchronized void 
internalAsyncAddEntry(OpAddEntry addOperation) {
 }
 }
 
+@Override
+public void readyToCreateNewLedger() {
+   // only set transition state to ClosedLedger if current state is 
WriteFailed
+   STATE_UPDATER.compareAndSet(this, State.WriteFailed, 
State.ClosedLedger);
 
 Review comment:
   will add


This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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] [pulsar] jerrypeng commented on a change in pull request #5322: Fix bk write failure part 2

2019-10-05 Thread GitBox
jerrypeng commented on a change in pull request #5322: Fix bk write failure 
part 2
URL: https://github.com/apache/pulsar/pull/5322#discussion_r331771438
 
 

 ##
 File path: 
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerErrorsTest.java
 ##
 @@ -329,40 +329,6 @@ public void addComplete(Position position, Object ctx) {
 latch.await();
 }
 
-@Test
-public void recoverAfterWriteError() throws Exception {
 
 Review comment:
   @merlimat i have already modified the following test to use 
readToCreateNewLedger().  Take a look at:
   
https://github.com/apache/pulsar/pull/5322/files#diff-6e96907493eb92d48f2f448d6bbd3b44L413


This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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] [pulsar] jerrypeng commented on a change in pull request #5322: Fix bk write failure part 2

2019-10-05 Thread GitBox
jerrypeng commented on a change in pull request #5322: Fix bk write failure 
part 2
URL: https://github.com/apache/pulsar/pull/5322#discussion_r331766959
 
 

 ##
 File path: 
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
 ##
 @@ -1400,35 +1400,6 @@ public void discardEmptyLedgersOnClose() throws 
Exception {
 // writing ledger
 }
 
-@Test
-public void discardEmptyLedgersOnError() throws Exception {
 
 Review comment:
   same reason here


This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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] [pulsar] jerrypeng commented on a change in pull request #5322: Fix bk write failure part 2

2019-10-05 Thread GitBox
jerrypeng commented on a change in pull request #5322: Fix bk write failure 
part 2
URL: https://github.com/apache/pulsar/pull/5322#discussion_r331766951
 
 

 ##
 File path: 
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerErrorsTest.java
 ##
 @@ -329,40 +329,6 @@ public void addComplete(Position position, Object ctx) {
 latch.await();
 }
 
-@Test
-public void recoverAfterWriteError() throws Exception {
 
 Review comment:
   test not  relevant anymore since we are not going to automatically fail 
entries for a fix amount of time after a failure


This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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] [pulsar] jerrypeng commented on a change in pull request #5322: Fix bk write failure part 2

2019-10-05 Thread GitBox
jerrypeng commented on a change in pull request #5322: Fix bk write failure 
part 2
URL: https://github.com/apache/pulsar/pull/5322#discussion_r331766959
 
 

 ##
 File path: 
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
 ##
 @@ -1400,35 +1400,6 @@ public void discardEmptyLedgersOnClose() throws 
Exception {
 // writing ledger
 }
 
-@Test
-public void discardEmptyLedgersOnError() throws Exception {
 
 Review comment:
   same reason here


This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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] [pulsar] jerrypeng commented on a change in pull request #5322: Fix bk write failure part 2

2019-10-05 Thread GitBox
jerrypeng commented on a change in pull request #5322: Fix bk write failure 
part 2
URL: https://github.com/apache/pulsar/pull/5322#discussion_r331766935
 
 

 ##
 File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
 ##
 @@ -580,14 +585,6 @@ private synchronized void 
internalAsyncAddEntry(OpAddEntry addOperation) {
 log.debug("[{}] Queue addEntry request", name);
 }
 } else if (state == State.ClosedLedger) {
-long now = clock.millis();
-if (now < lastLedgerCreationFailureTimestamp + 
WaitTimeAfterLedgerCreationFailureMs) {
 
 Review comment:
   will do


This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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