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

fix(duplication): dup would get stuck in DS_PREPARE indefinitely once some error occurred during creating follower table #2144

Merged
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
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
CheckOptions: []
# Disable some checks that are not useful for us now.
# They are sorted by names, and should be consistent to build_tools/clang_tidy.py.
Checks: 'abseil-*,boost-*,bugprone-*,cert-*,clang-analyzer-*,concurrency-*,cppcoreguidelines-*,darwin-*,fuchsia-*,google-*,hicpp-*,linuxkernel-*,llvm-*,misc-*,modernize-*,performance-*,portability-*,readability-*,-bugprone-easily-swappable-parameters,-bugprone-lambda-function-name,-bugprone-macro-parentheses,-cert-err58-cpp,-concurrency-mt-unsafe,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-union-access,-fuchsia-default-arguments-calls,-fuchsia-overloaded-operator,-fuchsia-statically-constructed-objects,-google-readability-avoid-underscore-in-googletest-name,-hicpp-avoid-c-arrays,-hicpp-named-parameter,-hicpp-no-array-decay,-llvm-include-order,-misc-definitions-in-headers,-misc-non-private-member-variables-in-classes,-modernize-avoid-c-arrays,-modernize-replace-disallow-copy-and-assign-macro,-modernize-use-trailing-return-type,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-magic-numbers,-readability-named-parameter'
Checks: 'abseil-*,boost-*,bugprone-*,cert-*,clang-analyzer-*,concurrency-*,cppcoreguidelines-*,darwin-*,fuchsia-*,google-*,hicpp-*,linuxkernel-*,llvm-*,misc-*,modernize-*,performance-*,portability-*,readability-*,-bugprone-easily-swappable-parameters,-bugprone-lambda-function-name,-bugprone-macro-parentheses,-cert-err58-cpp,-concurrency-mt-unsafe,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-union-access,-fuchsia-default-arguments-calls,-fuchsia-overloaded-operator,-fuchsia-statically-constructed-objects,-google-readability-avoid-underscore-in-googletest-name,-hicpp-avoid-c-arrays,-hicpp-named-parameter,-hicpp-no-array-decay,-llvm-include-order,-misc-definitions-in-headers,-misc-non-private-member-variables-in-classes,-modernize-avoid-c-arrays,-modernize-replace-disallow-copy-and-assign-macro,-modernize-use-trailing-return-type,-performance-unnecessary-value-param,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-magic-numbers,-readability-named-parameter'
ExtraArgs:
ExtraArgsBefore: []
FormatStyle: none
Expand Down
1 change: 1 addition & 0 deletions build_tools/clang_tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def tidy_on_path(path):
"-modernize-avoid-c-arrays,"
"-modernize-replace-disallow-copy-and-assign-macro,"
"-modernize-use-trailing-return-type,"
"-performance-unnecessary-value-param,"
"-readability-function-cognitive-complexity,"
"-readability-identifier-length,"
"-readability-magic-numbers,"
Expand Down
13 changes: 9 additions & 4 deletions src/common/duplication_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,17 @@ namespace replication {

const std::string duplication_constants::kDuplicationCheckpointRootDir /*NOLINT*/ = "duplication";
const std::string duplication_constants::kClustersSectionName /*NOLINT*/ = "pegasus.clusters";
const std::string duplication_constants::kDuplicationEnvMasterClusterKey /*NOLINT*/ =
const std::string duplication_constants::kEnvMasterClusterKey /*NOLINT*/ =
"duplication.master_cluster";
const std::string duplication_constants::kDuplicationEnvMasterMetasKey /*NOLINT*/ =
"duplication.master_metas";
const std::string duplication_constants::kDuplicationEnvMasterAppNameKey /*NOLINT*/ =
const std::string duplication_constants::kEnvMasterMetasKey /*NOLINT*/ = "duplication.master_metas";
const std::string duplication_constants::kEnvMasterAppNameKey /*NOLINT*/ =
"duplication.master_app_name";
const std::string duplication_constants::kEnvFollowerAppStatusKey /*NOLINT*/
= "duplication.follower_app_status";
const std::string duplication_constants::kEnvFollowerAppStatusCreating /*NOLINT*/
= "creating";
const std::string duplication_constants::kEnvFollowerAppStatusCreated /*NOLINT*/
= "created";

/*extern*/ const char *duplication_status_to_string(duplication_status::type status)
{
Expand Down
10 changes: 7 additions & 3 deletions src/common/duplication_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,16 @@ struct duplication_constants
const static std::string kDuplicationCheckpointRootDir;
const static std::string kClustersSectionName;
// These will fill into app env and mark one app as a "follower app" and record master info
const static std::string kDuplicationEnvMasterClusterKey;
const static std::string kDuplicationEnvMasterMetasKey;
const static std::string kDuplicationEnvMasterAppNameKey;
const static std::string kEnvMasterClusterKey;
const static std::string kEnvMasterMetasKey;
const static std::string kEnvMasterAppNameKey;
const static std::string kEnvFollowerAppStatusKey;
const static std::string kEnvFollowerAppStatusCreating;
const static std::string kEnvFollowerAppStatusCreated;
};

USER_DEFINED_ENUM_FORMATTER(duplication_fail_mode::type)
USER_DEFINED_ENUM_FORMATTER(duplication_status::type)

} // namespace replication
} // namespace dsn
10 changes: 8 additions & 2 deletions src/meta/app_env_validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <utility>
#include <vector>

#include "common/duplication_common.h"
#include "common/replica_envs.h"
#include "http/http_status_code.h"
#include "utils/fmt_logging.h"
Expand Down Expand Up @@ -59,7 +60,7 @@ bool app_env_validator::validate_app_envs(const std::map<std::string, std::strin
}
std::string hint_message;
if (!validate_app_env(key, value, hint_message)) {
LOG_WARNING("app env '{}={}' is invalid, hint_message: {}", key, value, hint_message);
LOG_ERROR("app env '{}={}' is invalid, hint_message: {}", key, value, hint_message);
return false;
}
}
Expand Down Expand Up @@ -339,7 +340,12 @@ void app_env_validator::register_all_validators()
[](int64_t new_value) { return new_value == -1 || new_value >= 1; }}},
{replica_envs::MANUAL_COMPACT_PERIODIC_BOTTOMMOST_LEVEL_COMPACTION, mcblc},
{replica_envs::REPLICA_ACCESS_CONTROLLER_ALLOWED_USERS, {ValueType::kString}},
{replica_envs::REPLICA_ACCESS_CONTROLLER_RANGER_POLICIES, {ValueType::kString}}};
{replica_envs::REPLICA_ACCESS_CONTROLLER_RANGER_POLICIES, {ValueType::kString}},
{duplication_constants::kEnvMasterClusterKey, {ValueType::kString}},
{duplication_constants::kEnvMasterMetasKey, {ValueType::kString}},
{duplication_constants::kEnvMasterAppNameKey, {ValueType::kString}},
{duplication_constants::kEnvFollowerAppStatusKey, {ValueType::kString}},
};
}

const std::unordered_map<app_env_validator::ValueType, std::string>
Expand Down
Loading
Loading