Closed moldovangeorge closed 2 years ago
No plans for this currently. The idea is that the existing login-based multi-tenancy architecture should allow multiple services to share the same database with less overhead. Is separate schemas something you need?
Each service is independently deployed and is independently managing its DTF dependencies. Is the multi-tenancy architecture built for supporting multiple versions of DTF running on the same schema or it's built just for data segregation between services that have the same DTF version but share the DB resource? If one service will update their SQL provider dependency, the schema will be upgraded, while the other services remain running with the old SqlProvider version. Do you recommend using the multitenancy feature with this setup?
Yes, the multitenancy feature is designed such that all tenants in a single database have their schema updated together. If you wanted to isolate schema updates, you'd need to put tenants in separate databases (which also enables things like resource isolation, etc.). Are you in a situation where each tenant could simply have its own database?
@cgillum does durabletask-mssql handle migrations?
What happens in this example where service A and service B share schema
DurableTask.SqlServer.SqlOrchestrationService.CreateIfNotExistsAsync
is calledAt this point, neither service A, nor B were upgraded. (A will have the new version of durabletask-mssql, but not yet deployed).
@mercer the intent is to have all DB schema upgrades be backwards-compatible, allowing old services to continue working with newer schemas. Does this answer your question?
What about forwards-compatible?
Given this scenario:
Downgrading schema versions is not supported. They can only move forward. Service B in your scenario would use the existing v2 schema when deployed.
I see.
But in my scenario service B will execute, as a part of schema migration, so before the service is deployed, DurableTask.SqlServer.SqlOrchestrationService.CreateIfNotExistsAsync
, with v1.
What will v1 CreateIfNotExistsAsync() do when it sees v2 schema (upgraded by Service A)?
dt.Versions
? The v1 CreateIfNotExistsAsync code will do nothing if it sees a newer schema version exists in the database. You can find the implementation for this here:
In this snippet, DTUtils.ExtensionVersion
represents the schema version included in the currently running service ("V1" in your scenario) and currentSchemaVersion
represents the version found in the database (in the [SemanticVersion]
table - e.g. V2).
Thank you for all the info @cgillum, our concerns were settled, will close this issue now 🥇
The existing DB setup/migration capabilities do not offer the possibility to customize the schema name for DTF. So when multiple services are using the same database, you only have the option to use the dt schema in the multitenancy setup, but don't have the option to use a schema per service approach.
Is there a plan for supporting this in the future?