rdhabalia opened a new pull request #13073:
URL: https://github.com/apache/pulsar/pull/13073


   ### Motivation
   we need the support of ledger roll-over for inactive topics to prevent 
data-loss. It happens when Inactive topics that do not have publish for a long 
time and the current ledger segment ensemble bookies are replaced by replicator 
when ensemble bookies went into maintenance mode. In this scenario, there is a 
chance of data loss and rolling over such ledgers prevents data loss.
   For example:
   1. In the beginning topic is writing to ledger `1000` with bookie `b1` and 
`b2`
   ```
   get /ledgers/00/0000/L1000
   BookieMetadataFormatVersion  2
   quorumSize: 2
   ensembleSize: 2
   length: 0
   lastEntryId: -1
   state: OPEN
   segment {
     ensembleMember: "b1:3181" -> prod5-bookie7.messaging.gq1.yahoo.com
     ensembleMember: "b2:3181" -> prod5-bookie3.messaging.gq1.yahoo.com
     firstEntryId: 0
   } 
   ```
   
   2. Then both bookie b1 and b2 went down and replicator replaced them with 
bookie b3 and b4
   ```
   get /ledgers/00/0000/L1000
   quorumSize: 2
   ensembleSize: 2
   length: 104
   lastEntryId: 1
   state: CLOSED
   segment {
     ensembleMember: "b3:3181"
     ensembleMember: "b4:3181"
     firstEntryId: 0
   }
   segment {
     ensembleMember: "b5:3181"
     ensembleMember: "b6:3181"
     firstEntryId: 1
   }
   ```
   3. after that bookie b1 and b2 came back again and topic received a publish. 
broker was able to reconnect to bookie b1, and b2 and continued to write to 
bookie b1 and b2
   ```
   Broker-DEBUG log:
   22:45:24.000 [bookkeeper-ml-workers-OrderedExecutor-6-0] DEBUG 
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl - 
[prop/us-west1/test/persistent/t1] Write into current ledger lh=291607 
entries=14
   # broker successfully connected to b1 and b2 and wrote new entry to b1 and b2
   
   22:36:38.949 [bookie-io-1-6] INFO  o.a.b.proto.BookieRequestHandler     - 
Channel connected  [id: 0x43c62e1c, L:/10.10.10.10:3181 - R:/b1:60908]
   22:36:38.950 [bookie-io-1-5] INFO  o.a.b.proto.BookieRequestHandler     - 
Channel connected  [id: 0x43c62e1c, L:/10.10.10.10:3181 - R:/b2:60908]
   ```
   4. So, according to zk ledger `1000` has one entry but the broker is kept 
writing to b1 and b2 bookies which can cause the data loss.
   
   [Bookie PR#2616](https://github.com/apache/bookkeeper/pull/2616) can be 
helpful in this scenario but rolling over inactive ledger helps to user who are 
doing bookie replacement/maintenance more frequent to avoid kind of data loss.
   
   ### Modification
   - added config `managedLedgerInActiveLedgerRolloverTimeMinutes` to enable 
rollover of inactive ledgers (by default it will be 0)
   
   ### Result
   this feature helps in case of inactive topics which write to replaced 
bookies during any maintenance and helps to avoid data-loss in that situation. 
   


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to