reddycharan commented on a change in pull request #677: Issue 659: Fix
Checkpoint logic in SortedLedgerStorage
URL: https://github.com/apache/bookkeeper/pull/677#discussion_r153337234
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/SyncThread.java
##########
@@ -78,47 +76,43 @@ public SyncThread(ServerConfiguration conf,
.setNameFormat("SyncThread-" + conf.getBookiePort() + "-%d");
this.executor =
Executors.newSingleThreadScheduledExecutor(tfb.build());
flushInterval = conf.getFlushInterval();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Flush Interval : {}", flushInterval);
+ if (log.isDebugEnabled()) {
+ log.debug("Flush Interval : {}", flushInterval);
}
}
- void start() {
- executor.scheduleAtFixedRate(new Runnable() {
- public void run() {
- try {
- synchronized (suspensionLock) {
- while (suspended) {
- try {
- suspensionLock.wait();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- continue;
- }
+ @Override
+ public void startCheckpoint(Checkpoint checkpoint) {
+ executor.submit(() -> {
+ try {
+ synchronized (suspensionLock) {
+ while (suspended) {
+ try {
+ suspensionLock.wait();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ continue;
}
}
- if (!disableCheckpoint) {
- checkpoint(checkpointSource.newCheckpoint());
- }
- } catch (Throwable t) {
- LOG.error("Exception in SyncThread", t);
- dirsListener.fatalError();
}
+ if (!disableCheckpoint) {
+ checkpoint(checkpoint);
Review comment:
i think somewhere in the call hierarchy, there should be null check for this
'checkpoint' arg. and appropriate logic to handle it
for eg - EntryMemTable.snapshot can return 'null' for checkpoint
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services