Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Cant restore non default database #470

Open
PiyushBhatewara opened this issue Dec 4, 2024 · 1 comment
Open

[Bug]: Cant restore non default database #470

PiyushBhatewara opened this issue Dec 4, 2024 · 1 comment

Comments

@PiyushBhatewara
Copy link

Current Behavior

When we try to restore default database it works as expected.

When we try to restore non-default database with same data and collections it doesnt work

Expected Behavior

Restore should work for non-default database.

Steps To Reproduce

1. Create test database with below python script - 



### RUN THIS IN PYTHON
# Import python modules
import numpy as np
import random
import string
from pymilvus import connections, db, utility, Collection, FieldSchema, DataType, CollectionSchema

### CREATE A DATABASE WITH RANDOM DATA ###

db_name='test_db'

print("Connecting to Milvus server 127.0.0.1:19530 ...")
connections.connect(host="127.0.0.1",port="19530",alias="default")

print(f"Creating database {db_name} if it doesn't exist ...")
if not db_name in db.list_database():
 db.create_database(db_name)
 print(f"Database {db_name} created")
else:
 print(f"Database {db_name} already exists")
print("")

print(f"Connecting to database {db_name} ...")
connections.connect(host="127.0.0.1",port="19530",alias=db_name,db_name=db_name)

print(f"Collecting database info ...")
existing_collections = utility.list_collections(using=db_name)
if existing_collections:
 for existing_collection in existing_collections:
  ec = Collection(existing_collection,using=db_name, consistency_level="Strong")
  print(f"Existing collection {ec.name} has {ec.num_entities} rows")
 print("")
else:
 print("No collections exist")
print("")

num_collections = 1
print(f"Creating {num_collections} new collections in database {db_name} ...")
collections = []
primary_key = FieldSchema(name="id",dtype=DataType.INT64,is_primary=True)
vector = FieldSchema(name="vector",dtype=DataType.FLOAT_VECTOR,dim=768)
schema = CollectionSchema(fields = [primary_key, vector])
index_params = {"index_type": "IVF_FLAT","metric_type": "IP","params": {"nlist": 128}}
for i in range(num_collections):
 collection_name = 'test_col_' + ''.join(random.choice(string.ascii_lowercase) for i in range(7))
 collection = Collection(name=collection_name,schema=schema,using=db_name)
 collection.create_index(field_name="id")
 collection.create_index(field_name="vector",index_params=index_params,timeout=None)
 collections.append(collection)
 print(f"Collection {collection_name} created")

num_rows = 2
print(f"Inserting {num_rows} new random data rows into new collections ...")
for collection in collections:
 data = []
 for i in range(num_rows):
  data.append({"id": i, "vector": np.random.random(768)})
 collection.insert(data)
 collection.flush()
 print(f"{num_rows} rows inserted into collection {collection.name}")
print("Done")



Step 2 - Take Backup

Step 3 - Restore Backup


```text

/app # ./milvus-backup restore -n milvus_backup_a_3_dec_2024_6pm_test_col_qijpxck
0.0.1 (Built on unknown from Git SHA unknown)
[2024/12/04 00:16:49.260 +00:00] [INFO] [logutil/logutil.go:165] ["Log directory"] [configDir=]
[2024/12/04 00:16:49.260 +00:00] [INFO] [logutil/logutil.go:166] ["Set log file to "] [path=logs/backup.log]
[2024/12/04 00:16:49.261 +00:00] [INFO] [cmd/restore.go:47] ["restore cmd input args"] [args="[]"]
[2024/12/04 00:16:49.261 +00:00] [INFO] [core/backup_impl_restore_backup.go:31] ["receive RestoreBackupRequest"] [requestId=0dfd0c2c-b1d5-11ef-9160-6a2e9ce998de] [backupName=milvus_backup_a_3_dec_2024_6pm_test_col_qijpxck] [onlyMeta=false] [restoreIndex=false] [useAutoIndex=false] [dropExistCollection=false] [dropExistIndex=false] [skipCreateCollection=false] [collections="[]"] [CollectionSuffix=] [CollectionRenames={}] [async=false] [bucketName=] [path=] [databaseCollections=] [skipDiskQuotaCheck=false] [maxShardNum=0]
[2024/12/04 00:16:49.261 +00:00] [INFO] [core/backup_context.go:117] ["{Base:0xc00007edc0 MaxSegmentGroupSize:2147483648 BackupCollectionParallelism:4 BackupCopyDataParallelism:128 RestoreParallelism:2 KeepTempFiles:false GcPauseEnable:true GcPauseSeconds:7200 GcPauseAddress:http://localhost:9091}"]
[2024/12/04 00:16:49.261 +00:00] [INFO] [core/backup_context.go:118] ["{Base:0xc00007edc0 Enabled:true DebugMode:false SimpleResponse:true}"]
[2024/12/04 00:16:49.261 +00:00] [INFO] [core/backup_context.go:308] ["receive GetBackupRequest"] [requestId=0dfd1c4b-b1d5-11ef-9160-6a2e9ce998de] [backupName=milvus_backup_a_3_dec_2024_6pm_test_col_qijpxck] [backupId=] [bucketName=] [path=]
[2024/12/04 00:16:49.312 +00:00] [INFO] [storage/minio_chunk_manager.go:144] ["minio chunk manager init success."] [bucketname=pcz-milvus-backup] [root=backup]
[2024/12/04 00:16:49.388 +00:00] [INFO] [core/backup_context.go:385] ["finish GetBackupRequest"] [requestId=0dfd1c4b-b1d5-11ef-9160-6a2e9ce998de] [backupName=milvus_backup_a_3_dec_2024_6pm_test_col_qijpxck] [backupId=] [bucketName=] [path=]
[2024/12/04 00:16:49.388 +00:00] [INFO] [core/backup_impl_restore_backup.go:202] ["Collections to restore"] [collection_num=1]
[2024/12/04 00:16:49.401 +00:00] [INFO] [core/backup_impl_restore_backup.go:269] ["create database"] [database=test_db]
[2024/12/04 00:16:49.404 +00:00] [INFO] [core/backup_impl_restore_backup.go:358] ["Start collection level restore pool"] [parallelism=2]
[2024/12/04 00:16:49.405 +00:00] [INFO] [core/backup_impl_restore_backup.go:362] ["executeRestoreBackupTask start"] [backup_name=milvus_backup_a_3_dec_2024_6pm_test_col_qijpxck] [backupBucketName=pcz-milvus-backup] [backupPath=backup/milvus_backup_a_3_dec_2024_6pm_test_col_qijpxck]
[2024/12/04 00:16:49.405 +00:00] [INFO] [core/backup_impl_restore_backup.go:373] ["start restore"] [backup_db_name=test_db] [backup_collection_name=test_db] [target_db_name=test_db] [target_collection_name=test_/app #
[2024/12/04 00:16:49.405 +00:00] [INFO] [core/backup_impl_restore_backup.go:373] ["collection schema"] [backup_db_name=test_db] [backup_collection_name=test_db] [target_db_name=test_db] [target_collection_name=test_col_qijpxck] [skipDiskQuotaCheck=false] [maxShardNum=0] [fields="[{\"ID\":100,\"Name\":\"id\",\"PrimaryKey\":true,\"AutoID\":false,\"Description\":\"\",\"DataType\":5,\"TypeParams\":{},\"IndexParams\":{},\"IsDynamic\":false,\"IsPartitionKey\":false,\"IsClusteringKey\":false,\"ElementType\":0,\"DefaultValue\":null,\"Nullable\":false},{\"ID\":101,\"Name\":\"vector\",\"PrimaryKey\":false,\"AutoID\":false,\"Description\":\"\",\"DataType\":101,\"TypeParams\":{\"dim\":\"768\"},\"IndexParams\":{},\"IsDynamic\":false,\"IsPartitionKey\":false,\"IsClusteringKey\":false,\"ElementType\":0,\"DefaultValue\":null,\"Nullable\":false}]"]
[2024/12/04 00:16:49.429 +00:00] [INFO] [core/backup_impl_restore_backup.go:373] ["create collection"] [backup_db_name=test_db] [backup_collection_name=test_db] [target_db_name=test_db] [target_collection_name=test_col_qijpxck] [skipDiskQuotaCheck=false] [maxShardNum=0] [hasPartitionKey=false]
[2024/12/04 00:16:49.464 +00:00] [INFO] [storage/minio_chunk_manager.go:144] ["minio chunk manager init success."] [bucketname=pcz-milvus-b] [root=file]
[2024/12/04 00:16:49.465 +00:00] [INFO] [core/backup_impl_restore_backup.go:373] ["start restore partition"] [backup_db_name=test_db] [backup_collection_name=test_db] [target_db_name=test_db] [target_collection_name=test_col_qijpxck] [skipDiskQuotaCheck=false] [maxShardNum=0] [partition=_default]
[2024/12/04 00:16:49.469 +00:00] [INFO] [core/backup_impl_restore_backup.go:373] ["start restore l0 segments"] [backup_db_name=test_db] [backup_collection_name=test_db] [target_db_name=test_db] [target_collection_name=test_col_qijpxck] [skipDiskQuotaCheck=false] [maxShardNum=0] [global_l0_segment_num=0] [partition_l0_segment_num=1]
[2024/12/04 00:16:49.470 +00:00] [INFO] [common/workerpool.go:70] ["restore l0 segment "] [backup_db_name=test_db] [backup_collection_name=test_db] [target_db_name=test_db] [target_collection_name=test_col_qijpxck] [skipDiskQuotaCheck=false] [maxShardNum=0] [files=backup/milvus_backup_a_3_dec_2024_6pm_test_col_qijpxck/binlogs/delta_log/454366306856338179/454366306856338180/454366306856538274]
[2024/12/04 00:16:49.470 +00:00] [INFO] [core/backup_impl_restore_backup.go:755] ["milvus and backup store in different bucket, copy the data first"] [backup_db_name=test_db] [backup_collection_name=test_db] [target_db_name=test_db] [target_collection_name=test_col_qijpxck] [skipDiskQuotaCheck=false] [maxShardNum=0] [files="[backup/milvus_backup_a_3_dec_2024_6pm_test_col_qijpxck/binlogs/delta_log/454366306856338179/454366306856338180/454366306856538274]"] [copyDataPath=restore-temp-restore_2024_12_04_00_16_49_388115311-test_db-test_col_qijpxck/]
[2024/12/04 00:16:49.487 +00:00] [INFO] [core/backup_impl_restore_backup.go:791] ["execute bulk insert"] [db=test_db] [collection=test_col_qijpxck] [partition=_default] [files="[restore-temp-restore_2024_12_04_00_16_49_388115311-test_db-test_col_qijpxck/milvus_backup_a_3_dec_2024_6pm_test_col_qijpxck/binlogs/delta_log/454366306856338179/454366306856338180/454366306856538274/]"] [endTime=454366631748173825]
[2024/12/04 00:16:49.559 +00:00] [ERROR] [core/backup_impl_restore_backup.go:823] ["fail or timeout to bulk insert"] [error="import job does not exist, jobID=454366314212367666, dbID=1: importing data failed"] [errorVerbose="import job does not exist, jobID=454366314212367666, dbID=1: importing data failed\n(1) attached stack trace\n  -- stack trace:\n  | github.com/milvus-io/milvus-sdk-go/v2/client.handleRespStatus\n  | \t/go/pkg/mod/github.com/milvus-io/milvus-sdk-go/[email protected]/client/collection.go:39\n  | github.com/milvus-io/milvus-sdk-go/v2/client.(*GrpcClient).GetBulkInsertState\n  | \t/go/pkg/mod/github.com/milvus-io/milvus-sdk-go/[email protected]/client/insert.go:460\n  | github.com/zilliztech/milvus-backup/core.(*MilvusClient).GetBulkInsertState\n  | \t/app/core/milvus_sdk_wrapper.go:128\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).watchBulkInsertState\n  | \t/app/core/backup_impl_restore_backup.go:837\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).executeBulkInsert\n  | \t/app/core/backup_impl_restore_backup.go:821\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).executeRestoreCollectionTask.func3\n  | \t/app/core/backup_impl_restore_backup.go:636\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).executeRestoreCollectionTask.func8\n  | \t/app/core/backup_impl_restore_backup.go:755\n  | github.com/zilliztech/milvus-backup/internal/common.(*WorkerPool).work.func1\n  | \t/app/internal/common/workerpool.go:70\n  | golang.org/x/sync/errgroup.(*Group).Go.func1\n  | \t/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78\n  | runtime.goexit\n  | \t/usr/local/go/src/runtime/asm_amd64.s:1571\nWraps: (2) import job does not exist, jobID=454366314212367666, dbID=1: importing data failed\nError types: (1) *withstack.withStack (2) *errutil.leafError"] [taskId=454366314212367666] [targetCollectionName=test_col_qijpxck] [partitionName=_default] [stack="github.com/zilliztech/milvus-backup/core.(*BackupContext).executeBulkInsert\n\t/app/core/backup_impl_restore_backup.go:823\ngithub.com/zilliztech/milvus-backup/core.(*BackupContext).executeRestoreCollectionTask.func3\n\t/app/core/backup_impl_restore_backup.go:636\ngithub.com/zilliztech/milvus-backup/core.(*BackupContext).executeRestoreCollectionTask.func8\n\t/app/core/backup_impl_restore_backup.go:755\ngithub.com/zilliztech/milvus-backup/internal/common.(*WorkerPool).work.func1\n\t/app/internal/common/workerpool.go:70\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78"]
[2024/12/04 00:16:49.559 +00:00] [ERROR] [core/backup_impl_restore_backup.go:755] ["fail to bulk insert to partition"] [backup_db_name=test_db] [backup_collection_name=test_db] [target_db_name=test_db] [target_collection_name=test_col_qijpxck] [skipDiskQuotaCheck=false] [maxShardNum=0] [partition=_default] [error="import job does not exist, jobID=454366314212367666, dbID=1: importing data failed"] [errorVerbose="import job does not exist, jobID=454366314212367666, dbID=1: importing data failed\n(1) attached stack trace\n  -- stack trace:\n  | github.com/milvus-io/milvus-sdk-go/v2/client.handleRespStatus\n  | \t/go/pkg/mod/github.com/milvus-io/milvus-sdk-go/[email protected]/client/collection.go:39\n  | github.com/milvus-io/milvus-sdk-go/v2/client.(*GrpcClient).GetBulkInsertState\n  | \t/go/pkg/mod/github.com/milvus-io/milvus-sdk-go/[email protected]/client/insert.go:460\n  | github.com/zilliztech/milvus-backup/core.(*MilvusClient).GetBulkInsertState\n  | \t/app/core/milvus_sdk_wrapper.go:128\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).watchBulkInsertState\n  | \t/app/core/backup_impl_restore_backup.go:837\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).executeBulkInsert\n  | \t/app/core/backup_impl_restore_backup.go:821\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).executeRestoreCollectionTask.func3\n  | \t/app/core/backup_impl_restore_backup.go:636\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).executeRestoreCollectionTask.func8\n  | \t/app/core/backup_impl_restore_backup.go:755\n  | github.com/zilliztech/milvus-backup/internal/common.(*WorkerPool).work.func1\n  | \t/app/internal/common/workerpool.go:70\n  | golang.org/x/sync/errgroup.(*Group).Go.func1\n  | \t/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78\n  | runtime.goexit\n  | \t/usr/local/go/src/runtime/asm_amd64.s:1571\nWraps: (2) import job does not exist, jobID=454366314212367666, dbID=1: importing data failed\nError types: (1) *withstack.withStack (2) *errutil.leafError"] [stack="github.com/zilliztech/milvus-backup/core.(*BackupContext).executeRestoreCollectionTask.func8\n\t/app/core/backup_impl_restore_backup.go:755\ngithub.com/zilliztech/milvus-backup/internal/common.(*WorkerPool).work.func1\n\t/app/internal/common/workerpool.go:70\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78"]
[2024/12/04 00:16:49.559 +00:00] [INFO] [core/backup_impl_restore_backup.go:775] ["Delete temporary file"] [backup_db_name=test_db] [backup_collection_name=test_db] [target_db_name=test_db] [target_collection_name=test_col_qijpxck] [skipDiskQuotaCheck=false] [maxShardNum=0] [dir=restore-temp-restore_2024_12_04_00_16_49_388115311-test_db-test_col_qijpxck/]
[2024/12/04 00:16:49.574 +00:00] [ERROR] [core/backup_impl_restore_backup.go:375] ["executeRestoreCollectionTask failed"] [TargetDBName=test_db] [TargetCollectionName=test_col_qijpxck] [error="import job does not exist, jobID=454366314212367666, dbID=1: importing data failed"] [errorVerbose="import job does not exist, jobID=454366314212367666, dbID=1: importing data failed\n(1) attached stack trace\n  -- stack trace:\n  | github.com/milvus-io/milvus-sdk-go/v2/client.handleRespStatus\n  | \t/go/pkg/mod/github.com/milvus-io/milvus-sdk-go/[email protected]/client/collection.go:39\n  | github.com/milvus-io/milvus-sdk-go/v2/client.(*GrpcClient).GetBulkInsertState\n  | \t/go/pkg/mod/github.com/milvus-io/milvus-sdk-go/[email protected]/client/insert.go:460\n  | github.com/zilliztech/milvus-backup/core.(*MilvusClient).GetBulkInsertState\n  | \t/app/core/milvus_sdk_wrapper.go:128\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).watchBulkInsertState\n  | \t/app/core/backup_impl_restore_backup.go:837\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).executeBulkInsert\n  | \t/app/core/backup_impl_restore_backup.go:821\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).executeRestoreCollectionTask.func3\n  | \t/app/core/backup_impl_restore_backup.go:636\n  | github.com/zilliztech/milvus-backup/core.(*BackupContext).executeRestoreCollectionTask.func8\n  | \t/app/core/backup_impl_restore_backup.go:755\n  | github.com/zilliztech/milvus-backup/internal/common.(*WorkerPool).work.func1\n  | \t/app/internal/common/workerpool.go:70\n  | golang.org/x/sync/errgroup.(*Group).Go.func1\n  | \t/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78\n  | runtime.goexit\n  | \t/usr/local/go/src/runtime/asm_amd64.s:1571\nWraps: (2) import job does not exist, jobID=454366314212367666, dbID=1: importing data failed\nError types: (1) *withstack.withStack (2) *errutil.leafError"] [stack="github.com/zilliztech/milvus-backup/core.(*BackupContext).executeRestoreBackupTask.func1\n\t/app/core/backup_impl_restore_backup.go:375\ngithub.com/zilliztech/milvus-backup/internal/common.(*WorkerPool).work.func1\n\t/app/internal/common/workerpool.go:70\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78"]
[2024/12/04 00:16:49.575 +00:00] [ERROR] [core/backup_impl_restore_backup.go:339] ["execute restore collection fail"] [backupId=83e7bdf0-b1d4-11ef-9113-62d254af7ea2] [error="workerpool: execute job import job does not exist, jobID=454366314212367666, dbID=1: importing data failed"] [stack="github.com/zilliztech/milvus-backup/core.(*BackupContext).RestoreBackup\n\t/app/core/backup_impl_restore_backup.go:339\ngithub.com/zilliztech/milvus-backup/cmd.glob..func7\n\t/app/cmd/restore.go:84\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:876\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:990\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:918\ngithub.com/zilliztech/milvus-backup/cmd.Execute\n\t/app/cmd/root.go:35\nmain.main\n\t/app/main.go:24\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:250"]
workerpool: execute job import job does not exist, jobID=454366314212367666, dbID=1: importing data failed
duration:0 s



### Environment

_No response_

### Anything else?

_No response_
@huanghaoyuanhhy
Copy link
Collaborator

Hi, thank you for reporting this issue!

Could you please let us know the version of Milvus you're currently using? This looks like a known issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants