Restoring a Backup with Multi Tenancy Enabled

Description

I am trying to restore a live weavaite backup on my local machine, the backup and restore runs without any errors but when i query the local version using the below query i get no results returned for the tenant id. If i swap to the live version and run the same query i get the expected results.

{
Get {
DocumentContent(tenant: “DyjtyjmdxGhunC4kynSjP2Pz4fI3”) {
brainGuid
documentGuid
}
DocumentSource(tenant: “DyjtyjmdxGhunC4kynSjP2Pz4fI3”) {
brainGuid
documentGuid
}
}
}

The code i am using to backup is:

const result = await this.client.backup.creator().withBackend(‘filesystem’).withBackupId(backupId).withWaitForCompletion(true).do();

The code i am using to restore is:

const result = await this.client.backup.restorer().withBackend(‘filesystem’).withBackupId(backupId).withWaitForCompletion(true).do();

Is there anything i am missing?

hi @AndyG !! Welcome to our community! :hugs:

I was not able to reproduce this.

Here are the steps in python I have used:

from weaviate import classes as wvc
collection = client.collections.create(
    "Test",
    vectorizer_config=wvc.config.Configure.Vectorizer.none(),
    multi_tenancy_config=wvc.config.Configure.multi_tenancy(enabled=True),
    properties=[
        wvc.config.Property(name="text", data_type=wvc.config.DataType.TEXT)
    ]
)

collection.tenants.create(
    ["tenant1", "tenant2"]
)

from weaviate import classes as wvc
t1 = collection.with_tenant("tenant1")
t1.data.insert({"text": "a text on tenant 1"})
t2 = collection.with_tenant("tenant2")
t2.data.insert({"text": "a text on tenant 2"})

t1.query.fetch_objects().objects[0].properties
t2.query.fetch_objects().objects[0].properties

# create the backup
client.backup.create(backup_id="first_backup", backend="filesystem")

# delete the collection
client.collections.delete("Test")

# now restore
client.backup.restore(backup_id="first_backup", backend="filesystem")

# this should print 
t1 = client.collections.get("Test").with_tenant("tenant1")
print(t1.query.fetch_objects().objects[0].properties)
#>>> {'text': 'a text on tenant 1'}

Also, check your server logs. You should see something like this:

weaviate-1  | {"action":"restapi_request","level":"debug","method":"POST","msg":"received HTTP request","time":"2024-06-11T14:30:20Z","url":{"Scheme":"","Opaque":"","User":null,"Host":"","Path":"/v1/backups/filesystem/first_backup/restore","RawPath":"","OmitHost":false,"ForceQuery":false,"RawQuery":"","Fragment":"","RawFragment":""}}
weaviate-1  | {"action":"try_restore","backend":"filesystem","backup_id":"first_backup","level":"info","msg":"","time":"2024-06-11T14:30:20Z","took":3977084}
weaviate-1  | {"action":"restore","backup_id":"first_backup","class":"Test","level":"info","msg":"successfully restored","time":"2024-06-11T14:30:20Z"}
weaviate-1  | {"action":"restore","backup_id":"first_backup","level":"info","msg":"backup restored successfully","time":"2024-06-11T14:30:20Z"}

Let me know if this helps!

Thanks!

Hi DudaNogueira,

Thanks for your reply, but unfortunately that doesn’t help, i’m not a python developer.

Could there be anything i am doing wrong when exporting from one weavaite store to another that might cause the issue i am facing? I.e any YAML settings that if different between the two setups could cause the import to screw up the tenant data?

The server version i am creating the backup on is 1.22.2 and the server i am importing the backup to is on version 1.24.1 could this cause the issue?

As i said before, the import works completely fine, the scheme is created but i am not able to access any data for the tenant id.

This is all i get back after running the above query…

{
“data”: {
“Get”: {
“DocumentContent”: ,
“DocumentSource”:
}
}
}

Oh, sorry. missed the js code.

But hey: you shouldn’t be restoring from different versions.

You backup in 1.22.2, and you restore to 1.22.2

Then you migrate.

Have you tried this approach?

Thanks!

No worries, and thanks for your quick response. I have just matched the server versions and it now returns the results, so thanks for that.

On a massive learning curve here but enjoying it. Thanks for all your hard work you guys do supporting the community!

1 Like

Glad to hear that, Andy!

If you face any issues, we are here to help on this journey!

Thanks!