提交 c9539ede 编写于 作者: D Davide Angelocola 提交者: Facebook GitHub Bot

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
上级 2225f063
...@@ -13,7 +13,7 @@ public class TraceOptions { ...@@ -13,7 +13,7 @@ public class TraceOptions {
private final long maxTraceFileSize; private final long maxTraceFileSize;
public TraceOptions() { public TraceOptions() {
this.maxTraceFileSize = 64 * 1024 * 1024 * 1024; // 64 GB this.maxTraceFileSize = 64L * 1024 * 1024 * 1024; // 64 GB
} }
public TraceOptions(final long maxTraceFileSize) { public TraceOptions(final long maxTraceFileSize) {
...@@ -21,8 +21,8 @@ public class TraceOptions { ...@@ -21,8 +21,8 @@ public class TraceOptions {
} }
/** /**
* To avoid the trace file size grows large than the storage space, * To avoid the trace file size grows larger than the storage space,
* user can set the max trace file size in Bytes. Default is 64GB * user can set the max trace file size in Bytes. Default is 64 GB.
* *
* @return the max trace size * @return the max trace size
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册