eolivelli commented on a change in pull request #2742:
URL: https://github.com/apache/bookkeeper/pull/2742#discussion_r696798099
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/JournalChannel.java
##########
@@ -143,27 +149,37 @@
private JournalChannel(File journalDirectory, long logId,
long preAllocSize, int writeBufferSize, int
journalAlignSize,
long position, boolean fRemoveFromPageCache,
- int formatVersionToWrite,
Journal.BufferedChannelBuilder bcBuilder) throws IOException {
+ int formatVersionToWrite,
Journal.BufferedChannelBuilder bcBuilder,
+ ServerConfiguration configuration) throws
IOException {
this.journalAlignSize = journalAlignSize;
this.zeros = ByteBuffer.allocate(journalAlignSize);
this.preAllocSize = preAllocSize - preAllocSize % journalAlignSize;
this.fRemoveFromPageCache = fRemoveFromPageCache;
+ this.configuration = configuration;
+
File fn = new File(journalDirectory, Long.toHexString(logId) + ".txn");
+ try {
+ FileChannelProvider provider =
FileChannelProvider.newProvider(configuration.getJournalChannelProvider());
Review comment:
can't we instantiate the `FileChannelProvider` only once when the
`Journal` or the `Bookie` is started ?
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/JournalChannel.java
##########
@@ -143,27 +149,37 @@
private JournalChannel(File journalDirectory, long logId,
long preAllocSize, int writeBufferSize, int
journalAlignSize,
long position, boolean fRemoveFromPageCache,
- int formatVersionToWrite,
Journal.BufferedChannelBuilder bcBuilder) throws IOException {
+ int formatVersionToWrite,
Journal.BufferedChannelBuilder bcBuilder,
+ ServerConfiguration configuration) throws
IOException {
this.journalAlignSize = journalAlignSize;
this.zeros = ByteBuffer.allocate(journalAlignSize);
this.preAllocSize = preAllocSize - preAllocSize % journalAlignSize;
this.fRemoveFromPageCache = fRemoveFromPageCache;
+ this.configuration = configuration;
+
File fn = new File(journalDirectory, Long.toHexString(logId) + ".txn");
+ try {
+ FileChannelProvider provider =
FileChannelProvider.newProvider(configuration.getJournalChannelProvider());
Review comment:
we should keep a reference to this `FileChannelProvider` as a field
and call `provider.close()` when closing the `JournalChannel`
--
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]