From 8b4ab1ae2c52119c88205e835b9890806667e9c6 Mon Sep 17 00:00:00 2001 From: Dave Rigby Date: Tue, 9 May 2017 14:03:42 +0100 Subject: [PATCH] MB-24055: change defaultNumLocks from 193 to 47 (logical no-op). Change the value of HashTable::defaultNumLocks from 193 to 47. Note this is a no-op in a ns_server-controlled configutation as it already explicilty sets the number of ht_locks to 47; therefore the only time 193 is used is in unit tests. The reason for changing to 47 is to simplify testing - (1) we should ideally test in a configuration as close to the "full" system, and (2) we actually need to reduce the number of locks to <64 so we can run successfully under ThreadSanitizer. Change-Id: I1bcecc86cc90fbac215b8ee231179bee5d8cca32 Reviewed-on: http://review.couchbase.org/77889 Tested-by: Build Bot Reviewed-by: James Harrison Reviewed-by: Trond Norbye --- benchmarks/access_scanner_bench.cc | 1 - src/hash_table.cc | 2 +- tests/module_tests/ep_unit_tests_main.cc | 5 ----- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/benchmarks/access_scanner_bench.cc b/benchmarks/access_scanner_bench.cc index ca6cd7673..050a2fa1f 100644 --- a/benchmarks/access_scanner_bench.cc +++ b/benchmarks/access_scanner_bench.cc @@ -169,7 +169,6 @@ int main(int argc, char** argv) { putenv(allow_no_stats_env); mock_init_alloc_hooks(); init_mock_server(true); - HashTable::setDefaultNumLocks(47); initialize_time_functions(get_mock_server_api()->core); ::benchmark::Initialize(&argc, argv); ::benchmark::RunSpecifiedBenchmarks(); diff --git a/src/hash_table.cc b/src/hash_table.cc index 389004327..2af88674e 100644 --- a/src/hash_table.cc +++ b/src/hash_table.cc @@ -25,7 +25,7 @@ // prime in our table - this still gives space for 3072 HT slots but // minimizes fixed overheads. size_t HashTable::defaultNumBuckets = 3; -size_t HashTable::defaultNumLocks = 193; +size_t HashTable::defaultNumLocks = 47; static ssize_t prime_size_table[] = { 3, 7, 13, 23, 47, 97, 193, 383, 769, 1531, 3079, 6143, 12289, 24571, 49157, diff --git a/tests/module_tests/ep_unit_tests_main.cc b/tests/module_tests/ep_unit_tests_main.cc index d03047da9..e91402d4f 100644 --- a/tests/module_tests/ep_unit_tests_main.cc +++ b/tests/module_tests/ep_unit_tests_main.cc @@ -66,11 +66,6 @@ int main(int argc, char **argv) { } Logger::setLoggerAPI(get_mock_server_api()->log); - // Default number of hashtable locks is too large for TSan to - // track. Use the value in configuration.json (47 at time of - // writing). - HashTable::setDefaultNumLocks(Configuration().getHtLocks()); - // Need to initialize ep_real_time and friends. initialize_time_functions(get_mock_server_api()->core);