-
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.
Support disaggregated tiflash mode (#6248)
close #6441
- Loading branch information
1 parent
f248fac
commit d8c369c
Showing
42 changed files
with
1,094 additions
and
132 deletions.
There are no files selected for viewing
Submodule client-c
updated
23 files
+66 −10 | include/pingcap/coprocessor/Client.h | |
+1 −0 | include/pingcap/kv/Backoff.h | |
+2 −2 | include/pingcap/kv/Cluster.h | |
+8 −2 | include/pingcap/kv/RegionCache.h | |
+1 −1 | include/pingcap/kv/RegionClient.h | |
+2 −0 | include/pingcap/kv/Rpc.h | |
+27 −0 | include/pingcap/kv/internal/type_traits.h | |
+1 −1 | include/pingcap/pd/Client.h | |
+368 −10 | src/coprocessor/Client.cc | |
+2 −0 | src/kv/Backoff.cc | |
+45 −4 | src/kv/RegionCache.cc | |
+18 −24 | src/pd/Client.cc | |
+7 −1 | src/test/CMakeLists.txt | |
+2 −0 | src/test/bank_test/bank_test_schrodinger.cc | |
+2 −2 | src/test/bank_test/bank_test_ut.cc | |
+297 −0 | src/test/batch_coprocessor_test.cc | |
+4 −13 | src/test/coprocessor_test.cc | |
+7 −7 | src/test/io_or_region_error_get_test.cc | |
+1 −1 | src/test/lock_resolve_test.cc | |
+1 −1 | src/test/mock_tikv.h | |
+1 −1 | src/test/real_tikv_test/2pc_test.cc | |
+1 −1 | src/test/region_split_test.cc | |
+88 −3 | src/test/test_helper.h |
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,57 @@ | ||
// Copyright 2022 PingCAP, Ltd. | ||
// | ||
// 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. | ||
|
||
#include <Common/Exception.h> | ||
#include <Core/TiFlashDisaggregatedMode.h> | ||
|
||
namespace DB | ||
{ | ||
DisaggregatedMode getDisaggregatedMode(const Poco::Util::LayeredConfiguration & config) | ||
{ | ||
static const std::string config_key = "flash.disaggregated_mode"; | ||
DisaggregatedMode mode = DisaggregatedMode::None; | ||
if (config.has(config_key)) | ||
{ | ||
std::string mode_str = config.getString(config_key); | ||
RUNTIME_ASSERT(mode_str == DISAGGREGATED_MODE_STORAGE || mode_str == DISAGGREGATED_MODE_COMPUTE, | ||
"Expect disaggregated_mode is {} or {}, got: {}", | ||
DISAGGREGATED_MODE_STORAGE, | ||
DISAGGREGATED_MODE_COMPUTE, | ||
mode_str); | ||
if (mode_str == DISAGGREGATED_MODE_COMPUTE) | ||
{ | ||
mode = DisaggregatedMode::Compute; | ||
} | ||
else | ||
{ | ||
mode = DisaggregatedMode::Storage; | ||
} | ||
} | ||
return mode; | ||
} | ||
|
||
std::string getProxyLabelByDisaggregatedMode(DisaggregatedMode mode) | ||
{ | ||
switch (mode) | ||
{ | ||
case DisaggregatedMode::Compute: | ||
return DISAGGREGATED_MODE_COMPUTE_PROXY_LABEL; | ||
case DisaggregatedMode::Storage: | ||
case DisaggregatedMode::None: | ||
return DEF_PROXY_LABEL; | ||
default: | ||
__builtin_unreachable(); | ||
}; | ||
} | ||
} // namespace DB |
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,37 @@ | ||
// Copyright 2022 PingCAP, Ltd. | ||
// | ||
// 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. | ||
|
||
#pragma once | ||
|
||
#include <Poco/Util/LayeredConfiguration.h> | ||
|
||
#include <string> | ||
|
||
#define DEF_PROXY_LABEL "tiflash" | ||
#define DISAGGREGATED_MODE_COMPUTE_PROXY_LABEL DISAGGREGATED_MODE_COMPUTE | ||
#define DISAGGREGATED_MODE_STORAGE "tiflash_storage" | ||
#define DISAGGREGATED_MODE_COMPUTE "tiflash_compute" | ||
|
||
namespace DB | ||
{ | ||
enum class DisaggregatedMode | ||
{ | ||
None, | ||
Compute, | ||
Storage, | ||
}; | ||
|
||
DisaggregatedMode getDisaggregatedMode(const Poco::Util::LayeredConfiguration & config); | ||
std::string getProxyLabelByDisaggregatedMode(DisaggregatedMode mode); | ||
} // namespace DB |
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.