rocksdb/table/block_based
Hui Xiao f337533b6f Ensure and clarify how RocksDB calls TablePropertiesCollector's functions (#12053)
Summary:
**Context/Summary:**
It's intuitive for users to assume `TablePropertiesCollector::Finish()` is called only once by RocksDB internal by the word "finish".

However, this is currently not true as RocksDB also calls this function in `BlockBased/PlainTableBuilder::GetTableProperties()` to populate user collected properties on demand.

This PR avoids that by moving that populating to where we first call `Finish()` (i.e, `NotifyCollectTableCollectorsOnFinish`)

Bonus: clarified in the API that `GetReadableProperties()` will be called after `Finish()` and added UT to ensure that.

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

Test Plan:
- Modified test `DBPropertiesTest.GetUserDefinedTableProperties` to ensure `Finish()` only called once.
- Existing test particularly `db_properties_test, table_properties_collector_test` verify the functionality  `NotifyCollectTableCollectorsOnFinish` and `GetReadableProperties()` are not broken by this change.

Reviewed By: ajkr

Differential Revision: D51095434

Pulled By: hx235

fbshipit-source-id: 1c6275258f9b99dedad313ee8427119126817973
2023-11-08 14:00:36 -08:00
..
binary_search_index_reader.cc
binary_search_index_reader.h
block.cc
block.h
block_based_table_builder.cc
block_based_table_builder.h
block_based_table_factory.cc
block_based_table_factory.h
block_based_table_iterator.cc
block_based_table_iterator.h
block_based_table_reader.cc
block_based_table_reader.h
block_based_table_reader_impl.h
block_based_table_reader_sync_and_async.h
block_based_table_reader_test.cc
block_builder.cc
block_builder.h
block_cache.cc
block_cache.h
block_prefetcher.cc
block_prefetcher.h
block_prefix_index.cc
block_prefix_index.h
block_test.cc
block_type.h
cachable_entry.h
data_block_footer.cc
data_block_footer.h
data_block_hash_index.cc
data_block_hash_index.h
data_block_hash_index_test.cc
filter_block.h
filter_block_reader_common.cc
filter_block_reader_common.h
filter_policy.cc
filter_policy_internal.h
flush_block_policy.cc
flush_block_policy_impl.h
full_filter_block.cc
full_filter_block.h
full_filter_block_test.cc
hash_index_reader.cc
hash_index_reader.h
index_builder.cc
index_builder.h
index_reader_common.cc
index_reader_common.h
mock_block_based_table.h
parsed_full_filter_block.cc
parsed_full_filter_block.h
partitioned_filter_block.cc
partitioned_filter_block.h
partitioned_filter_block_test.cc
partitioned_index_iterator.cc
partitioned_index_iterator.h
partitioned_index_reader.cc
partitioned_index_reader.h
reader_common.cc
reader_common.h
uncompression_dict_reader.cc
uncompression_dict_reader.h