Skip to content

Fix race condition when dropping a catalog #26927

@homar

Description

@homar

There is a potential race condition in

public void dropCatalog(Session session, CatalogName catalog, boolean cascade)

spotted by @findepi

What we do here:

we first read from catalogManager
1.1. we conditionally re-read something in getCatalogMetadataForWrite
we then issue unconditional drop in catalogManager
depending on the status if the (1) read, systemSecurityMetadata.catalogDropped is called
What we want to guarantee is that:
if a catalog ceased to exist, systemSecurityMetadata.catalogDropped has been called

Which may not be the case when e.g.

(pre-existing) catalog did not exist and was created between (1) and (2)
(new) catalog did exist but unhealthy and was fixed between (1) and (2)

#26918 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions