Fix integer overflow in TraceOptions (#9157)

Summary:
Hello from a happy user of rocksdb java :-)

Default constructor of TraceOptions is supposed to initialize size to 64GB but the expression contains an integer overflow.

Simple test case with JShell:
```
jshell> 64 * 1024 * 1024 * 1024
$1 ==> 0

jshell> 64L * 1024 * 1024 * 1024
$2 ==> 68719476736
```

Pull Request resolved: https://github.com/facebook/rocksdb/pull/9157

Reviewed By: pdillinger, zhichao-cao

Differential Revision: D32369273

Pulled By: mrambacher

fbshipit-source-id: 6a0c95fff7a91f27ff15d65b662c6b101756b450
main
Davide Angelocola 3 years ago committed by Facebook GitHub Bot
parent 2225f063d4
commit c9539ede76
  1. 6
      java/src/main/java/org/rocksdb/TraceOptions.java

@ -13,7 +13,7 @@ public class TraceOptions {
private final long maxTraceFileSize;
public TraceOptions() {
this.maxTraceFileSize = 64 * 1024 * 1024 * 1024; // 64 GB
this.maxTraceFileSize = 64L * 1024 * 1024 * 1024; // 64 GB
}
public TraceOptions(final long maxTraceFileSize) {
@ -21,8 +21,8 @@ public class TraceOptions {
}
/**
* To avoid the trace file size grows large than the storage space,
* user can set the max trace file size in Bytes. Default is 64GB
* To avoid the trace file size grows larger than the storage space,
* user can set the max trace file size in Bytes. Default is 64 GB.
*
* @return the max trace size
*/

Loading…
Cancel
Save