Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tiflash proxy version to adopt bugfix from TiKV in release 6.0 #4489

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
706d7c3
Tracing: Add tracing_id to PageStorage snapshot (#4330)
JaySon-Huang Mar 18, 2022
f48d803
Fix problems introduced by symbolization (#4334)
SchrodingerZhu Mar 18, 2022
358d528
fix: remove basename (#4343)
SchrodingerZhu Mar 18, 2022
5f163e6
share PageStorage V3 inside tiflash instance (#4220)
lidezhu Mar 19, 2022
a489493
*: Introduce Logger for replacing LogWithPrefix (#4354)
fuzhe1989 Mar 21, 2022
0f38afb
fix cannot find path error when pass relative data path to dt_workloa…
lidezhu Mar 21, 2022
f2d36c1
Fix `max_caps` may not been update after GC (#4323)
jiaqizho Mar 21, 2022
e8d5962
Grafana: correct figure name (#4341)
fzhedu Mar 21, 2022
91653bc
update client-c to fix random keepalive timeout issue (#4357)
windtalker Mar 21, 2022
2bd5626
Improve LogWithPrefix of mpp (#4209)
SeaRise Mar 21, 2022
48c78f9
Fix restore problems in PageStorage. (#4350)
jiaqizho Mar 21, 2022
ef608ee
refine `appendFinalProjectFor(Non)RootQueryBlock` in analyzer (#4052)
SeaRise Mar 21, 2022
b0542e5
Fix ThreadSanitizer: `std::localtime()` is not thread-safe. (#4344)
Lloyd-Pottiger Mar 21, 2022
3566265
tune default setting: async_pollers_per_cq (#4359)
bestwoody Mar 21, 2022
5c21a37
feat: more symbolization support (#4361)
SchrodingerZhu Mar 21, 2022
e919a61
fix: elim sign comparison in basedaemon (#4368)
SchrodingerZhu Mar 22, 2022
288aa19
Fix special NewDecimal type passed from TiDB (#4329)
yibin87 Mar 22, 2022
2b71569
Add metric to record end to end time to pre-handle snapshot (#3978)
CalvinNeo Mar 22, 2022
68906ed
Fix wrong result of cast(float as decimal) when overflow happens (#4380)
guo-shaoge Mar 23, 2022
64a9a3a
*: replace LogWithPrefix by Logger (#4356)
fuzhe1989 Mar 23, 2022
ada3bc7
Storages/DeltaMerge/tools: Refine statistical data. (#4363)
JinheLin Mar 23, 2022
f17c420
make DeltaValueSpace::info thread safe (#4393)
lidezhu Mar 23, 2022
c813519
Remove useless file scanning when using v3 (#4395)
JaySon-Huang Mar 23, 2022
c880866
Scheduler no throw in destruction and avoid updated min-tso query han…
fzhedu Mar 23, 2022
189ceb0
Fix lint and remove unused member in `FunctionsString` (#4382)
JaySon-Huang Mar 23, 2022
d5d89c3
Improve log in `dbms/src/client`, `dbms/src/common`, and `dbms/src/da…
Lloyd-Pottiger Mar 23, 2022
303950f
Clean useless code in `dbms/src/Flash/DiagnosticsService.cpp` (#4401)
solotzg Mar 23, 2022
6ab3623
replace `LOG_XXX` with `LOG_FMT_XXX` in `dbms/src/DataStreams`, `dbms…
Lloyd-Pottiger Mar 24, 2022
6301306
Logger: Refactor dmfile reader and add tracing_logger (#4379)
JaySon-Huang Mar 24, 2022
18ba35e
`Poco_INCLUDE_DIRS` should not be a cached entry (#4384)
gengliqi Mar 24, 2022
2e4d859
add more checks for background segment split (#4406)
lidezhu Mar 24, 2022
a314e93
Remove duplicated streams code. (#4413)
ywqzzy Mar 24, 2022
a671d6b
*: add macro RUNTIME_CHECK and RUNTIME_ASSERT (#4398)
fuzhe1989 Mar 24, 2022
801e26b
Fix data race in gtest_rate_limiter.cpp (#4421)
JinheLin Mar 24, 2022
928e919
Add some log to make it easier to observe data skew (#4404)
windtalker Mar 25, 2022
0475ab9
chores(cmake): bump version to 3.21.0 (#4162)
SchrodingerZhu Mar 25, 2022
fccac53
Improve storages log (#4364)
Lloyd-Pottiger Mar 25, 2022
ac37930
replace `LOG_XXX` with `LOG_FMT_XXX` in `dbms/src/Dictionaries`, `dbm…
Lloyd-Pottiger Mar 25, 2022
474bb67
update TiFlash Proxy to fix disk mount point name in dashboard (#4431)
CalvinNeo Mar 25, 2022
a3f804e
fix a bug that ExchangeReceiver can't be canceled (#4441)
bestwoody Mar 25, 2022
460dc00
Exception msg (#4443)
fzhedu Mar 25, 2022
225dabe
Fix license checker (#4446)
solotzg Mar 26, 2022
759e416
Fix hardlink may cause dead loop, also disable config gc_hardlink_rat…
JaySon-Huang Mar 28, 2022
5af4530
Add env for using the bundled protoc for building tiflash-proxy (#4461)
JaySon-Huang Mar 28, 2022
e5a78d3
Fix data race of DeltaIndexManager. (#4459)
JinheLin Mar 28, 2022
6cfbd20
disable stacktrace related test for sanitized UT (#4463)
SchrodingerZhu Mar 28, 2022
0a484f7
override `IProfilingBlockInputStream.readSuffixImpl` instead of `IPro…
SeaRise Mar 28, 2022
27384f8
*: Fix saving reference to temporary object (#4477)
JaySon-Huang Mar 29, 2022
b317a50
replace LOG_TRACE with LOG_FMT_TRACE. (#4375)
ywqzzy Mar 29, 2022
6899e2f
doc: Use collapsed blocks to make it more friendly for readers (#4370)
breezewish Mar 29, 2022
5b00cc6
Replace `LOG_XXX` with `LOG_FMT_XXX` (#4480)
Lloyd-Pottiger Mar 29, 2022
e49339b
BlobStore support multipath. (#3938)
jiaqizho Mar 29, 2022
88cd33d
update
CalvinNeo Mar 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/licenserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ header:
- '**/NOTICE'
- 'dbms/src/IO/tests/limit_read_buffer.reference'
- 'dbms/src/IO/tests/DevicePixelRatio'
- 'Cargo.lock'
- 'Cargo.toml'
- 'rust-toolchain'

comment: on-failure
16 changes: 9 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@
# limitations under the License.

project (TiFlash)
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.21)

set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${TiFlash_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_MACOSX_RPATH 1)

# Rust jobs may modify global toolchain settings. We make rust related jobs sequentially scheduled
# by putting them in a job pool with single concurrency.
set_property(GLOBAL PROPERTY JOB_POOLS rust_job_pool=1)

option(TIFLASH_ENABLE_LLVM_DEVELOPMENT "enable facilities for development with LLVM" OFF)

if(CMAKE_PREFIX_PATH)
Expand Down Expand Up @@ -111,8 +107,7 @@ endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# clang: warning: argument unused during compilation: '-stdlib=libc++'
# clang: warning: argument unused during compilation: '-specs=/usr/share/dpkg/no-pie-compile.specs' [-Wunused-command-line-argument]
# clang: warning: private field 'hash_salt' is not used [-Wunused-private-field]
set (COMMON_WARNING_FLAGS "${COMMON_WARNING_FLAGS} -Wno-unused-command-line-argument -Wno-unused-private-field")
set (COMMON_WARNING_FLAGS "${COMMON_WARNING_FLAGS} -Wno-unused-command-line-argument")
endif ()

if (ARCH_LINUX)
Expand Down Expand Up @@ -442,3 +437,10 @@ add_subdirectory (dbms)

include (cmake/print_include_directories.cmake)

# Building a rust project may require setting up toolchains. Rustup cannot handle parallel requests, hence it may fail to
# finish the setup if multiple projects want to install a same version. To mitigate the situation, we force cargo targets
# to be invoked sequentially by adding linear dependency relations between them.
# Another way to do so is to use JOB_POOL with single concurrency. However, it is Ninja specific and it seems to have bugs
# with a large number of threads.
include (cmake/sequential.cmake)
build_sequentially (symbolization tiflash_proxy)
189 changes: 110 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TiFlash
![tiflash-architecture](tiflash-architecture.png)

[TiFlash](https://docs.pingcap.com/tidb/stable/tiflash-overview) is a columnar storage component of [TiDB](https://docs.pingcap.com/tidb/stable). It mainly plays the role of Analytical Processing (AP) in the Hybrid Transactional/Analytical Processing (HTAP) architecture of TiDB.
[TiFlash](https://docs.pingcap.com/tidb/stable/tiflash-overview) is a columnar storage component of [TiDB](https://docs.pingcap.com/tidb/stable). It mainly plays the role of Analytical Processing (AP) in the Hybrid Transactional/Analytical Processing (HTAP) architecture of TiDB.

TiFlash stores data in columnar format and synchronizes data updates in real-time from [TiKV](https://github.com/tikv/tikv) by Raft logs with sub-second latency. Reads in TiFlash are guaranteed transactionally consistent with Snapshot Isolation level. TiFlash utilizes Massively Parallel Processing (MPP) computing architecture to accelerate the analytical workloads.

Expand All @@ -17,122 +17,137 @@ And the following operating systems:
* Linux
* MacOS

### Checkout Source Code
### 1. Checkout Source Code

Assume `$WORKSPACE` to be the directory under which the TiFlash repo is placed.

```bash
```shell
cd $WORKSPACE
git clone --recursive https://github.com/pingcap/tiflash.git
```

### Prerequisites
### 2. Prepare Prerequisites

The following packages are needed for all platforms:
- CMake 3.13.2+
- Rust
```bash

- CMake 3.21.0+

- Rust: Recommended to use [rustup](https://rustup.rs) to install:

```shell
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain nightly
source $HOME/.cargo/env
```

- Python 3.0+

- Ninja or GNU Make

The following are platform-specific prerequisites.
The following are platform-specific prerequisites. Click to expand details:

#### Linux
<details>
<summary><b>Linux specific prerequisites</b></summary>

TiFlash can be built using either LLVM or GCC toolchain on Linux. LLVM toolchain is our official one for releasing.
> But for GCC, only GCC 7.x is supported as far, and is not planned to be a long term support. So it may get broken some day, silently.

##### LLVM 13.0.0+
- LLVM 13.0.0+

TiFlash compiles using full LLVM toolchain (`clang/compiler-rt/libc++/libc++abi`) by default.
To quickly set up a LLVM environment, you can use TiFlash Development Environment (short as TiFlash Env, see `release-centos7-llvm/env`).
Or you can also use system-wise toolchain if you can install `clang/compiler-rt/libc++/libc++abi` in your environment.
TiFlash compiles using full LLVM toolchain (`clang/compiler-rt/libc++/libc++abi`) by default.
To quickly set up a LLVM environment, you can use TiFlash Development Environment (short as TiFlash Env, see `release-centos7-llvm/env`).
You may also use a system-wise toolchain if `clang/compiler-rt/libc++/libc++abi` can be installed in your environment.

###### TiFlash Env
Click sections below to see detailed instructions:

TiFlash Env can be created with the following commands (`docker` and `tar xz` are needed):
<details>
<summary><b>Set up LLVM via TiFlash Env</b></summary>

```bash
cd $WORKSPACE/tiflash/release-centos7-llvm/env
make tiflash-env-$(uname -m).tar.xz
```
TiFlash Env can be created with the following commands (`docker` and `tar xz` are needed):

Then copy and uncompress `tiflash-env-$(uname -m).tar.xz` to a suitable place, assuming `$TIFLASH_ENV`.
```shell
cd $WORKSPACE/tiflash/release-centos7-llvm/env
make tiflash-env-$(uname -m).tar.xz
```

To enter the env (before compiling TiFlash):
Then copy and uncompress `tiflash-env-$(uname -m).tar.xz` to a suitable place, assuming `$TIFLASH_ENV`.

```bash
cd $TIFLASH_ENV
./loader
```
To enter the env (before compiling TiFlash):

Or you can dump the env settings and put them to the end of your `~/.bashrc` or `~/.zshrc`
```shell
cd $TIFLASH_ENV
./loader
```

```bash
cd $TIFLASH_ENV
./loader-env-dump
```
Or you can dump the env settings and put them to the end of your `~/.bashrc` or `~/.zshrc`

```shell
cd $TIFLASH_ENV
./loader-env-dump
```

###### System-wise Toolchain
</details>

- Debian/Ubuntu users:
<details>
<summary><b>Set up LLVM via package managers in Debian/Ubuntu</b></summary>

```bash
```shell
# add LLVM repo key
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -

# install LLVM packages
apt-get install clang-13 lldb-13 lld-13 clang-tools-13 clang-13-doc libclang-common-13-dev libclang-13-dev libclang1-13 clang-format-13 clangd-13 clang-tidy-13 libc++-13-dev libc++abi-13-dev libomp-13-dev llvm-13-dev libfuzzer-13-dev

# install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
apt-get install clang-13 lldb-13 lld-13 clang-tools-13 clang-13-doc libclang-common-13-dev libclang-13-dev libclang1-13 clang-format-13 clangd-13 clang-tidy-13 libc++-13-dev libc++abi-13-dev libomp-13-dev llvm-13-dev libfuzzer-13-dev

# install other dependencies
apt-get install lcov cmake ninja-build libssl-dev zlib1g-dev libcurl4-openssl-dev
```

- Archlinux users:
</details>

<details>
<summary><b>Set up LLVM via package managers in Archlinux</b></summary>

```bash
```shell
# install compilers and dependencies
sudo pacman -S clang libc++ libc++abi compiler-rt openmp lcov cmake ninja curl openssl zlib

# install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
```

</details>

##### GCC 7.x
- GCC 7.x

> **WARNING**: This support may not be maintained in the future.
> **WARNING**: This support may not be maintained in the future.

TiFlash compiles on GCC 7.x (no older, nor newer) only because it hasn't been broken. If you have GCC 7.x, you are probably fine, for now.
TiFlash compiles on GCC 7.x (no older, nor newer) only because it hasn't been broken. If you have GCC 7.x, you are probably fine, for now.

#### MacOS
</details>

<details>
<summary><b>MacOS specific prerequisites</b></summary>

- Apple Clang 12.0.0+
- OpenSSL 1.1
```bash

```shell
brew install [email protected]
```

### Build
</details>

### 3. Build

Assume `$BUILD` to be the directory under which you want to build TiFlash.

For Ninja:

```bash
```shell
cd $BUILD
cmake $WORKSPACE/tiflash -Gninja
ninja tiflash
```

For GNU Make:

```bash
```shell
cd $BUILD
cmake $WORKSPACE/tiflash
make tiflash -j
Expand All @@ -142,57 +157,73 @@ After building, you can get TiFlash binary under `$BUILD/dbms/src/Server/tiflash

### Build Options

TiFlash has several build options to tweak the build, mostly for development purposes.
TiFlash has several CMake build options to tweak for development purposes. These options SHOULD NOT be changed for production usage, as they may introduce unexpected build errors and unpredictable runtime behaviors.

> **WARNING**: These options SHOULD NOT be tuned for production usage, as they may introduce unexpected build errors and unpredictable runtime behaviors.
To tweat options, pass one or multiple `-D...=...` args when invoking CMake, for example:

They are all CMake options thus are specified using `-D...=...`s in CMake command line.
```shell
cmake $WORKSPACE/tiflash -DCMAKE_BUILD_TYPE=DEBUG
```

#### Build Types
- **Build Type**:

- `CMAKE_BUILD_TYPE`: `DEBUG` / `RELWITHDEBINFO` (default) / `RELEASE`
- `-DCMAKE_BUILD_TYPE=RELWITHDEBINFO`: Release build with debug info (default)

#### Build with Unit Tests
- `-DCMAKE_BUILD_TYPE=DEBUG`: Debug build

- `ENABLE_TESTS`: `ON` / `OFF` (default)
- `-DCMAKE_BUILD_TYPE=RELEASE`: Release build

#### Build with System Libraries
- **Build with Unit Tests**:

For local development, it is sometimes handy to use pre-installed third-party libraries in the system, rather than to compile them from sources of the bundled (internal) submodules.
- `-DENABLE_TESTS=OFF`: Default

Options are supplied to control whether to use internal third-party libraries (bundled in TiFlash) or to try using the pre-installed system ones.
- `-DENABLE_TESTS=ON`

> **WARNING**: It is NOT guaranteed that TiFlash would still build if any of the system libraries are used.
> Build errors are very likely to happen, almost all the time.
- **Build with System Libraries**:

You can view these options along with their descriptions by running:
<details>
<summary>Click to expand instructions</summary>

```bash
cd $BUILD
cmake -LH | grep "USE_INTERNAL" -A3
```
For local development, it is sometimes handy to use pre-installed third-party libraries in the system, rather than to compile them from sources of the bundled (internal) submodules.

Options are supplied to control whether to use internal third-party libraries (bundled in TiFlash) or to try using the pre-installed system ones.

> **WARNING**: It is NOT guaranteed that TiFlash would still build if any of the system libraries are used.
> Build errors are very likely to happen, almost all the time.

You can view these options along with their descriptions by running:

```shell
cd $BUILD
cmake -LH | grep "USE_INTERNAL" -A3
```

All of these options are default as `ON`, as the names tell, using the internal libraries and build from sources.

There is another option to append extra paths for CMake to find system libraries:

- `PREBUILT_LIBS_ROOT`: Default as empty, can be specified with multiple values, seperated by `;`

All of these options are default as `ON`, as the names tell, using the internal libraries and build from sources.
Specifically, for [TiFlash proxy](https://github.com/pingcap/tidb-engine-ext):

There is another option to append extra paths for CMake to find system libraries:
- `USE_INTERNAL_TIFLASH_PROXY=TRUE` (default) / `FALSE`

- `PREBUILT_LIBS_ROOT`: Default as empty, can be specified with multiple values, seperated by `;`
One may want to use external TiFlash proxy, e.g., if he is developing TiFlash proxy together with TiFlash, assume `$TIFLASH_PROXY_REPO` to be the path to the external TiFlash proxy repo

Specifically, for [TiFlash proxy](https://github.com/pingcap/tidb-engine-ext):
Usually need to be combined with `PREBUILT_LIBS_ROOT=$TIFLASH_PROXY_REPO`, and `$TIFLASH_PROXY_REPO` should have the following directory structure:

- `USE_INTERNAL_TIFLASH_PROXY`: `TRUE` (default) / `FALSE`
- One may want to use external TiFlash proxy, e.g., if he is developing TiFlash proxy together with TiFlash, assume `$TIFLASH_PROXY_REPO` to be the path to the external TiFlash proxy repo
- Usually need to be combined with `PREBUILT_LIBS_ROOT=$TIFLASH_PROXY_REPO`, and `$TIFLASH_PROXY_REPO` should have the following directory structure:
- Header files are under directory `$TIFLASH_PROXY_REPO/raftstore-proxy/ffi/src`

- Built library is under directory `$TIFLASH_PROXY_REPO/target/release`

</details>
### IDE Support

Normally a CMake-based IDE, e.g., Clion and VSCode, should be able to open TiFlash project with no pain as long as the toolchains are properly configured.

If your toolchain is set up using [TiFlash Env](#tiflash-env), and you may not want to add those libs to your system loader config, you can pass the following CMake options to your IDE:

```
```shell
-DCMAKE_PREFIX_PATH=$TIFLASH_ENV
```

Expand All @@ -212,7 +243,7 @@ TBD.
[//]: <> (TODO: Should refine to use local commands rather than docker.)
To get a coverage report of unit tests, we recommend using the docker image and our scripts.

```
```shell
docker run --rm -it -v /path/to/tiflash/src:/build/tiflash hub.pingcap.net/tiflash/tiflash-llvm-base:amd64 /bin/bash # or aarch64
cd /build/tiflash/release-centos7-llvm
sh scripts/build-tiflash-ut-coverage.sh
Expand Down Expand Up @@ -246,7 +277,7 @@ Before submitting a pull request, please use [format-diff.py](format-diff.py) to

> **NOTE**: It is required to use clang-format 12.0.0+.

```
```shell
cd $WORKSPACE/tiflash
python3 format-diff.py --diff_from `git merge-base ${TARGET_REMOTE_BRANCH} HEAD`
```
2 changes: 1 addition & 1 deletion cmake/Modules/FindPoco.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ endif()

# if installed directory structure, set full include dir
if(Poco_INSTALLED)
set(Poco_INCLUDE_DIRS ${Poco_ROOT_DIR}/include/ CACHE PATH "The global include path for Poco")
set(Poco_INCLUDE_DIRS ${Poco_ROOT_DIR}/include/)
endif()

# append the default minimum components to the list to find
Expand Down
4 changes: 4 additions & 0 deletions cmake/find_tiflash_proxy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ endif()
set(TIFLASH_PROXY_FOUND TRUE)

message(STATUS "Using tiflash proxy: ${USE_INTERNAL_TIFLASH_PROXY} : ${TIFLASH_PROXY_INCLUDE_DIR}, ${TIFLASH_PROXY_LIBRARY}")

if (NOT USE_INTERNAL_TIFLASH_PROXY)
add_custom_target(tiflash_proxy ALL DEPENDS ${TIFLASH_PROXY_LIBRARY})
endif()
Loading