Details
-
Task
-
Resolution: Won't Fix
-
Major - P3
-
None
-
None
-
None
-
None
-
Serverless
Description
There are a number of RAII types that take collection locks defined in both catalog_raii.h/cpp and db_raii.h,cpp, we should change these classes to use TenantNamespaceOrUUID rather than NamespaceStringOrUUID. Many of these classes wrap one another, so though there are many I think it will be easier to change them in the same commit. These classes are unit tested in both the DBRAIITestFixture and CatalogRAIITestFixture.
At this point, we should be able to write a js test that successfully runs concurrent operations on conflicting namespaces but for different tenants. The test can do something like the following:
- Start up a single node replica set (unless
SERVER-62880is finished, then we should be able to start up a standard 3-node replica set) - Create two "tenants" and two connections to the primary node. Set the security token for each tenant on one of the connection (see security_token.js for an example of how to create a tenantId and set it on a conn)
- Run concurrent requests from each connection on collections with the same name and assert each succeeds. We can use failpoints to force a hang after taking the collection lock for a request, that way we can run a request on one connection, wait to hit the failpoint, then run a request that takes a lock in a conflicting mode on the other connection and assert it succeeds, then turn off the failpoint and assert the initial request succeeds. i.e.
// turn on failpoint that forces a hang after taking a lock during renameCollection// send renameCollection on tenantA's connection for the db.foo collection, wait to hit the failpoint --> rename takes the collection lock in MODE_X lock, so requesting any other lock on the same resource should fail// send some other request i.e. an insert on tenantB's db.foo collection, assert this succeeds// turn off failpoint, assert rename was successful