-
Notifications
You must be signed in to change notification settings - Fork 143
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
feat(rocksdb): configure rocksdb options #1065
feat(rocksdb): configure rocksdb options #1065
Conversation
public RocksDBStore( | ||
string path, | ||
int blockCacheSize = 512, | ||
int txCacheSize = 1024, | ||
int statesCacheSize = 10000 | ||
int statesCacheSize = 10000, | ||
ulong? maxTotalWalSize = null, |
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 guess we should use long
instead of ulong
on public interface to keep CLS compatibility.
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 used its type as ulong
because the type of DbOptions.SetKeepLogFileNum()
's argument was ulong
. I will amend it to keep CLS compatibility.
I tried it but I couldn't convert long
to ulong
😢
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 guess explicit cast((ulong)
) will work...
long maxTotalWalSize = 0L;
_options.SetMaxTotalWalSize((ulong)maxTotalWalSize);
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'm not sure it is okay to use ulong
type for convert to keep CLS compatibility. I guess the ulong
shouldn't appear anywhere.
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.
As far I know, CLS compliance apply only to public interface, not to its private implementation. (see also: https://docs.microsoft.com/en-US/dotnet/standard/language-independence-and-language-independent-components#Rules)
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.
How about giving up CLS compatibility only for Libplanet.RocksDBStore project? Although we can cast long
to ulong
, we still lost its upper bits (9,223,372,036,854,775,808 to 18,446,744,073,709,551,615).
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.
If we need higher value for these options, I agree with giving up.
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.
Actually, I checked the RocksDB C++ core also used the option's type as uint64
(ulong
). So I will give up it and stay with this code. @longfin
Codecov Report
@@ Coverage Diff @@
## 9c-main #1065 +/- ##
===========================================
- Coverage 88.39% 88.30% -0.09%
===========================================
Files 343 343
Lines 31509 31520 +11
===========================================
- Hits 27853 27835 -18
- Misses 1975 2007 +32
+ Partials 1681 1678 -3
|
97a249b
to
f13a8bf
Compare
f13a8bf
to
ba53342
Compare
ba53342
to
b573215
Compare
@planetarium/libplanet Could you review this pull request? |
It provides a new feature to configure some options of RocksDB options.
With
maxTotalWalSize
, you can limit the size of WAL.With
keepLogFileNum
, you can limit the number of log files.