You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by eo...@apache.org on 2017/07/25 09:04:41 UTC
[bookkeeper] branch master updated: BOOKKEEPER-1044: Entrylogger is
not readding rolled logs back to the logChannelsToFlush list when exception
happens while trying to flush rolled logs
This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 24ac8ea BOOKKEEPER-1044: Entrylogger is not readding rolled logs back to the logChannelsToFlush list when exception happens while trying to flush rolled logs
24ac8ea is described below
commit 24ac8ead6240aaaaa845afccb4e606fbe0da1602
Author: Sijie Guo <si...@apache.org>
AuthorDate: Tue Jul 25 11:04:36 2017 +0200
BOOKKEEPER-1044: Entrylogger is not readding rolled logs back to the logChannelsToFlush list when exception happens while trying to flush rolled logs
Descriptions of the changes in this PR:
This is a straightforward fix to add unflushed list of entry log files back to flushed list.
Test is missing at this point because it is a bit complicated to test this without proper mocking. I would defer adding the test later and creating a github issue later on if it makes sense.
Author: Sijie Guo <si...@apache.org>
Reviewers: Enrico Olivelli <eo...@apache.org>
This closes #286 from sijie/BOOKKEEPER-1044
---
.../org/apache/bookkeeper/bookie/EntryLogger.java | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
index 418b7e0..d277b2b 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
@@ -724,8 +724,24 @@ public class EntryLogger {
if (null == channels) {
return;
}
- for (BufferedLogChannel channel : channels) {
- channel.flush(true);
+ Iterator<BufferedLogChannel> chIter = channels.iterator();
+ while (chIter.hasNext()) {
+ BufferedLogChannel channel = chIter.next();
+ try {
+ channel.flush(true);
+ } catch (IOException ioe) {
+ // rescue from flush exception, add unflushed channels back
+ synchronized (this) {
+ if (null == logChannelsToFlush) {
+ logChannelsToFlush = channels;
+ } else {
+ logChannelsToFlush.addAll(0, channels);
+ }
+ }
+ throw ioe;
+ }
+ // remove the channel from the list after it is successfully flushed
+ chIter.remove();
// since this channel is only used for writing, after flushing the channel,
// we had to close the underlying file channel. Otherwise, we might end up
// leaking fds which cause the disk spaces could not be reclaimed.
--
To stop receiving notification emails like this one, please contact
['"commits@bookkeeper.apache.org" <co...@bookkeeper.apache.org>'].