In PR #37300, Alexej asked why we the compiler does not warn about
unnecessary semicolons, e.g.
f()
{
}; // <-- here
The answer is surprising: In C++98, above syntax was disallowed but by
most compilers accepted it regardless. C++>11 introduced "empty
declarations" which made the syntax legal.
The previous behavior can be restored using flag
-Wc++98-compat-extra-semi. This finds many useless semicolons which were
removed in this change. Unfortunately, there are also false positives
which would require #pragma-s and HAS_* logic (--> check_flags.cmake) to
suppress. In the end, -Wc++98-compat-extra-semi comes with extra effort
for little benefit. Therefore, this change only fixes some semicolons
but does not enable the flag.
1. add LRUResourceCache for managing resource cache in lru policy
2. rollback LRUCache to the original version
3. add remove() in LRUCache
4. add unit tests for LRUResourceCache and LRUCache
But note, that tests with EXPECT_EXIT() does not work with --gtest_filter:
a) only this test is included into unit_tests_dbms
$ src/unit_tests_dbms --gtest_filter=VersionNumber*
Running main() from ../contrib/googletest/googletest/src/gtest_main.cc
Note: Google Test filter = VersionNumber*
[==========] Running 2 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 2 tests from VersionNumber
[ RUN ] VersionNumber.VersionNumber
[ OK ] VersionNumber.VersionNumber (0 ms)
[ RUN ] VersionNumber.fromString
Segmentation fault (core dumped)
(gdb) bt
0 0x00007fffda323d22 in raise () from /usr/lib/libc.so.6
1 0x00007fffda30d862 in abort () from /usr/lib/libc.so.6
2 0x00007fffdbe686f5 in DB::handle_error_code (msg=..., code=49, remote=false, trace=...) at Exception.cpp:49
3 0x00007fffdbe68846 in DB::Exception::Exception (this=0x7fffd5c5a240, msg=..., code=49, remote_=false) at Exception.cpp:60
4 0x00007fffe26b2cb3 in DB::Exception::Exception<unsigned long> (this=0x7fffd5c5a240, code=49, fmt=..., args=@0x7fffffffc7e8: 4) at Exception.h:40
5 0x00007fffdbf4d201 in DB::VersionNumber::VersionNumber (this=0x7fffffffcc20, vec=...) at VersionNumber.cpp:17
6 0x00007fffdbf4d650 in DB::VersionNumber::fromString (version=..., strict=true) at VersionNumber.cpp:57
7 0x00005555555db53d in VersionNumber_fromString_Test::TestBody (this=0x7fffd5c12330) at gtest_version_number.cpp:24
b) regular build
$ src/unit_tests_dbms --gtest_filter=VersionNumber*
Running main() from ../contrib/googletest/googletest/src/gtest_main.cc
Note: Google Test filter = VersionNumber*
[==========] Running 2 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 2 tests from VersionNumber
[ RUN ] VersionNumber.VersionNumber
[ OK ] VersionNumber.VersionNumber (0 ms)
[ RUN ] VersionNumber.fromString
[ OK ] VersionNumber.fromString (495 ms)
[----------] 2 tests from VersionNumber (495 ms total)
[----------] Global test environment tear-down
Segmentation fault (core dumped)
(gdb) bt
0 testing::TestInfo::should_run (this=0xe0) at gtest.h:760
1 0x00007ffff7f6edd5 in testing::TestSuite::ShouldRunTest (test_info=0xe0) at gtest.h:1009
2 0x00007ffff7f6ebb2 in testing::internal::CountIf<std::__1::vector<testing::TestInfo*, std::__1::allocator<testing::TestInfo*> >, bool (*)(testing::TestInfo const*)> (c=..., predicate=0x7ffff7f6edc0 <testing::TestSuite::ShouldRunTest(testing::TestInfo const*)>)
at gtest-internal-inl.h:294
3 0x00007ffff7f41ae5 in testing::TestSuite::test_to_run_count (this=0x7fffd5028500) at gtest.cc:2919
4 0x00007ffff7f41719 in testing::internal::SumOverTestSuiteList (case_list=..., method=(int (testing::TestSuite::*)(const testing::TestSuite * const)) 0x7ffff7f41ac0 <testing::TestSuite::test_to_run_count() const>) at gtest.cc:377
5 0x00007ffff7f41ab9 in testing::internal::UnitTestImpl::test_to_run_count (this=0x7fffd5d5c000) at gtest.cc:1012
6 0x00007ffff7f4b59d in testing::UnitTest::test_to_run_count (this=0x7ffff7fbcb80 <testing::UnitTest::GetInstance()::instance>) at gtest.cc:5059
7 0x00007ffff7f4c4ed in testing::internal::PrettyUnitTestResultPrinter::OnTestIterationEnd (this=0x7fffd5ca4a68, unit_test=...) at gtest.cc:3589
8 0x00007ffff7f4daf9 in testing::internal::TestEventRepeater::OnTestIterationEnd (this=0x7fffd5c83770, unit_test=..., iteration=0) at gtest.cc:3852
9 0x00007ffff7f57570 in testing::internal::UnitTestImpl::RunAllTests (this=0x7fffd5d5c000) at gtest.cc:5737
10 0x00007ffff7fa3a84 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (object=0x7fffd5d5c000,
method=(bool (testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const)) 0x7ffff7f56f20 <testing::internal::UnitTestImpl::RunAllTests()>, location=0x7ffff7f11d9b "auxiliary test code (environments or event listeners)") at gtest.cc:2589
11 0x00007ffff7f71788 in testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (object=0x7fffd5d5c000,
method=(bool (testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const)) 0x7ffff7f56f20 <testing::internal::UnitTestImpl::RunAllTests()>, location=0x7ffff7f11d9b "auxiliary test code (environments or event listeners)") at gtest.cc:2625
12 0x00007ffff7f56ea3 in testing::UnitTest::Run (this=0x7ffff7fbcb80 <testing::UnitTest::GetInstance()::instance>) at gtest.cc:5291
The #22109 adds the check but at compilation time, which is pointless,
move the check into runtime.
Remember nested epoll is required for
async_socket_for_remote/use_hedged_requests, otherwise remote queries
may stuck.