You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Soli
f1837595a3
FIX #3278: Move global const object definitions from .h to .cc (#4691)
Summary:
Summary
We should declare constants in headers and define them in source files.
But this commit is only aimed at compound types.
I don't know if it is necessary to do the same thing to fundamental types.
I used this command to find all of the constant definitions in header files.
`find . -name "*.h" | xargs grep -e "^const .*=.*"`
And here is what I found:
```
./db/version_edit.h:const uint64_t kFileNumberMask = 0x3FFFFFFFFFFFFFFF;
./include/rocksdb/env.h:const size_t kDefaultPageSize = 4 * 1024;
./include/rocksdb/statistics.h:const std::vector<std::pair<Tickers, std::string>> TickersNameMap = {
./include/rocksdb/statistics.h:const std::vector<std::pair<Histograms, std::string>> HistogramsNameMap = {
./include/rocksdb/table.h:const uint32_t kPlainTableVariableLength = 0;
./include/rocksdb/utilities/transaction_db.h:const uint32_t kInitialMaxDeadlocks = 5;
./port/port_posix.h:const uint32_t kMaxUint32 = std::numeric_limits<uint32_t>::max();
./port/port_posix.h:const int kMaxInt32 = std::numeric_limits<int32_t>::max();
./port/port_posix.h:const uint64_t kMaxUint64 = std::numeric_limits<uint64_t>::max();
./port/port_posix.h:const int64_t kMaxInt64 = std::numeric_limits<int64_t>::max();
./port/port_posix.h:const size_t kMaxSizet = std::numeric_limits<size_t>::max();
./port/win/port_win.h:const uint32_t kMaxUint32 = UINT32_MAX;
./port/win/port_win.h:const int kMaxInt32 = INT32_MAX;
./port/win/port_win.h:const int64_t kMaxInt64 = INT64_MAX;
./port/win/port_win.h:const uint64_t kMaxUint64 = UINT64_MAX;
./port/win/port_win.h:const size_t kMaxSizet = UINT64_MAX;
./port/win/port_win.h:const size_t kMaxSizet = UINT_MAX;
./port/win/port_win.h:const uint32_t kMaxUint32 = std::numeric_limits<uint32_t>::max();
./port/win/port_win.h:const int kMaxInt32 = std::numeric_limits<int>::max();
./port/win/port_win.h:const uint64_t kMaxUint64 = std::numeric_limits<uint64_t>::max();
./port/win/port_win.h:const int64_t kMaxInt64 = std::numeric_limits<int64_t>::max();
./port/win/port_win.h:const size_t kMaxSizet = std::numeric_limits<size_t>::max();
./port/win/port_win.h:const bool kLittleEndian = true;
./table/cuckoo_table_factory.h:const uint32_t kCuckooMurmurSeedMultiplier = 816922183;
./table/data_block_hash_index.h:const uint8_t kNoEntry = 255;
./table/data_block_hash_index.h:const uint8_t kCollision = 254;
./table/data_block_hash_index.h:const uint8_t kMaxRestartSupportedByHashIndex = 253;
./table/data_block_hash_index.h:const size_t kMaxBlockSizeSupportedByHashIndex = 1u << 16;
./table/data_block_hash_index.h:const double kDefaultUtilRatio = 0.75;
./table/filter_block.h:const uint64_t kNotValid = ULLONG_MAX;
./table/format.h:const int kMagicNumberLengthByte = 8;
./third-party/fbson/FbsonJsonParser.h:const char* const kJsonDelim = " ,]}\t\r\n";
./third-party/fbson/FbsonJsonParser.h:const char* const kWhiteSpace = " \t\n\r";
./third-party/gtest-1.7.0/fused-src/gtest/gtest.h:const BiggestInt kMaxBiggestInt =
./third-party/gtest-1.7.0/fused-src/gtest/gtest.h:const char kDeathTestStyleFlag[] = "death_test_style";
./third-party/gtest-1.7.0/fused-src/gtest/gtest.h:const char kDeathTestUseFork[] = "death_test_use_fork";
./third-party/gtest-1.7.0/fused-src/gtest/gtest.h:const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
./third-party/gtest-1.7.0/fused-src/gtest/gtest.h:const char* pets[] = {"cat", "dog"};
./third-party/gtest-1.7.0/fused-src/gtest/gtest.h:const size_t kProtobufOneLinerMaxLength = 50;
./third-party/gtest-1.7.0/fused-src/gtest/gtest.h:const int kMaxStackTraceDepth = 100;
./third-party/gtest-1.7.0/fused-src/gtest/gtest.h:const T* WithParamInterface<T>::parameter_ = NULL;
./util/coding.h:const unsigned int kMaxVarint64Length = 10;
./util/filename.h:const size_t kFormatFileNumberBufSize = 38;
./util/testutil.h:const SliceTransform* RandomSliceTransform(Random* rnd, int pre_defined = -1);
./util/trace_replay.h:const std::string kTraceMagic = "feedcafedeadbeef";
./util/trace_replay.h:const unsigned int kTraceTimestampSize = 8;
./util/trace_replay.h:const unsigned int kTraceTypeSize = 1;
./util/trace_replay.h:const unsigned int kTracePayloadLengthSize = 4;
./util/trace_replay.h:const unsigned int kTraceMetadataSize =
./utilities/cassandra/serialize.h:const int64_t kCharMask = 0xFFLL;
./utilities/cassandra/serialize.h:const int32_t kBitsPerByte = 8;
```
And these 3 lines are related to this commit:
```
./include/rocksdb/statistics.h:const std::vector<std::pair<Tickers, std::string>> TickersNameMap = {
./include/rocksdb/statistics.h:const std::vector<std::pair<Histograms, std::string>> HistogramsNameMap = {
./util/trace_replay.h:const std::string kTraceMagic = "feedcafedeadbeef";
```
Any comments would be appreciated.
Thanks.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4691
Differential Revision: D13208049
Pulled By: ajkr
fbshipit-source-id: e5ee55fdaec5447fc5798c6721e2821e7cdc0d5b
|
6 years ago |
.. |
file_read_sample.h
|
Change RocksDB License
|
7 years ago |
histogram.cc
|
Print histogram count and sum in statistics string
|
7 years ago |
histogram.h
|
Scale histogram bucket size by constant factor
|
7 years ago |
histogram_test.cc
|
fix inclusive-exclusiveness of histogram ToString
|
7 years ago |
histogram_windowing.cc
|
Support pragma once in all header files and cleanup some warnings (#4339)
|
6 years ago |
histogram_windowing.h
|
fix HistogramWindowingImpl copy-{assignment,constructor}
|
7 years ago |
instrumented_mutex.cc
|
In instrumented mutex, take timing once for both of perf_context and statistics
|
7 years ago |
instrumented_mutex.h
|
Change RocksDB License
|
7 years ago |
iostats_context.cc
|
Directly refernce perf_context internally.
|
7 years ago |
iostats_context_imp.h
|
Directly refernce perf_context internally.
|
7 years ago |
iostats_context_test.cc
|
Change RocksDB License
|
7 years ago |
perf_context.cc
|
Add PerfContextByLevel to provide per level perf context information (#4226)
|
6 years ago |
perf_context_imp.h
|
Add PerfContextByLevel to provide per level perf context information (#4226)
|
6 years ago |
perf_level.cc
|
Change RocksDB License
|
7 years ago |
perf_level_imp.h
|
Change RocksDB License
|
7 years ago |
perf_step_timer.h
|
In instrumented mutex, take timing once for both of perf_context and statistics
|
7 years ago |
statistics.cc
|
FIX #3278: Move global const object definitions from .h to .cc (#4691)
|
6 years ago |
statistics.h
|
Support group commits of version edits (#3944)
|
6 years ago |
statistics_test.cc
|
Change RocksDB License
|
7 years ago |
thread_status_impl.cc
|
comment unused parameters to turn on -Wunused-parameter flag
|
7 years ago |
thread_status_updater.cc
|
comment unused parameters to turn on -Wunused-parameter flag
|
7 years ago |
thread_status_updater.h
|
Use RAII instead of pointers in cf_info_map
|
7 years ago |
thread_status_updater_debug.cc
|
comment unused parameters to turn on -Wunused-parameter flag
|
7 years ago |
thread_status_util.cc
|
comment unused parameters to turn on -Wunused-parameter flag
|
7 years ago |
thread_status_util.h
|
Change RocksDB License
|
7 years ago |
thread_status_util_debug.cc
|
Change RocksDB License
|
7 years ago |