NAMESPACE REMOVE
Marks a namespace for logical removal without deleting its FoundationDB directory. Physical deletion requires a
subsequent NAMESPACE PURGE.
Syntax
Section titled “Syntax”NAMESPACE REMOVE <namespace>Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
namespace | string | Yes | Dot-separated hierarchical path of the namespace to remove (e.g. staging.). |
Return Value
Section titled “Return Value”Returns OK on success.
Behavior
Section titled “Behavior”The command sets a removed flag on the namespace metadata. The FoundationDB directory is not deleted. This is a
logical removal only. To physically delete the directory, run NAMESPACE PURGE after the removal has been observed by
all cluster members.
The command uses an isolated one-off transaction to prevent consistency issues. If the transaction fails due to a conflict (error code 1020), it is automatically retried.
The default namespace (configured via default_namespace) cannot be removed.
The __internal__ name is reserved at any level of the hierarchy and cannot be used.
Hierarchical removal
Section titled “Hierarchical removal”Removing a parent namespace (e.g. a.b) affects all child namespaces (e.g. a.b.c, a.b.c.d). The children inherit
the removed state from their parent.
Cluster-wide side effects
Section titled “Cluster-wide side effects”A cluster-wide event is published to the journal. Every cluster member that consumes this event:
- Invalidates its bucket metadata cache entries keyed under the namespace
- Invalidates plan cache entries keyed under the namespace
- Removes the namespace from all sessions’ open-namespaces set
- Shuts down workers registered for the namespace
- Records the observed namespace version once workers terminate (barrier for
NAMESPACE PURGE)
Errors
Section titled “Errors”| Error Code | Description |
|---|---|
NOSUCHNAMESPACE | The namespace does not exist. |
NAMESPACEBEINGREMOVED | The namespace is already marked for removal. |
ERR | Attempting to remove the default namespace, or the namespace path contains the reserved __internal__ name. |
Examples
Section titled “Examples”Remove a namespace:
> NAMESPACE CREATE staging.ordersOK
> NAMESPACE REMOVE staging.ordersOKNon-existent namespace:
> NAMESPACE REMOVE non.existent(error) NOSUCHNAMESPACE No such namespace: 'non.existent'Already marked for removal:
> NAMESPACE CREATE staging.ordersOK
> NAMESPACE REMOVE staging.ordersOK
> NAMESPACE REMOVE staging.orders(error) NAMESPACEBEINGREMOVED Namespace 'staging.orders' is being removedDefault namespace:
> NAMESPACE REMOVE global(error) ERR Cannot remove the default namespace: 'global'Reserved name:
> NAMESPACE REMOVE name.__internal__(error) ERR Namespace 'name.__internal__' is reserved for internal use