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

[refactor](cloud) Extract SyncPoint to common cpp #37165

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ set(BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(ENV{DORIS_HOME} "${BASE_DIR}/..")
set(BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(GENSRC_DIR "${BASE_DIR}/../gensrc/build/")
set(COMMON_SRC_DIR "${BASE_DIR}/../common")
set(SRC_DIR "${BASE_DIR}/src/")
set(TEST_DIR "${CMAKE_SOURCE_DIR}/test/")
set(OUTPUT_DIR "${BASE_DIR}/output")
Expand Down Expand Up @@ -436,6 +437,7 @@ include_directories(

include_directories(
SYSTEM
${COMMON_SRC_DIR}
${GENSRC_DIR}/
${THIRDPARTY_DIR}/include
${GPERFTOOLS_HOME}/include
Expand Down Expand Up @@ -500,6 +502,7 @@ set(DORIS_LINK_LIBS
Pipeline
Cloud
${WL_END_GROUP}
CommonCPP
)

set(absl_DIR ${THIRDPARTY_DIR}/lib/cmake/absl)
Expand Down Expand Up @@ -765,6 +768,8 @@ if (MAKE_TEST)
add_subdirectory(${TEST_DIR})
endif ()

add_subdirectory(${COMMON_SRC_DIR}/cpp ${BUILD_DIR}/src/common_cpp)

# Install be
install(DIRECTORY DESTINATION ${OUTPUT_DIR})
install(DIRECTORY DESTINATION ${OUTPUT_DIR}/bin)
Expand Down
2 changes: 1 addition & 1 deletion be/src/cloud/cloud_base_compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "cloud/cloud_meta_mgr.h"
#include "cloud/config.h"
#include "common/config.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "gen_cpp/cloud.pb.h"
#include "olap/compaction.h"
#include "olap/task/engine_checksum_task.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/cloud/cloud_cumulative_compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "common/config.h"
#include "common/logging.h"
#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "gen_cpp/cloud.pb.h"
#include "olap/compaction.h"
#include "olap/cumulative_compaction_policy.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/cloud/cloud_cumulative_compaction_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "cloud/config.h"
#include "common/config.h"
#include "common/logging.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "olap/olap_common.h"
#include "olap/tablet.h"
#include "olap/tablet_meta.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/cloud/cloud_full_compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "cloud/config.h"
#include "common/config.h"
#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "gen_cpp/cloud.pb.h"
#include "olap/compaction.h"
#include "olap/rowset/beta_rowset.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/cloud/cloud_meta_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "cloud/pb_convert.h"
#include "common/logging.h"
#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "gen_cpp/FrontendService.h"
#include "gen_cpp/HeartbeatService_types.h"
#include "gen_cpp/Types_types.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/cloud/cloud_txn_delete_bitmap_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <shared_mutex>

#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "olap/olap_common.h"
#include "olap/tablet_meta.h"

Expand Down
33 changes: 23 additions & 10 deletions be/src/cloud/injection_point_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <mutex>

#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "http/http_channel.h"
#include "http/http_request.h"
#include "http/http_status.h"
Expand Down Expand Up @@ -213,17 +213,15 @@ void handle_set(HttpRequest* req) {
}

void handle_clear(HttpRequest* req) {
auto& point = req->param("name");
const auto& point = req->param("name");
auto* sp = SyncPoint::get_instance();
if (point.empty()) {
HttpChannel::send_reply(req, HttpStatus::BAD_REQUEST, "empty point name");
return;
}
auto sp = SyncPoint::get_instance();
if (point == "all") {
// If point name is emtpy, clear all
sp->clear_all_call_backs();
HttpChannel::send_reply(req, HttpStatus::OK, "OK");
return;
}

sp->clear_call_back(point);
HttpChannel::send_reply(req, HttpStatus::OK, "OK");
}
Expand All @@ -244,12 +242,20 @@ void handle_suite(HttpRequest* req) {
HttpChannel::send_reply(req, HttpStatus::INTERNAL_SERVER_ERROR, "unknown suite: " + suite);
}

} // namespace

InjectionPointAction::InjectionPointAction() {
void handle_enable(HttpRequest* req) {
SyncPoint::get_instance()->enable_processing();
HttpChannel::send_reply(req, HttpStatus::OK, "OK");
}

void handle_disable(HttpRequest* req) {
SyncPoint::get_instance()->disable_processing();
HttpChannel::send_reply(req, HttpStatus::OK, "OK");
}

} // namespace

InjectionPointAction::InjectionPointAction() = default;

void InjectionPointAction::handle(HttpRequest* req) {
LOG(INFO) << req->debug_string();
auto& op = req->param("op");
Expand All @@ -262,7 +268,14 @@ void InjectionPointAction::handle(HttpRequest* req) {
} else if (op == "apply_suite") {
handle_suite(req);
return;
} else if (op == "enable") {
handle_enable(req);
return;
} else if (op == "disable") {
handle_disable(req);
return;
}

HttpChannel::send_reply(req, HttpStatus::BAD_REQUEST, "unknown op: " + op);
}

Expand Down
3 changes: 0 additions & 3 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1264,9 +1264,6 @@ DEFINE_Validator(s3_client_http_scheme, [](const std::string& config) -> bool {
return config == "http" || config == "https";
});

// enable injection point in regression-test
DEFINE_mBool(enable_injection_point, "false");

DEFINE_mBool(ignore_schema_change_check, "false");

DEFINE_mInt64(string_overflow_size, "4294967295"); // std::numic_limits<uint32_t>::max()
Expand Down
3 changes: 0 additions & 3 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1344,9 +1344,6 @@ DECLARE_mInt32(thrift_client_open_num_tries);
// http scheme in S3Client to use. E.g. http or https
DECLARE_String(s3_client_http_scheme);

// enable injection point in regression-test
DECLARE_mBool(enable_injection_point);

DECLARE_mBool(ignore_schema_change_check);

/** Only use in fuzzy test **/
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/cache/block_file_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "common/config.h"
#include "common/logging.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/cache/file_block.h"
#include "io/cache/file_cache_common.h"
#include "io/cache/fs_file_cache_storage.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/cache/block_file_cache_downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "cloud/cloud_tablet_mgr.h"
#include "common/config.h"
#include "common/logging.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/fs/file_reader.h"
#include "io/io_common.h"
#include "olap/rowset/beta_rowset.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/cache/cached_remote_file_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "common/compiler_util.h" // IWYU pragma: keep
#include "common/config.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/cache/block_file_cache.h"
#include "io/cache/block_file_cache_factory.h"
#include "io/cache/block_file_cache_profile.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/cache/fs_file_cache_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <system_error>

#include "common/logging.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/cache/block_file_cache.h"
#include "io/cache/file_block.h"
#include "io/cache/file_cache_common.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/fs/hdfs_file_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "bvar/reducer.h"
#include "common/compiler_util.h" // IWYU pragma: keep
#include "common/logging.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/fs/err_utils.h"
#include "io/hdfs_util.h"
#include "service/backend_options.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/fs/hdfs_file_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "common/config.h"
#include "common/logging.h"
#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/cache/block_file_cache.h"
#include "io/cache/block_file_cache_factory.h"
#include "io/cache/file_cache_common.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/fs/local_file_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <utility>

#include "common/compiler_util.h" // IWYU pragma: keep
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/fs/err_utils.h"
#include "util/async_io.h"
#include "util/doris_metrics.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/fs/local_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <utility>

#include "common/exception.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "gutil/macros.h"
#include "io/fs/err_utils.h"
#include "io/fs/file_system.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/fs/local_file_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// IWYU pragma: no_include <opentelemetry/common/threadlocal.h>
#include "common/compiler_util.h" // IWYU pragma: keep
#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "gutil/macros.h"
#include "io/fs/err_utils.h"
#include "io/fs/file_writer.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/fs/s3_file_bufferpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "common/exception.h"
#include "common/logging.h"
#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/cache/file_block.h"
#include "io/cache/file_cache_common.h"
#include "io/fs/s3_common.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/fs/s3_file_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "common/config.h"
#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/cache/block_file_cache.h"
#include "io/cache/block_file_cache_factory.h"
#include "io/cache/file_block.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/fs/s3_obj_storage_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

#include "common/logging.h"
#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/fs/err_utils.h"
#include "io/fs/s3_common.h"
#include "util/bvar_helper.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "cloud/cloud_storage_engine.h"
#include "common/config.h"
#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/cache/block_file_cache_factory.h"
#include "io/fs/file_system.h"
#include "io/fs/file_writer.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/service/http_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void HttpService::register_cloud_handler(CloudStorageEngine& engine) {
run_status_compaction_action);
#ifdef ENABLE_INJECTION_POINT
InjectionPointAction* injection_point_action = _pool.add(new InjectionPointAction);
_ev_http_server->register_handler(HttpMethod::GET, "/api/injection_point/{op}/{name}",
_ev_http_server->register_handler(HttpMethod::GET, "/api/injection_point/{op}",
injection_point_action);
#endif
ClearFileCacheAction* clear_file_cache_action = _pool.add(new ClearFileCacheAction());
Expand Down
2 changes: 1 addition & 1 deletion be/src/util/s3_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "common/config.h"
#include "common/logging.h"
#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/fs/azure_obj_storage_client.h"
#include "io/fs/obj_storage_client.h"
#include "io/fs/s3_obj_storage_client.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/exec/format/wal/wal_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "agent/be_exec_version_manager.h"
#include "common/logging.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "gutil/strings/split.h"
#include "olap/wal/wal_manager.h"
#include "runtime/runtime_state.h"
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/sink/writer/vtablet_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <vector>

#include "cloud/config.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "util/runtime_profile.h"
#include "vec/data_types/data_type.h"
#include "vec/exprs/vexpr_fwd.h"
Expand Down
2 changes: 1 addition & 1 deletion be/test/io/cache/block_file_cache_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <vector>

#include "common/config.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "gtest/gtest_pred_impl.h"
#include "io/cache/block_file_cache.h"
#include "io/cache/block_file_cache_factory.h"
Expand Down
2 changes: 1 addition & 1 deletion be/test/io/fs/hdfs_file_system_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <gtest/gtest.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]

#include <gtest/gtest.h>
         ^


#include "common/config.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/fs/file_writer.h"
#include "io/fs/hdfs_file_writer.h"
#include "io/fs/local_file_system.h"
Expand Down
2 changes: 1 addition & 1 deletion be/test/io/fs/local_file_system_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <vector>

#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "gtest/gtest_pred_impl.h"
#include "io/fs/file_reader.h"
#include "io/fs/file_writer.h"
Expand Down
2 changes: 1 addition & 1 deletion be/test/io/fs/s3_file_writer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include "common/config.h"
#include "common/status.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "io/fs/file_reader.h"
#include "io/fs/file_system.h"
#include "io/fs/file_writer.h"
Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/exec/vwal_scanner_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <vector>

#include "common/object_pool.h"
#include "common/sync_point.h"
#include "cpp/sync_point.h"
#include "gen_cpp/Descriptors_types.h"
#include "gen_cpp/PlanNodes_types.h"
#include "io/fs/local_file_system.h"
Expand Down
Loading
Loading