Skip to content

Commit

Permalink
[#23741] docdb: Add parameter to run PITR tests with clone instead
Browse files Browse the repository at this point in the history
Summary:
This diff adds a `RestoreType` parameter to some PITR tests in `yb-admin-snapshot-schedule-test` to test them with DB cloning. If `RestoreType` is set to `RestoreType::kClone`, `RestoreSnapshotSchedule` will clone to a separate database as of the restore time, instead of restoring over the source database. We now also refresh the connection with `ConnectToRestoredDb()`, which will connect to the appropriate database (the source db if using PITR, or the target db if using clone).

Fixes #23741

Jira: DB-12646

Test Plan: `./yb_build.sh build release --cxx-test yb-admin-snapshot-schedule-test`

Reviewers: mhaddad

Reviewed By: mhaddad

Subscribers: ybase

Differential Revision: https://phorge.dev.yugabyte.com/D37723
  • Loading branch information
SrivastavaAnubhav committed Sep 19, 2024
1 parent 2cc1480 commit af4c46d
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 72 deletions.
2 changes: 1 addition & 1 deletion src/yb/integration-tests/external_daemon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ void ExternalDaemon::Shutdown(SafeShutdown safe_shutdown, RequireExitCode0 requi
WARN_NOT_OK(process_->Wait(&ret), Format("$0 Waiting on $1", LogPrefix(), process_name_and_pid));
process_.reset();
LOG_WITH_PREFIX(INFO) << "Process " << process_name_and_pid << " shutdown completed in "
<< CoarseMonoClock::Now() - start_time << "ms";
<< ToMilliseconds(CoarseMonoClock::Now() - start_time) << "ms";
}

void ExternalDaemon::FlushCoverage() {
Expand Down
2 changes: 2 additions & 0 deletions src/yb/master/clone/clone_state_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ Status CloneStateManager::EnableDbConnections(const CloneStateInfoPtr& clone_sta
auto lock = clone_state->LockForWrite();
SCHECK_EQ(lock->pb.aggregate_state(), SysCloneStatePB::RESTORED, IllegalState,
"Expected clone to be in restored state");
LOG(INFO) << Format("Marking clone as complete for source namespace $0 with seq_no $1",
lock->pb.source_namespace_id(), lock->pb.clone_request_seq_no());
lock.mutable_data()->pb.set_aggregate_state(SysCloneStatePB::COMPLETE);
LOG(INFO) << Format(
"Marking clone of namespace: $0 as complete", lock->pb.source_namespace_id());
Expand Down
Loading

0 comments on commit af4c46d

Please sign in to comment.