Support Clang Thread Safety Analysis

What problem does this PR solve?
Issue Number: ref #6834, ref https://github.com/pingcap/tiflash/issues/6350
What is changed and how it works?

Clang Thread Safety Analysis is a C++ language extension which warns about potential race conditions in code. The analysis is completely static (i.e. compile-time); there is no run-time overhead. For more information, please check https://clang.llvm.org/docs/ThreadSafetyAnalysis.html.
Support Clang Thread Safety Analysis in TiFlash (-DENABLE_TSA=ON).
Usage:

cmake .. \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_BUILD_TYPE=RELWITHDEBINFO \
-DENABLE_TSA=ON \
-GNinja

Annotated SegmentReadTaskScheduler and MergedTaskPool with thread-safety-analysis attributes.
The main problem of TiFlash's existing code is that the analyzer doesn't recognize move semantics and RVO, so it can't support code like below:

Disable with NO_THREAD_SAFETY_ANALYSIS.

void func()
{
    auto lock = acquireLock();
    // ...
    // error: releasing mutex 'xxx' that was not held
}

Check List
Tests

[ ] Unit test
[ ] Integration test
[ ] Manual test (add detailed scripts or steps below)
[ ] No code

Side effects

[ ] Performance regression: Consumes more CPU
[ ] Performance regression: Consumes more Memory
[ ] Breaking backward compatibility

Documentation

[ ] Affects user behaviors
[ ] Contains syntax changes
[ ] Contains variable changes
[ ] Contains experimental features
[ ] Changes MySQL compatibility

Release note

None

The unit test build is broken
[2023-11-08T02:52:00.551Z] /usr/local/bin/ccache /usr/local/bin/clang++ -DAWS_SDK_VERSION_MAJOR=1 -DAWS_SDK_VERSION_MINOR=11 -DAWS_SDK_VERSION_PATCH=186 -DBOOST_BIND_GLOBAL_PLACEHOLDERS -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_SYSTEM_NO_DEPRECATED -DCARES_STATICLIB -DDBMS_PUBLIC_GTEST -DFIU_ENABLE -DGTEST_HAS_POSIX_RE=0 -DLZ4_DISABLE_DEPRECATE_WARNINGS=1 -DLZ4_FAST_DEC_LOOP=1 -DMULTIPLE_CONTEXT_GTEST -DPOCO_STATIC -DPOCO_UNBUNDLED_ZLIB -DSTACK_LINE_READER_BUFFER_SIZE=1024 -DTIFLASH_COMPILER_VPCLMULQDQ_SUPPORT=1 -DTIFLASH_ENABLE_AVX512_SUPPORT=1 -DTIFLASH_ENABLE_AVX_SUPPORT=1 -DTIFLASH_SOURCE_PREFIX=\"/home/jenkins/agent/workspace/tiflash-build-common/tiflash\" -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/libsparsehash -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/dbms/src -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/GmSSL/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/tiflash-proxy/raftstore-proxy/ffi/src -I/home/jenkins/agent/workspace/tiflash-build-common/build/dbms/src -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/libbtrie/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/abseil-cpp -I/home/jenkins/agent/workspace/tiflash-build-common/build/contrib/etcd -I/home/jenkins/agent/workspace/tiflash-build-common/build/contrib/etcd/etcd -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/grpc/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/double-conversion -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/boost -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/xxHash -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/libpcg-random/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/libcityhash/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/libs/libcommon/include -I/home/jenkins/agent/workspace/tiflash-build-common/build/libs/libcommon/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/libs/libpocoext/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/poco/Data/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/poco/Foundation/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/zlib-ng -I/home/jenkins/agent/workspace/tiflash-build-common/build/contrib/zlib-ng -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/poco/Util/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/poco/XML/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/poco/JSON/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/poco/Net/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/cctz/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/jemalloc/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/jemalloc-cmake/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/cpu_features/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/libcpuid/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/lz4/lib -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/zstd/lib -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/client-c/third_party/libfiu/libfiu -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/prometheus-cpp/core/include -I/home/jenkins/agent/workspace/tiflash-build-common/build/contrib/prometheus-cpp-cmake/core/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/prometheus-cpp/push/include -I/home/jenkins/agent/workspace/tiflash-build-common/build/contrib/prometheus-cpp-cmake/push/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/prometheus-cpp/pull/include -I/home/jenkins/agent/workspace/tiflash-build-common/build/contrib/prometheus-cpp-cmake/pull/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/cpptoml -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/magic_enum/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/poco/NetSSL_OpenSSL/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/poco/Crypto/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/xxHash/cmake_unofficial/.. -I/home/jenkins/agent/workspace/tiflash-build-common/build/contrib/kvproto/cpp -I/home/jenkins/agent/workspace/tiflash-build-common/build/contrib/kvproto/cpp/kvproto -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/client-c/include -I/home/jenkins/agent/workspace/tiflash-build-common/build/contrib/grpc/third_party/cares/cares -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/grpc/third_party/cares/cares -I/home/jenkins/agent/workspace/tiflash-build-common/build/contrib/tipb/cpp -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/libdivide -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/libmetrohash/src -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/libfarmhash -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/libs/libdaemon/include -I/home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/libunwind/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/boringssl/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/aws/src/aws-cpp-sdk-core/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/build/contrib/aws-cmake/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/aws/generated/src/aws-cpp-sdk-s3/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/aws/generated/src/aws-cpp-sdk-sts/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/aws-c-auth/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/aws-c-common/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/aws-c-io/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/aws-crt-cpp/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/aws-c-mqtt/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/aws-c-sdkutils/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/protobuf/src -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/libs/libprocess_metrics/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/fmtlib-cmake/../fmtlib/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/libs/libsymbolization/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/re2 -isystem /home/jenkins/agent/workspace/tiflash-build-common/build/contrib/re2-cmake -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/googletest/googletest/include -isystem /home/jenkins/agent/workspace/tiflash-build-common/tiflash/contrib/googletest/googletest -Wthread-safety  -pipe -mssse3 -msse4.1 -msse4.2 -mpclmul -mpopcnt  -fno-omit-frame-pointer  -Wall -Wno-unused-command-line-argument  -Wnon-virtual-dtor  -stdlib=libc++ -Wextra -Werror  -O0 -fverbose-asm -fno-inline  -D_LIBCPP_DEBUG=0 -Wno-unknown-pragmas -Wno-deprecated-copy -pthread -fPIC -DDUMMY_BACKTRACE -std=gnu++20 -MD -MT dbms/CMakeFiles/gtests_dbms.dir/src/Storages/KVStore/tests/gtest_read_index_worker.cpp.o -MF dbms/CMakeFiles/gtests_dbms.dir/src/Storages/KVStore/tests/gtest_read_index_worker.cpp.o.d -o dbms/CMakeFiles/gtests_dbms.dir/src/Storages/KVStore/tests/gtest_read_index_worker.cpp.o -c /home/jenkins/agent/workspace/tiflash-build-common/tiflash/dbms/src/Storages/KVStore/tests/gtest_read_index_worker.cpp
[2023-11-08T02:52:00.553Z] /home/jenkins/agent/workspace/tiflash-build-common/tiflash/dbms/src/Storages/KVStore/tests/gtest_read_index_worker.cpp:202:13: error: releasing mutex '_' that was not held [-Werror,-Wthread-safety-analysis]
[2023-11-08T02:52:00.553Z]             }
[2023-11-08T02:52:00.553Z]             ^
[2023-11-08T02:52:00.553Z] 1 error generated.


Better timeout options

When I upload 100Mb of data I get a time out. This PR solves that issue.

Could it be possible to let the user override a default parameter ?

To make it simple, define a parameter there https://github.com/dizda/CloudBackupBundle/blob/master/Resources/config/services.yml#L1, so a user will be able to override it directly from the parameters.yml

Yeah, agreed. This is not usually something you want to change... ever. You have my update this afternoon.

Super! Thanks for the PR!

I'm still running in with timeout issues. I tried to update the DriveClient to upload files in chunks but I'm not too sure it works either..

Could you copy the exception you get?

Sure:
{
   "class":"Google_IO_Exception",
   "message":"Operation timed out after 100000 milliseconds with 0 bytes received",
   "code":28,
   "file":"/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/google/apiclient/src/Google/IO/Curl.php:118",
   "trace":[
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/google/apiclient/src/Google/IO/Abstract.php:136",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/google/apiclient/src/Google/Http/MediaFileUpload.php:145",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/google/apiclient/src/Google/Http/MediaFileUpload.php:196",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/dizda/cloud-backup-bundle/Dizda/CloudBackupBundle/Client/GoogleDriveClient.php:255",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/dizda/cloud-backup-bundle/Dizda/CloudBackupBundle/Client/GoogleDriveClient.php:193",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/dizda/cloud-backup-bundle/Dizda/CloudBackupBundle/Client/GoogleDriveClient.php:56",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/dizda/cloud-backup-bundle/Dizda/CloudBackupBundle/Manager/ClientManager.php:61",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/dizda/cloud-backup-bundle/Dizda/CloudBackupBundle/Manager/BackupManager.php:69",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/dizda/cloud-backup-bundle/Dizda/CloudBackupBundle/Command/BackupCommand.php:36",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:256",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:846",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:189",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:96",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:120",
      "/home/sites/io.happyr.demo/sf/releases/20151029094226/app/console:27"
   ]
}

This is the demo database.. It's less that 5Mb. Im now trying to use the google/client: 1.1.4

I have no idea man..

It is an interesting problem. I see the problem on different machines, different applications, different google accounts, file sizes vary between 500kB, 7MB and 100MB.
The problem is not even consistent. It shows up about 50% of the times I try...
When I try the example it works every time... At least from the local machine...
I'll investigate further..

I created new google API credentials and now it seams to work... Really strange bug.
I don't know if this PR helps to solve the issue. But anyhow; now we upload files in chunks and you may configure the timeout.

Oh ok.
What what are the advantages to upload files in chunks?

That's the recommended way of upload big files. Sending large request might fail on slow networks.. and you'll get timeouts..

Alright, so if you're agree, I merge it.

Please. Thank you.


About the Oracle setting in open world object detection task

@JosephKJ Thank you for your great work.
Can you tell me whether the tx_train_with_ukn.yml config is the setting of Oracle in Tab. 2? Does it need other datasets than tx_voc_coco_2007_val_with_known_and_unk?
Using these configs, I can not reproduce the results.
The results in the paper:

and reproduced:

Hi @csuhan , did you manage to reproduce results?


Add .editorconfig style rules

re-enforce requested project file formats and basic character-level coding style
emphasize the Win/DOS requirement that BAT/CMD files must have CRLF line endings

.# Discussion
Using EditorConfig style rules helps devs to maintain the file formatting and style of the project, even while using different editors. This minimizes the semi-invisible, but, paradoxically, visually noisy, whitespace differences between commits. It can also help enforce file format requirements (such as the Win/DOS CMD shell requiring CRLF line endings for correct functioning of BAT/CMD files).

Good stuff :+1:


Insert argument templates

Insert argument templates only when there are no arguments after completion.

I was suffering from this behavior for about a year.
Now I'm happy ;)

:grin:

Well actually I think there is a better solution: use two hotkeys: one to complete only function/method name and another one to complete it with templates.
It will fix my issue and also it will be possible to complete function name without parenthesis. It's required e.g. when I wish to pass a function as an argument.
What if RET will work as "full" completion and TAB as complete name only?

I honestly don't know. If you ask me I prefer seeing function signature separately and never using any kind of templates. But in some editors it's problematic, for example in sublime text 3 that I'm using right now. I know fancy GoSublime shows the signature in the status bar when you put cursor on the function, but I mean when you actually select autocompletion candidate.
So if we imagine a perfect text editor, I would say there should be a way to make a popup hint of some sort that stays for some time. Like you definitely need some sort of eye tracking here, as long as you look at the hint popup, it's relevant. Variants with pressing buttons or pedals are possible, but I don't know.
Very hard problem to solve. Contextual help that you need sometimes maybe if you really want to and for undefined amount of time. And you can't distract yourself managing this thing, because you're busy doing other things.

Consider the following (bold - templates):
log.Out RET -> log.Output(calldepth int, s string)
log.Out TAB -> log.Ouput
In company-mode
RET — company-complete-selection
TAB — company-complete-common
so I think applying template on selection only makes sense.

Yes, I understand what you mean, but if we talk about company mode I think it's possible to do that outside of gocode. You just do two key bindings, one of which temporarly sets an option to disable templates. If users want that, they'll do it.
E.g. I have a binding which does something similar:
; saving without NL at the end
(global-set-key (kbd "C-x S") (lambda ()
				(interactive)
				(let ((orig require-final-newline))
				  (setq require-final-newline nil)
				  (save-buffer)
				  (setq require-final-newline orig))))

Even though I rarely use emacs these days, I don't like when plugins redefine essential keys like RET and TAB.
We could just add that recipe to README.

It would be great.


Remove unused and unnecessary method from the configuration

What does this PR do?
Remove unused and unnecessary method from the configuration

/merge


Convert all .format() strings to f-strings

Now that we have pylint enabled as part of #2292, this should be covered by enabling the currently-disabled consider-using-f-string pylint rule and investigating/fixing/disabling every warning it reports.