-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
elect one tiflash node as gc owner (#6863)
ref #6827
- Loading branch information
1 parent
6a56277
commit a5e2362
Showing
41 changed files
with
6,163 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule client-c
updated
4 files
+2 −0 | include/pingcap/pd/Client.h | |
+5 −0 | include/pingcap/pd/IClient.h | |
+4 −1 | include/pingcap/pd/MockPDClient.h | |
+8 −1 | src/pd/Client.cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
project (etcd) | ||
|
||
cmake_minimum_required (VERSION 3.5) | ||
|
||
set (CMAKE_CXX_STANDARD 17) | ||
|
||
if (CMAKE_VERSION VERSION_LESS "3.8.0") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z") | ||
else () | ||
set (CMAKE_CXX_STANDARD 17) | ||
set (CMAKE_CXX_EXTENSIONS 1) # https://cmake.org/cmake/help/latest/prop_tgt/CXX_EXTENSIONS.html#prop_tgt:CXX_EXTENSIONS | ||
set (CMAKE_CXX_STANDARD_REQUIRED ON) | ||
endif () | ||
|
||
if (NOT Protobuf_INCLUDE_DIR OR NOT gRPC_FOUND OR NOT ABSL_ROOT_DIR) | ||
message(FATAL_ERROR "protobuf/grpc/absl not found! protobuf: ${Protobuf_INCLUDE_DIR} grpc: ${gRPC_FOUND} absl: ${ABSL_ROOT_DIR}") | ||
endif () | ||
|
||
# .proto files under "proto" | ||
set (PROTO_DEF_DIR "${CMAKE_CURRENT_SOURCE_DIR}/proto") | ||
file (GLOB PROTO_DEFS "${PROTO_DEF_DIR}/*.proto") | ||
# # .proto files under "include" | ||
set (PROTO_INC_DEF_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") | ||
get_filename_component (PROTO_INC_DEF_DIR ${PROTO_INC_DEF_DIR} ABSOLUTE) | ||
file (GLOB PROTO_INC_DEFS "${PROTO_INC_DEF_DIR}/*.proto") | ||
list (APPEND PROTO_INC_DEFS | ||
"${PROTO_INC_DEF_DIR}/google/api/http.proto" | ||
"${PROTO_INC_DEF_DIR}/google/api/annotations.proto" | ||
) | ||
# The output dir for .pb.h, .pb.cc. Generated under build directory. | ||
set (PROTO_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/etcd") | ||
file (MAKE_DIRECTORY "${PROTO_OUTPUT_DIR}") | ||
message(STATUS ".pb.h, .pb.cc of etcd are generated under ${PROTO_OUTPUT_DIR}") | ||
# A temporary directory for proto file without gogoproto marks | ||
set (PROTO_DEF_TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/proto") | ||
file (MAKE_DIRECTORY "${PROTO_DEF_TMP_DIR}") | ||
|
||
set (CLEAN_PROTO_DEFS "") | ||
foreach (F ${PROTO_DEFS}) | ||
get_filename_component (ABS_FIL ${F} ABSOLUTE) | ||
get_filename_component (FIL_WE ${F} NAME_WE) | ||
list (APPEND CLEAN_PROTO_DEFS "${PROTO_DEF_TMP_DIR}/${FIL_WE}.proto") | ||
# Generate a output file by copying and cleaning up gogoproto marks. | ||
# Will be re-generated if the original .proto file is changed. | ||
add_custom_command( | ||
OUTPUT "${PROTO_DEF_TMP_DIR}/${FIL_WE}.proto" | ||
WORKING_DIRECTORY ${PROTO_DEF_DIR} | ||
COMMAND cp ${ABS_FIL} ${PROTO_DEF_TMP_DIR}/${FIL_WE}.proto | ||
COMMAND bash -c "source ${CMAKE_CURRENT_SOURCE_DIR}/common.sh && clean_gogo_proto ${PROTO_DEF_TMP_DIR}/${FIL_WE}.proto" | ||
DEPENDS ${ABS_FIL} | ||
COMMENT "Generating clean proto file on ${ABS_FIL}" | ||
VERBATIM) | ||
endforeach() | ||
# Grab all clean .proto files as a target | ||
add_custom_target (__clean_etcd_defs | ||
DEPENDS ${CLEAN_PROTO_DEFS} | ||
VERBATIM) | ||
|
||
set (PROTO_SRCS "") | ||
set (PROTO_HDRS "") | ||
foreach (F ${PROTO_INC_DEFS}) # .proto under "include" | ||
get_filename_component (ABS_FIL ${F} ABSOLUTE) | ||
# We need relative path for .proto under subdirectory | ||
string(REPLACE "${PROTO_INC_DEF_DIR}/" "" RELA_FIL ${ABS_FIL}) | ||
string(REPLACE ".proto" ".pb.cc" PROTO_SRC ${RELA_FIL}) | ||
string(REPLACE ".proto" ".pb.h" PROTO_HDR ${RELA_FIL}) | ||
|
||
# message(STATUS "${F} ${ABS_FIL} ${RELA_FIL}") | ||
list (APPEND PROTO_SRCS "${PROTO_OUTPUT_DIR}/${PROTO_SRC}") | ||
list (APPEND PROTO_HDRS "${PROTO_OUTPUT_DIR}/${PROTO_HDR}") | ||
# Create the generated cpp files for .proto file. | ||
# Add dependency on the original .proto file | ||
# so that it can re-generate source files if .proto changed. | ||
add_custom_command( | ||
OUTPUT "${PROTO_OUTPUT_DIR}/${PROTO_SRC}" | ||
"${PROTO_OUTPUT_DIR}/${PROTO_HDR}" | ||
WORKING_DIRECTORY ${PROTO_INC_DEF_DIR} | ||
COMMAND ${Protobuf_PROTOC_EXECUTABLE} | ||
ARGS --cpp_out=${PROTO_OUTPUT_DIR} -I=${PROTO_DEF_TMP_DIR}:${PROTO_INC_DEF_DIR} ${RELA_FIL} | ||
DEPENDS ${ABS_FIL} ${Protobuf_PROTOC_EXECUTABLE} __clean_etcd_defs | ||
COMMENT "Running C++ protocol buffer compiler on ${ABS_FIL}" | ||
VERBATIM) | ||
endforeach() # end for .proto under "include" | ||
foreach (F ${PROTO_DEFS}) # .proto under "proto" | ||
get_filename_component (ABS_FIL ${F} ABSOLUTE) | ||
get_filename_component (FIL_WE ${F} NAME_WE) | ||
|
||
# message(STATUS "${F} ${ABS_FIL}") | ||
list (APPEND PROTO_SRCS "${PROTO_OUTPUT_DIR}/${FIL_WE}.pb.cc") | ||
list (APPEND PROTO_HDRS "${PROTO_OUTPUT_DIR}/${FIL_WE}.pb.h") | ||
# Need to appen grpc services files | ||
list (APPEND PROTO_SRCS "${PROTO_OUTPUT_DIR}/${FIL_WE}.grpc.pb.cc") | ||
list (APPEND PROTO_HDRS "${PROTO_OUTPUT_DIR}/${FIL_WE}.grpc.pb.h") | ||
# Create the generated cpp files for .proto file. | ||
# Add dependency on the original .proto file and `__clean_etcd_defs` | ||
# so that it can re-generate source files if .proto changed. | ||
add_custom_command( | ||
OUTPUT "${PROTO_OUTPUT_DIR}/${FIL_WE}.pb.cc" | ||
"${PROTO_OUTPUT_DIR}/${FIL_WE}.pb.h" | ||
WORKING_DIRECTORY ${PROTO_DEF_TMP_DIR} | ||
COMMAND ${Protobuf_PROTOC_EXECUTABLE} | ||
ARGS --cpp_out=${PROTO_OUTPUT_DIR} -I=${PROTO_DEF_TMP_DIR}:${PROTO_INC_DEF_DIR} ${PROTO_DEF_TMP_DIR}/${FIL_WE}.proto | ||
# And also grpc service | ||
COMMAND ${Protobuf_PROTOC_EXECUTABLE} | ||
ARGS --grpc_out=${PROTO_OUTPUT_DIR} -I=${PROTO_DEF_TMP_DIR}:${PROTO_INC_DEF_DIR} --plugin=protoc-gen-grpc=${gRPC_CPP_PLUGIN} ${PROTO_DEF_TMP_DIR}/${FIL_WE}.proto | ||
DEPENDS ${ABS_FIL} ${Protobuf_PROTOC_EXECUTABLE} ${gRPC_CPP_PLUGIN} __clean_etcd_defs | ||
COMMENT "Running C++ protocol buffer compiler on ${ABS_FIL}" | ||
VERBATIM) | ||
endforeach() # end for .proto under "proto" | ||
|
||
# Mark those clean .proto, .pb.h, .pb.cc files are generated | ||
# so that they can be re-build if changed and clean by `make clean` | ||
set_source_files_properties( | ||
${CLEAN_PROTO_DEFS} ${PROTO_SRCS} ${PROTO_HDRS} | ||
PROPERTIES GENERATED TRUE | ||
) | ||
|
||
add_library(etcdpb | ||
${PROTO_SRCS} ${PROTO_HDRS} | ||
) | ||
target_link_libraries(etcdpb | ||
absl::synchronization | ||
) | ||
target_include_directories(etcdpb PUBLIC | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
${CMAKE_CURRENT_BINARY_DIR}/etcd | ||
${Protobuf_INCLUDE_DIR} | ||
${gRPC_INCLUDE_DIRS} | ||
) | ||
target_no_warning(etcdpb deprecated-declarations) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
6d1bfe4f9927340e4a5bf41f592dae02dadb45ba | ||
tag v3.4.24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
function push() { | ||
pushd $1 >/dev/null 2>&1 | ||
} | ||
|
||
function pop() { | ||
popd >/dev/null 2>&1 | ||
} | ||
|
||
function sed_inplace() | ||
{ | ||
# bsd sed does not support --version. | ||
if `sed --version > /dev/null 2>&1`; then | ||
sed -i "$@" | ||
else | ||
sed -i '' "$@" | ||
fi | ||
} | ||
|
||
function clean_gogo_proto() | ||
{ | ||
local file=$1 | ||
sed_inplace '/gogo.proto/d' ${file} | ||
sed_inplace '/option\ *(gogoproto/d' ${file} | ||
sed_inplace -e 's/\[.*gogoproto.*\]//g' ${file} | ||
} | ||
export -f clean_gogo_proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2015, Google Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
package google.api; | ||
|
||
import "google/api/http.proto"; | ||
import "google/protobuf/descriptor.proto"; | ||
|
||
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; | ||
option java_multiple_files = true; | ||
option java_outer_classname = "AnnotationsProto"; | ||
option java_package = "com.google.api"; | ||
option objc_class_prefix = "GAPI"; | ||
|
||
extend google.protobuf.MethodOptions { | ||
// See `HttpRule`. | ||
HttpRule http = 72295728; | ||
} |
Oops, something went wrong.