yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
8.69k stars 1.04k forks source link

[DocDB][DB Clone][YSQL] DB Cloning should be blocked if clone is triggered on existing database(target DB) #21630

Open Arjun-yb opened 4 months ago

Arjun-yb commented 4 months ago

Jira Link: DB-10525

Description

Version: 2.23.0.0-b36 Steps:

  1. Create database(demo1) and create snapshot schedule
  2. Create table and load some data
  3. Create another database(demo2)
  4. Clone demo1 to demo2

Observations

  1. Clone command from demo1 db to demo2 db works
  2. Cloning process(operation) fails
  3. After that if user wants to clone demo1 to any other DB then it fails with

Error running clone_namespace: Already present (yb/master/clone/clone_state_manager.cc:368): Cannot create new clone state because there is already an ongoing clone for source namespace 00004024000030008000000000000000 in state 2

Expected: Clone should block(throw an appropriate error message) in case if user mistakenly uses the existing database(As target DB) to clone.

Issue Type

kind/bug

Warning: Please confirm that this issue does not contain any sensitive information

SrivastavaAnubhav commented 1 month ago

This should be retested since we expect it is fixed after we added the ABORTED state