FIXED: string buffers potentially too small to fit formatted write
Summary:
This fixes the following warnings when compiled with GCC7:
util/transaction_test_util.cc: In static member function ‘static rocksdb::Status rocksdb::RandomTransactionInserter::DBGet(rocksdb::DB*, rocksdb::Transaction*, rocksdb::ReadOptions&, uint16_t, uint64_t, bool, uint64_t*, std::__cxx11::string*, bool*)’:
util/transaction_test_util.cc:75:8: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
Status RandomTransactionInserter::DBGet(
^~~~~~~~~~~~~~~~~~~~~~~~~
util/transaction_test_util.cc:84:11: note: ‘snprintf’ output between 5 and 6 bytes into a destination of size 5
snprintf(prefix_buf, sizeof(prefix_buf), "%.4u", set_i + 1);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
util/transaction_test_util.cc: In static member function ‘static rocksdb::Status rocksdb::RandomTransactionInserter::Verify(rocksdb::DB*, uint16_t, uint64_t, bool, rocksdb::Random64*)’:
util/transaction_test_util.cc:245:8: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
Status RandomTransactionInserter::Verify(DB* db, uint16_t num_sets,
^~~~~~~~~~~~~~~~~~~~~~~~~
util/transaction_test_util.cc:268:13: note: ‘snprintf’ output between 5 and 6 bytes into a destination of size 5
snprintf(prefix_buf, sizeof(prefix_buf), "%.4u", set_i + 1);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Closes https://github.com/facebook/rocksdb/pull/3295
Differential Revision:
D6609411
Pulled By: maysamyabandeh
fbshipit-source-id:
33f0add471056eb59db2f8bd4366e6dfbb1a187d
crc32: suppress -Wimplicit-fallthrough warnings
Summary:
Workaround a bunch of "implicit-fallthrough" compiler errors, like:
```
util/crc32c.cc:533:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
crc = _mm_crc32_u64(crc, *(uint64_t*)(buf + offset));
^
util/crc32c.cc:1016:9: note: in expansion of macro ‘CRCsinglet’
CRCsinglet(crc0, next, -2 * 8);
^~~~~~~~~~
util/crc32c.cc:1017:7: note: here
case 1:
```
Closes https://github.com/facebook/rocksdb/pull/3339
Reviewed By: sagar0
Differential Revision:
D6874736
Pulled By: quark-zju
fbshipit-source-id:
eec9f3bc135e12fca336928d01711006d5c3cb16
Suppress lint in old files
Summary: Grandfather in super old lint issues to make a clean slate for moving forward that allows us to have stronger enforcement on new issues.
Reviewed By: yiwu-arbug
Differential Revision:
D6821806
fbshipit-source-id:
22797d31ec58e9eb0255d3b66fedfcfcb0dc127c
StackableDB optionally take shared ownership of the underlying DB
Summary:
Allow StackableDB optionally takes a shared_ptr on construction and thus hold shared ownership of the underlying DB.
Closes https://github.com/facebook/rocksdb/pull/3423
Differential Revision:
D6824163
Pulled By: yiwu-arbug
fbshipit-source-id:
dbdc30c42e007533a987ef413785e192340f03eb
Fix PowerPC dynamic java build
Summary:
Java build on PPC64le has been broken since a few months, due to #2716. Fixing it with the least amount of changes.
(We should cleanup a little around this code when time permits).
This should fix the build failures seen in http://140.211.168.68:8080/job/Rocksdb/ .
Closes https://github.com/facebook/rocksdb/pull/3359
Differential Revision:
D6712938
Pulled By: sagar0
fbshipit-source-id:
3046e8f072180693de2af4762934ec1ace309ca4
Fix Flush() keep waiting after flush finish
Summary:
Flush() call could be waiting indefinitely if min_write_buffer_number_to_merge is used. Consider the sequence:
1. User call Flush() with flush_options.wait = true
2. The manual flush started in the background
3. New memtable become immutable because of writes. The new memtable will not trigger flush if min_write_buffer_number_to_merge is not reached.
4. The manual flush finish.
Because of the new memtable created at step 3 not being flush, previous logic of WaitForFlushMemTable() keep waiting, despite the memtables it intent to flush has been flushed.
Here instead of checking if there are any more memtables to flush, WaitForFlushMemTable() also check the id of the earliest memtable. If the id is larger than that of latest memtable at the time flush was initiated, it means all the memtable at the time of flush start has all been flush.
Closes https://github.com/facebook/rocksdb/pull/3378
Differential Revision:
D6746789
Pulled By: yiwu-arbug
fbshipit-source-id:
35e698f71c7f90b06337a93e6825f4ea3b619bfa
FreeBSD build support for RocksDB and RocksJava
Summary:
Tested on a clean FreeBSD 11.01 x64.
Closes https://github.com/facebook/rocksdb/pull/1423
Closes https://github.com/facebook/rocksdb/pull/3357
Differential Revision:
D6705868
Pulled By: sagar0
fbshipit-source-id:
cbccbbdafd4f42922512ca03619a5d5583a425fd
fix powerpc java static build
Summary:
added support for C and asm files as required for
e612e317409e8a9d74cf05db0bd733403305f459.
Closes https://github.com/facebook/rocksdb/pull/3299
Differential Revision:
D6612479
Pulled By: ajkr
fbshipit-source-id:
6263ed7c1602f249460421825c76b5721f396163
Fix zstd/zdict include path for java static build
Summary:
With the ZSTD dictionary generator support added in #3057
`PORTABLE=1 ROCKSDB_NO_FBCODE=1 make rocksdbjavastatic` fails as it can't find zdict.h. Specifically due to:
https://github.com/facebook/rocksdb/blob/
e3a06f12d27fd50af7b6c5941973f529601f9a3e/util/compression.h#L39
In java static builds zstd code gets directly downloaded from https://github.com/facebook/zstd , and in there zdict.h is under dictBuilder directory. So, I modified libzstd.a target to use `make install` to collect all the header files into a single location and used that as the zstd's include path.
Closes https://github.com/facebook/rocksdb/pull/3260
Differential Revision:
D6669850
Pulled By: sagar0
fbshipit-source-id:
f8a7562a670e5aed4c4fb6034a921697590d7285
Fix db_bench write being disabled in lite build
Summary:
The macro was added by mistake in #2372
Closes https://github.com/facebook/rocksdb/pull/3343
Differential Revision:
D6681356
Pulled By: yiwu-arbug
fbshipit-source-id:
4180172fb0eaef4189c07f219241e0c261c03461