-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expose write buffer manager memory usage methods through Java Api #8194
Open
benoitmeriaux
wants to merge
5
commits into
facebook:main
Choose a base branch
from
benoitmeriaux:expose-write-buffer-manager-memory-usages-jni
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2b23ee2
expose write buffer manager method through Java Api
benoitmeriaux c4e81c2
fix build and expose write buffer manager constructor without cache
benoitmeriaux 0b91081
fix build
benoitmeriaux bc93e3b
add test
benoitmeriaux e99a655
fix build multiple constructor
benoitmeriaux File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
java/src/test/java/org/rocksdb/WriteBufferManagerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. | ||
// This source code is licensed under both the GPLv2 (found in the | ||
// COPYING file in the root directory) and Apache 2.0 License | ||
// (found in the LICENSE.Apache file in the root directory). | ||
|
||
package org.rocksdb; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
|
||
public class WriteBufferManagerTest { | ||
|
||
@ClassRule | ||
public static final RocksNativeLibraryResource ROCKS_NATIVE_LIBRARY_RESOURCE = new RocksNativeLibraryResource(); | ||
|
||
@Test | ||
public void newWriteBufferManagerWithCache() { | ||
final long capacity = 1000; | ||
try (final Cache lruCache = new LRUCache(capacity); | ||
final WriteBufferManager wbm = new WriteBufferManager(capacity, lruCache)) { | ||
assertThat(wbm.getBufferSize()).isEqualTo(capacity); | ||
assertThat(wbm.getMemoryUsage()).isEqualTo(0); | ||
assertThat(wbm.getMutableMemtableMemoryUsage()).isEqualTo(0); | ||
} | ||
} | ||
|
||
@Test | ||
public void newWriteBufferManagerWithoutCache() { | ||
final long capacity = 1000; | ||
try (final WriteBufferManager wbm = new WriteBufferManager(capacity)) { | ||
assertThat(wbm.getBufferSize()).isEqualTo(capacity); | ||
assertThat(wbm.getMemoryUsage()).isEqualTo(0); | ||
assertThat(wbm.getMutableMemtableMemoryUsage()).isEqualTo(0); | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this
make_shared
is supported in C++14?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'm not an expert of C++, and had some troubles to setup the toolchain on my machine, I'll fix this