Refactor DDL lock to encapsulate ScopedBaseDDLLock

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 8.3.0-rc0
    • Component/s: Catalog, Concurrency
    • None
    • Catalog and Routing
    • 🟥 DDL
    • None
    • None
    • None
    • None
    • None
    • None

      Currently the DDLLock API has the following 3 classes:

       

      Class Lock type Check DB version? Wait for recovery? Visiblity
      ScopedDatabaseDDLLock Database DDL lock Yes Yes Public
      ScopedCollectionDDLLock Database and collection DDL lock Yes Yes Public
      ScopedBaseDDLLock Database or collection DDL lock No No Private, but has multiple friend classes

       

       

      This design is not ideal because use cases that do not need to check the DBVersion or wait for recovery must use a ScopedBaseDDLLock, which would ideally be fully encapsulated (have no friends).

      At the same time using ScopedBaseDDLLock introduces some subtle unexpected footguns, for example, it is possible to acquire a collection DDL lock without first acquiring the corresponding database DDL lock.

       

      This ticket should encapsulate ScopedBaseDDLLock and cover all existing valid use cases with a higher level API.

            Assignee:
            Unassigned
            Reporter:
            Joan Bruguera Micó
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: