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

autoTenantCreation not working - object insert returns tenant not found #4931

Closed
1 task done
owieboy opened this issue May 15, 2024 · 2 comments
Closed
1 task done

Comments

@owieboy
Copy link

owieboy commented May 15, 2024

How to reproduce this bug?

Create/update a collection and set the following properties

{
...
   "multiTenancyConfig": {
        "enabled": true,
        "autoTenantCreation": true
      },
...
}

Verify property was successfully set:
GET http://localhost:8080/v1/schema/TestSchema

...
    "multiTenancyConfig": {
        "autoTenantCreation": true,
        "enabled": true
    },
...

Using REST API, insert this test object and set tenant with a value for tenant name that has not been (manually) created yet:
POST http://localhost:8080/v1/objects

{
  "class": "TestSchema",
  "properties": {
    "account_id": "1"
  },
  "vector": [
    1
  ],
  "tenant": "TEST1234"
}

What is the expected behavior?

  • Tenant TEST1234 to be created
  • Test object inserted to the tenant

What is the actual behavior?

Result:

{
    "error": [
        {
            "message": "put object: import into index nsobject: determine shard: tenant not found: \"TEST1234\""
        }
    ]
}

Supporting information

image

Server Version

1.25.0-rc.0

Code of Conduct

@owieboy owieboy added the bug label May 15, 2024
@reyreaud-l reyreaud-l added type-bug and removed bug labels May 16, 2024
@parkerduckworth
Copy link
Member

Hey @owieboy thanks for your report!

Auto tenant creation is actually only available during batch importing.

This wasn't super clear in the docs, and we have since made a change to clarify this.

Additionally, I've improved the error message that occurs in this case (multi-tenancy and autoTenantCreation are enabled, and a single object insert is attempted with a non-existent tenant) here with #4948. This will be included in the next patch release, 1.25.1.

Apologies for the miscommunication on our part!

@owieboy
Copy link
Author

owieboy commented May 16, 2024

Thank you for the the clarifications. I can confirm that the tenant auto creation and data insertion indeed work when using batch operation.

POST http://localhost:{{WEAVIATE_PORT}}/v1/batch/objects

{
  "fields": [
    "ALL"
  ],
  "objects": [
    {
    "class": "TestSchema",
    "properties": {
        "account_id": "1"
    },
    "vector": [
        1
    ],
    "tenant": "TSTDRV1234"
    }
  ]
}

response:

[
    {
        "class": "TestSchema",
        "creationTimeUnix": 1715893985742,
        "id": "99b56cb4-9f7c-49af-9f75-d047d74c05df",
        "lastUpdateTimeUnix": 1715893985742,
        "properties": {
            "account_id": "1"
        },
        "tenant": "TSTDRV12344",
        "vector": [
            1
        ],
        "deprecations": null,
        "result": {
            "status": "SUCCESS"
        }
    }
]

@owieboy owieboy closed this as completed May 16, 2024
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

3 participants