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

Add a config flash.use_autoscaler_without_s3 #7116

Merged
merged 11 commits into from
Mar 21, 2023
15 changes: 14 additions & 1 deletion dbms/src/Core/TiFlashDisaggregatedMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <Common/Exception.h>
#include <Core/TiFlashDisaggregatedMode.h>
#include <Poco/Util/LayeredConfiguration.h>

namespace DB
{
Expand Down Expand Up @@ -43,7 +44,6 @@ DisaggregatedMode getDisaggregatedMode(const Poco::Util::LayeredConfiguration &
return mode;
}

// todo: remove this after AutoScaler is stable.
bool useAutoScaler(const Poco::Util::LayeredConfiguration & config)
{
static const std::string autoscaler_config_key = "flash.use_autoscaler";
Expand All @@ -53,6 +53,19 @@ bool useAutoScaler(const Poco::Util::LayeredConfiguration & config)
return use_autoscaler;
}

// Use auto scaler without S3 disagg // TODO: remove it after S3 disagg is stable
bool useAutoScalerWithoutS3(const Poco::Util::LayeredConfiguration & config)
{
// Keep the behavior running disagg without S3 when auto scaler is enable.
// This is a special config that is only effecive when `flash.use_autoscaler`
// is true. Will be removed soon.
static const std::string autoscaler_config_key = "flash.use_autoscaler_without_s3";
bool use_autoscaler_without_s3 = false;
if (config.has(autoscaler_config_key))
use_autoscaler_without_s3 = config.getBool(autoscaler_config_key);
return use_autoscaler_without_s3;
}

std::string getProxyLabelByDisaggregatedMode(DisaggregatedMode mode)
{
switch (mode)
Expand Down
1 change: 1 addition & 0 deletions dbms/src/Core/TiFlashDisaggregatedMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ enum class DisaggregatedMode

DisaggregatedMode getDisaggregatedMode(const Poco::Util::LayeredConfiguration & config);
bool useAutoScaler(const Poco::Util::LayeredConfiguration & config);
bool useAutoScalerWithoutS3(const Poco::Util::LayeredConfiguration & config);
std::string getProxyLabelByDisaggregatedMode(DisaggregatedMode mode);
} // namespace DB
9 changes: 7 additions & 2 deletions dbms/src/Server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,7 @@ int Server::main(const std::vector<std::string> & /*args*/)

const auto disaggregated_mode = getDisaggregatedMode(config());
const auto use_autoscaler = useAutoScaler(config());
const bool use_autoscaler_without_s3 = useAutoScalerWithoutS3(config());

// Some Storage's config is necessary for Proxy
TiFlashStorageConfig storage_config;
Expand All @@ -971,8 +972,12 @@ int Server::main(const std::vector<std::string> & /*args*/)
}
else if (disaggregated_mode == DisaggregatedMode::Compute && use_autoscaler)
{
// compute node with auto scaler, the requirements will be initted later.
storage_config.s3_config.enable(/*check_requirements*/ false, log);
if (!use_autoscaler_without_s3)
{
// compute node with auto scaler, the requirements will be initted later.
storage_config.s3_config.enable(/*check_requirements*/ false, log);
}
// else keep the behavior running disagg without S3 when auto scaler is enable.
}

if (storage_config.format_version != 0)
Expand Down