-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#23492] DocDB: Upgrade and Rollback tests
Summary: Adding the framework to perform DB upgrades and rollbacks in unit tests. - `build.xml` stores the location of the builds for various os architecture and build types. We current use `linux_debug_x86`, `linux_release_x86`, `darwin_debug_arm64` and `darwin_release_arm64`. Jenkins covers all linux and darwin release types. Darwin debug is for use on dev mac machines. - Currently supports `2.20.2.4` and `2024.1.0.1` as older versions. New major versions will be added manually as they become available. Minor versions can be added on demand if the need for one arrises. - 2.20 linux builds are disabled since `post_install.sh` get stuck. - Builds are downloaded to the `/opt/yb-build/db-upgrade` directory if it does not already exist. - We do not maintain builds for ASAN and TSAN so these build types are not run. - `UpgradeTestBase` provides the framework to perform all Upgrade and Rollback actions. - `BasicUpgradeTest` tests upgrade and rollback using a simple bank balance workload. - D32492 changed the DocDB format for debug builds so that it is compatible with release builds. This change was not backported, so debug builds on version 2024.2, or older are generated after patching this change. #23492 Jira: DB-12406 Test Plan: BasicUpgradeTest, TestUpgradeFrom_2_20_2_4 BasicUpgradeTest, TestRollbackTo_2_20_2_4 BasicUpgradeTest, TestUpgradeFrom_2024_1_0_1 BasicUpgradeTest, TestRollbackTo_2024_1_0_1 Reviewers: asrivastava, tfoucher, slingam Reviewed By: asrivastava Subscribers: ybase Differential Revision: https://phorge.dev.yugabyte.com/D37153
- Loading branch information
Showing
15 changed files
with
1,066 additions
and
93 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
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
87 changes: 87 additions & 0 deletions
87
src/yb/integration-tests/external_mini_cluster-itest-base.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,87 @@ | ||
// Copyright (c) YugabyteDB, 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. | ||
// | ||
|
||
#include "yb/integration-tests/external_mini_cluster-itest-base.h" | ||
|
||
namespace yb { | ||
|
||
void ExternalMiniClusterITestBase::SetUpOptions(ExternalMiniClusterOptions& opts) { | ||
// Fsync causes flakiness on EC2. | ||
opts.extra_tserver_flags.push_back("--never_fsync"); | ||
} | ||
|
||
void ExternalMiniClusterITestBase::StartCluster( | ||
const std::vector<std::string>& extra_ts_flags, | ||
const std::vector<std::string>& extra_master_flags, int num_tablet_servers, int num_masters, | ||
bool enable_ysql) { | ||
ExternalMiniClusterOptions opts; | ||
opts.num_masters = num_masters; | ||
opts.num_tablet_servers = num_tablet_servers; | ||
opts.extra_master_flags = extra_master_flags; | ||
opts.extra_tserver_flags = extra_ts_flags; | ||
opts.enable_ysql = enable_ysql; | ||
|
||
ASSERT_OK(StartCluster(opts)); | ||
} | ||
|
||
Status ExternalMiniClusterITestBase::StartCluster(ExternalMiniClusterOptions opts) { | ||
SetUpOptions(opts); | ||
|
||
cluster_.reset(new ExternalMiniCluster(opts)); | ||
RETURN_NOT_OK(cluster_->Start()); | ||
inspect_.reset(new itest::ExternalMiniClusterFsInspector(cluster_.get())); | ||
ts_map_ = VERIFY_RESULT(itest::CreateTabletServerMap(cluster_.get())); | ||
client_ = VERIFY_RESULT(cluster_->CreateClient()); | ||
|
||
return Status::OK(); | ||
} | ||
|
||
void ExternalMiniClusterITestBase::TearDown() { | ||
client_.reset(); | ||
if (cluster_) { | ||
if (HasFatalFailure()) { | ||
LOG(INFO) << "Found fatal failure"; | ||
for (size_t i = 0; i < cluster_->num_tablet_servers(); i++) { | ||
if (!cluster_->tablet_server(i)->IsProcessAlive()) { | ||
LOG(INFO) << "Tablet server " << i << " is not running. Cannot dump its stacks."; | ||
continue; | ||
} | ||
LOG(INFO) << "Attempting to dump stacks of TS " << i << " with UUID " | ||
<< cluster_->tablet_server(i)->uuid() << " and pid " | ||
<< cluster_->tablet_server(i)->pid(); | ||
WARN_NOT_OK( | ||
PstackWatcher::DumpPidStacks(cluster_->tablet_server(i)->pid()), | ||
"Couldn't dump stacks"); | ||
} | ||
} | ||
cluster_->Shutdown(); | ||
} | ||
YBTest::TearDown(); | ||
ts_map_.clear(); | ||
} | ||
|
||
Result<TabletId> ExternalMiniClusterITestBase::GetSingleTabletId(const TableName& table_name) { | ||
TabletId tablet_id_to_split; | ||
for (size_t i = 0; i < cluster_->num_tablet_servers(); ++i) { | ||
const auto ts = cluster_->tablet_server(i); | ||
const auto tablets = VERIFY_RESULT(cluster_->GetTablets(ts)); | ||
for (const auto& tablet : tablets) { | ||
if (tablet.table_name() == table_name) { | ||
return tablet.tablet_id(); | ||
} | ||
} | ||
} | ||
return STATUS(NotFound, Format("No tablet found for table $0.", table_name)); | ||
} | ||
|
||
} // namespace yb |
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.