Skip to content

Commit 332088a

Browse files
committed
Merge commit '6349da612bd26bbf338cbce4601de29ffe1a1f1c' of github.com:facebook/rocksdb into upgrade-7.7
2 parents 3dc96db + 6349da6 commit 332088a

File tree

169 files changed

+6448
-1460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+6448
-1460
lines changed

.github/workflows/nightly.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,13 @@ jobs:
9696
steps:
9797
- uses: actions/[email protected]
9898
- uses: "./.github/actions/windows-build-steps"
99+
build-linux-arm-test-full:
100+
if: ${{ github.repository_owner == 'facebook' }}
101+
runs-on:
102+
labels: 4-core-ubuntu-arm
103+
steps:
104+
- uses: actions/[email protected]
105+
- uses: "./.github/actions/pre-steps"
106+
- run: sudo apt-get update && sudo apt-get install -y build-essential libgflags-dev
107+
- run: make V=1 J=4 -j4 check
108+
- uses: "./.github/actions/post-steps"

.github/workflows/pr-jobs.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,3 +607,13 @@ jobs:
607607
with:
608608
name: maven-site
609609
path: "${{ github.workspace }}/java/target/site"
610+
build-linux-arm:
611+
if: ${{ github.repository_owner == 'facebook' }}
612+
runs-on:
613+
labels: 4-core-ubuntu-arm
614+
steps:
615+
- uses: actions/[email protected]
616+
- uses: "./.github/actions/pre-steps"
617+
- run: sudo apt-get update && sudo apt-get install -y build-essential
618+
- run: ROCKSDBTESTS_PLATFORM_DEPENDENT=only make V=1 J=4 -j4 all_but_some_tests check_some
619+
- uses: "./.github/actions/post-steps"

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ set(SOURCES
667667
cache/sharded_cache.cc
668668
cache/tiered_secondary_cache.cc
669669
db/arena_wrapped_db_iter.cc
670+
db/attribute_group_iterator_impl.cc
670671
db/blob/blob_contents.cc
671672
db/blob/blob_fetcher.cc
672673
db/blob/blob_file_addition.cc
@@ -683,6 +684,7 @@ set(SOURCES
683684
db/blob/prefetch_buffer_collection.cc
684685
db/builder.cc
685686
db/c.cc
687+
db/coalescing_iterator.cc
686688
db/column_family.cc
687689
db/compaction/compaction.cc
688690
db/compaction/compaction_iterator.cc
@@ -729,7 +731,6 @@ set(SOURCES
729731
db/memtable_list.cc
730732
db/merge_helper.cc
731733
db/merge_operator.cc
732-
db/multi_cf_iterator.cc
733734
db/output_validator.cc
734735
db/periodic_task_scheduler.cc
735736
db/range_del_aggregator.cc
@@ -968,6 +969,7 @@ set(SOURCES
968969
utilities/transactions/write_prepared_txn_db.cc
969970
utilities/transactions/write_unprepared_txn.cc
970971
utilities/transactions/write_unprepared_txn_db.cc
972+
utilities/types_util.cc
971973
utilities/ttl/db_ttl_impl.cc
972974
utilities/wal_filter.cc
973975
utilities/write_batch_with_index/write_batch_with_index.cc
@@ -1049,8 +1051,10 @@ endif()
10491051

10501052
else()
10511053
list(APPEND SOURCES
1054+
db/db_impl/db_impl_follower.cc
10521055
port/port_posix.cc
10531056
env/env_posix.cc
1057+
env/fs_on_demand.cc
10541058
env/fs_posix.cc
10551059
env/io_posix.cc)
10561060
endif()
@@ -1378,6 +1382,7 @@ if(WITH_TESTS)
13781382
db/file_indexer_test.cc
13791383
db/filename_test.cc
13801384
db/flush_job_test.cc
1385+
db/db_follower_test.cc
13811386
db/import_column_family_test.cc
13821387
db/listener_test.cc
13831388
db/log_test.cc
@@ -1501,6 +1506,7 @@ if(WITH_TESTS)
15011506
utilities/transactions/lock/range/range_locking_test.cc
15021507
utilities/transactions/timestamped_snapshot_test.cc
15031508
utilities/ttl/ttl_test.cc
1509+
utilities/types_util_test.cc
15041510
utilities/util_merge_operators_test.cc
15051511
utilities/write_batch_with_index/write_batch_with_index_test.cc
15061512
${PLUGIN_TESTS}

HISTORY.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,43 @@
11
# Rocksdb Change Log
22
> NOTE: Entries for next release do not go here. Follow instructions in `unreleased_history/README.txt`
33
4+
## 9.2.0 (05/01/2024)
5+
### New Features
6+
* Added two options `deadline` and `max_size_bytes` for CacheDumper to exit early
7+
* Added a new API `GetEntityFromBatchAndDB` to `WriteBatchWithIndex` that can be used for wide-column point lookups with read-your-own-writes consistency. Similarly to `GetFromBatchAndDB`, the API can combine data from the write batch with data from the underlying database if needed. See the API comments for more details.
8+
* [Experimental] Introduce two new cross-column-family iterators - CoalescingIterator and AttributeGroupIterator. The CoalescingIterator enables users to iterate over multiple column families and access their values and columns. During this iteration, if the same key exists in more than one column family, the keys in the later column family will overshadow the previous ones. The AttributeGroupIterator allows users to gather wide columns per Column Family and create attribute groups while iterating over keys across all CFs.
9+
* Added a new API `MultiGetEntityFromBatchAndDB` to `WriteBatchWithIndex` that can be used for batched wide-column point lookups with read-your-own-writes consistency. Similarly to `MultiGetFromBatchAndDB`, the API can combine data from the write batch with data from the underlying database if needed. See the API comments for more details.
10+
* *Adds a `SstFileReader::NewTableIterator` API to support programmatically read a SST file as a raw table file.
11+
* Add an option to `WaitForCompactOptions` - `wait_for_purge` to make `WaitForCompact()` API wait for background purge to complete
12+
13+
### Public API Changes
14+
* DeleteRange() will return NotSupported() if row_cache is configured since they don't work together in some cases.
15+
* Deprecated `CompactionOptions::compression` since `CompactionOptions`'s API for configuring compression was incomplete, unsafe, and likely unnecessary
16+
* Using `OptionChangeMigration()` to migrate from non-FIFO to FIFO compaction
17+
with `Options::compaction_options_fifo.max_table_files_size` > 0 can cause
18+
the whole DB to be dropped right after migration if the migrated data is larger than
19+
`max_table_files_size`
20+
21+
### Behavior Changes
22+
* Enabling `BlockBasedTableOptions::block_align` is now incompatible (i.e., APIs will return `Status::InvalidArgument`) with more ways of enabling compression: `CompactionOptions::compression`, `ColumnFamilyOptions::compression_per_level`, and `ColumnFamilyOptions::bottommost_compression`.
23+
* Changed the default value of `CompactionOptions::compression` to `kDisableCompressionOption`, which means the compression type is determined by the `ColumnFamilyOptions`.
24+
* `BlockBasedTableOptions::optimize_filters_for_memory` is now set to true by default. When `partition_filters=false`, this could lead to somewhat increased average RSS memory usage by the block cache, but this "extra" usage is within the allowed memory budget and should make memory usage more consistent (by minimizing internal fragmentation for more kinds of blocks).
25+
* Dump all keys for cache dumper impl if `SetDumpFilter()` is not called
26+
* `CompactRange()` with `CompactRangeOptions::change_level = true` and `CompactRangeOptions::target_level = 0` that ends up moving more than 1 file from non-L0 to L0 will return `Status::Aborted()`.
27+
* On distributed file systems that support file system level checksum verification and reconstruction reads, RocksDB will now retry a file read if the initial read fails RocksDB block level or record level checksum verification. This applies to MANIFEST file reads when the DB is opened, and to SST file reads at all times.
28+
29+
### Bug Fixes
30+
* Fix a bug causing `VerifyFileChecksums()` to return false-positive corruption under `BlockBasedTableOptions::block_align=true`
31+
* Provide consistent view of the database across the column families for `NewIterators()` API.
32+
* Fixed feature interaction bug for `DeleteRange()` together with `ColumnFamilyOptions::memtable_insert_with_hint_prefix_extractor`. The impact of this bug would likely be corruption or crashing.
33+
* Fixed hang in `DisableManualCompactions()` where compactions waiting to be scheduled due to conflicts would not be canceled promptly
34+
* Fixed a regression when `ColumnFamilyOptions::max_successive_merges > 0` where the CPU overhead for deciding whether to merge could have increased unless the user had set the option `ColumnFamilyOptions::strict_max_successive_merges`
35+
* Fixed a bug in `MultiGet()` and `MultiGetEntity()` together with blob files (`ColumnFamilyOptions::enable_blob_files == true`). An error looking up one of the keys could cause the results to be wrong for other keys for which the statuses were `Status::OK`.
36+
* Fixed a bug where wrong padded bytes are used to generate file checksum and `DataVerificationInfo::checksum` upon file creation
37+
* Correctly implemented the move semantics of `PinnableWideColumns`.
38+
* Fixed a bug when the recycle_log_file_num in DBOptions is changed from 0 to non-zero when a DB is reopened. On a subsequent reopen, if a log file created when recycle_log_file_num==0 was reused previously, is alive and is empty, we could end up inserting stale WAL records into the memtable.
39+
* *Fix a bug where obsolete files' deletion during DB::Open are not rate limited with `SstFilemManager`'s slow deletion feature even if it's configured.
40+
441
## 9.1.0 (03/22/2024)
542
### New Features
643
* Added an option, `GetMergeOperandsOptions::continue_cb`, to give users the ability to end `GetMergeOperands()`'s lookup process before all merge operands were found.

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,9 @@ object_registry_test: $(OBJ_DIR)/utilities/object_registry_test.o $(TEST_LIBRARY
16101610
ttl_test: $(OBJ_DIR)/utilities/ttl/ttl_test.o $(TEST_LIBRARY) $(LIBRARY)
16111611
$(AM_LINK)
16121612

1613+
types_util_test: $(OBJ_DIR)/utilities/types_util_test.o $(TEST_LIBRARY) $(LIBRARY)
1614+
$(AM_LINK)
1615+
16131616
write_batch_with_index_test: $(OBJ_DIR)/utilities/write_batch_with_index/write_batch_with_index_test.o $(TEST_LIBRARY) $(LIBRARY)
16141617
$(AM_LINK)
16151618

@@ -1919,6 +1922,9 @@ sst_file_reader_test: $(OBJ_DIR)/table/sst_file_reader_test.o $(TEST_LIBRARY) $(
19191922
db_secondary_test: $(OBJ_DIR)/db/db_secondary_test.o $(TEST_LIBRARY) $(LIBRARY)
19201923
$(AM_LINK)
19211924

1925+
db_follower_test: $(OBJ_DIR)/db/db_follower_test.o $(TEST_LIBRARY) $(LIBRARY)
1926+
$(AM_LINK)
1927+
19221928
block_cache_tracer_test: $(OBJ_DIR)/trace_replay/block_cache_tracer_test.o $(TEST_LIBRARY) $(LIBRARY)
19231929
$(AM_LINK)
19241930

TARGETS

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ cpp_library_wrapper(name="rocksdb_lib", srcs=[
2121
"cache/sharded_cache.cc",
2222
"cache/tiered_secondary_cache.cc",
2323
"db/arena_wrapped_db_iter.cc",
24+
"db/attribute_group_iterator_impl.cc",
2425
"db/blob/blob_contents.cc",
2526
"db/blob/blob_fetcher.cc",
2627
"db/blob/blob_file_addition.cc",
@@ -37,6 +38,7 @@ cpp_library_wrapper(name="rocksdb_lib", srcs=[
3738
"db/blob/prefetch_buffer_collection.cc",
3839
"db/builder.cc",
3940
"db/c.cc",
41+
"db/coalescing_iterator.cc",
4042
"db/column_family.cc",
4143
"db/compaction/compaction.cc",
4244
"db/compaction/compaction_iterator.cc",
@@ -58,6 +60,7 @@ cpp_library_wrapper(name="rocksdb_lib", srcs=[
5860
"db/db_impl/db_impl_debug.cc",
5961
"db/db_impl/db_impl_experimental.cc",
6062
"db/db_impl/db_impl_files.cc",
63+
"db/db_impl/db_impl_follower.cc",
6164
"db/db_impl/db_impl_open.cc",
6265
"db/db_impl/db_impl_readonly.cc",
6366
"db/db_impl/db_impl_secondary.cc",
@@ -83,7 +86,6 @@ cpp_library_wrapper(name="rocksdb_lib", srcs=[
8386
"db/memtable_list.cc",
8487
"db/merge_helper.cc",
8588
"db/merge_operator.cc",
86-
"db/multi_cf_iterator.cc",
8789
"db/output_validator.cc",
8890
"db/periodic_task_scheduler.cc",
8991
"db/range_del_aggregator.cc",
@@ -116,6 +118,7 @@ cpp_library_wrapper(name="rocksdb_lib", srcs=[
116118
"env/env_posix.cc",
117119
"env/file_system.cc",
118120
"env/file_system_tracer.cc",
121+
"env/fs_on_demand.cc",
119122
"env/fs_posix.cc",
120123
"env/fs_remap.cc",
121124
"env/io_posix.cc",
@@ -346,6 +349,7 @@ cpp_library_wrapper(name="rocksdb_lib", srcs=[
346349
"utilities/transactions/write_unprepared_txn.cc",
347350
"utilities/transactions/write_unprepared_txn_db.cc",
348351
"utilities/ttl/db_ttl_impl.cc",
352+
"utilities/types_util.cc",
349353
"utilities/wal_filter.cc",
350354
"utilities/write_batch_with_index/write_batch_with_index.cc",
351355
"utilities/write_batch_with_index/write_batch_with_index_internal.cc",
@@ -4793,6 +4797,12 @@ cpp_unittest_wrapper(name="db_flush_test",
47934797
extra_compiler_flags=[])
47944798

47954799

4800+
cpp_unittest_wrapper(name="db_follower_test",
4801+
srcs=["db/db_follower_test.cc"],
4802+
deps=[":rocksdb_test_lib"],
4803+
extra_compiler_flags=[])
4804+
4805+
47964806
cpp_unittest_wrapper(name="db_inplace_update_test",
47974807
srcs=["db/db_inplace_update_test.cc"],
47984808
deps=[":rocksdb_test_lib"],
@@ -5527,6 +5537,12 @@ cpp_unittest_wrapper(name="ttl_test",
55275537
extra_compiler_flags=[])
55285538

55295539

5540+
cpp_unittest_wrapper(name="types_util_test",
5541+
srcs=["utilities/types_util_test.cc"],
5542+
deps=[":rocksdb_test_lib"],
5543+
extra_compiler_flags=[])
5544+
5545+
55305546
cpp_unittest_wrapper(name="udt_util_test",
55315547
srcs=["util/udt_util_test.cc"],
55325548
deps=[":rocksdb_test_lib"],

build_tools/build_detect_platform

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -163,24 +163,6 @@ case "$TARGET_OS" in
163163
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -latomic"
164164
fi
165165
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread -lrt -ldl"
166-
if test -z "$ROCKSDB_USE_IO_URING"; then
167-
ROCKSDB_USE_IO_URING=1
168-
fi
169-
if test "$ROCKSDB_USE_IO_URING" -ne 0; then
170-
# check for liburing
171-
$CXX $PLATFORM_CXXFLAGS -x c++ - -luring -o test.o 2>/dev/null <<EOF
172-
#include <liburing.h>
173-
int main() {
174-
struct io_uring ring;
175-
io_uring_queue_init(1, &ring, 0);
176-
return 0;
177-
}
178-
EOF
179-
if [ "$?" = 0 ]; then
180-
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -luring"
181-
COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_IOURING_PRESENT"
182-
fi
183-
fi
184166
# PORT_FILES=port/linux/linux_specific.cc
185167
;;
186168
SunOS)
@@ -614,6 +596,24 @@ EOF
614596
fi
615597
fi
616598

599+
if test -z "$ROCKSDB_USE_IO_URING"; then
600+
ROCKSDB_USE_IO_URING=1
601+
fi
602+
if [ "$ROCKSDB_USE_IO_URING" -ne 0 -a "$PLATFORM" = OS_LINUX ]; then
603+
# check for liburing
604+
$CXX $PLATFORM_CXXFLAGS -x c++ - -luring -o test.o 2>/dev/null <<EOF
605+
#include <liburing.h>
606+
int main() {
607+
struct io_uring ring;
608+
io_uring_queue_init(1, &ring, 0);
609+
return 0;
610+
}
611+
EOF
612+
if [ "$?" = 0 ]; then
613+
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -luring"
614+
COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_IOURING_PRESENT"
615+
fi
616+
fi
617617
fi
618618

619619
# TODO(tec): Fix -Wshorten-64-to-32 errors on FreeBSD and enable the warning.

build_tools/fbcode_config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ CLANG_LIB="$CLANG_BASE/lib"
113113
CLANG_SRC="$CLANG_BASE/../../src"
114114

115115
CLANG_ANALYZER="$CLANG_BIN/clang++"
116-
CLANG_SCAN_BUILD="$CLANG_SRC/llvm/tools/clang/tools/scan-build/bin/scan-build"
116+
CLANG_SCAN_BUILD="$CLANG_BIN/scan-build
117117
118118
if [ -z "$USE_CLANG" ]; then
119119
# gcc

build_tools/fbcode_config_platform010.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ CLANG_LIB="$CLANG_BASE/lib"
110110
CLANG_SRC="$CLANG_BASE/../../src"
111111

112112
CLANG_ANALYZER="$CLANG_BIN/clang++"
113-
CLANG_SCAN_BUILD="$CLANG_SRC/llvm/clang/tools/scan-build/bin/scan-build"
113+
CLANG_SCAN_BUILD="$CLANG_BIN/scan-build"
114114

115115
if [ -z "$USE_CLANG" ]; then
116116
# gcc

cache/cache_reservation_manager_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ TEST_F(CacheReservationManagerTest,
129129

130130
TEST(CacheReservationManagerIncreaseReservcationOnFullCacheTest,
131131
IncreaseCacheReservationOnFullCache) {
132-
;
133132
constexpr std::size_t kSizeDummyEntry =
134133
CacheReservationManagerImpl<CacheEntryRole::kMisc>::GetDummyEntrySize();
135134
constexpr std::size_t kSmallCacheCapacity = 4 * kSizeDummyEntry;

db/attribute_group_iterator_impl.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) Meta Platforms, Inc. and affiliates.
2+
// This source code is licensed under both the GPLv2 (found in the
3+
// COPYING file in the root directory) and Apache 2.0 License
4+
// (found in the LICENSE.Apache file in the root directory).
5+
6+
#include "db/attribute_group_iterator_impl.h"
7+
8+
namespace ROCKSDB_NAMESPACE {
9+
10+
const AttributeGroups kNoAttributeGroups;
11+
const IteratorAttributeGroups kNoIteratorAttributeGroups;
12+
13+
void AttributeGroupIteratorImpl::AddToAttributeGroups(
14+
const autovector<MultiCfIteratorInfo>& items) {
15+
for (const auto& item : items) {
16+
attribute_groups_.emplace_back(item.cfh, &item.iterator->columns());
17+
}
18+
}
19+
20+
} // namespace ROCKSDB_NAMESPACE

0 commit comments

Comments
 (0)