yugabyte / yugabyte-db

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

[DocDB] [DB Clone][YSQL] Create index fails in cloned DB #21624

Open Arjun-yb opened 3 months ago

Arjun-yb commented 3 months ago

Jira Link: DB-10519

Description

Version: 2.23.0.0-b36 Steps:

  1. Create database(demo1) and create snapshot schedule
  2. Create table(table1) and load some data
  3. Collect time(t1)
  4. Create an index
  5. Clone demo1 to demo2 at time t1
  6. Connect to Cloned DB(demo2) and create an index to the table(table1)

Observation: Create index fails with ERROR: Index 0000400d000030008000000000004005 not found in index_map. Current schema is 6 Describe table shows index as INVALID

Indexes:
    "t1_pkey" PRIMARY KEY, lsm (id HASH)
    "idx_4" lsm (name HASH) INVALID

Next create index works fine

Issue Type

kind/bug

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

yamen-haddad commented 1 month ago

This issue has the same root cause as https://github.com/yugabyte/yugabyte-db/issues/21016 and is fixed here. Tried to repro locally and the clone operation was successful. I also managed to create an index on the target database and verified that we are able to use index scan in some select queries. I am leaving the ticket open as I am planning to write a unit test to cover this case.