NAMESPACE CREATE
Creates a new namespace with the given hierarchical path.
Syntax
Section titled “Syntax”NAMESPACE CREATE <namespace>Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
namespace | string | Yes | Dot-separated hierarchical path for the namespace (e.g. production.). |
Return Value
Section titled “Return Value”Returns OK on success.
Behavior
Section titled “Behavior”Namespaces are hierarchical paths separated by dots (.). Creating a namespace like production.users.api
automatically creates intermediate directories (production and production.users) in the FoundationDB directory
layer.
The command uses an isolated one-off transaction to prevent consistency issues.
Before creating the namespace, a tombstone barrier check is performed. If the namespace was previously moved via
NAMESPACE MOVE and not all cluster members have observed the tombstone, the creation is rejected. This prevents stale
reads on members that still reference the old namespace path.
The maximum namespace depth is 10. For example, a.b.c.d.e.f.g.h.i.j is the deepest allowed path.
The __internal__ name is reserved at any level of the hierarchy and cannot be used.
Errors
Section titled “Errors”| Error Code | Description |
|---|---|
NAMESPACEALREADYEXISTS | A namespace with the same path already exists. |
NAMESPACEBEINGREMOVED | The namespace was previously removed via NAMESPACE REMOVE but has not yet been purged via NAMESPACE PURGE. |
ERR | The namespace path contains the reserved __internal__ leaf, the namespace depth exceeds the maximum allowed depth of 10, or the tombstone barrier is not satisfied after a prior NAMESPACE MOVE. |
Examples
Section titled “Examples”Create a namespace:
> NAMESPACE CREATE production.usersOKDuplicate namespace:
> NAMESPACE CREATE production.usersOK
> NAMESPACE CREATE production.users(error) NAMESPACEALREADYEXISTS Namespace already exists: production.usersNamespace being removed:
> NAMESPACE CREATE staging.ordersOK
> NAMESPACE REMOVE staging.ordersOK
> NAMESPACE CREATE staging.orders(error) NAMESPACEBEINGREMOVED Namespace 'staging.orders' is being removedReserved name:
> NAMESPACE CREATE name.__internal__(error) ERR Namespace 'name.__internal__' is reserved for internal useTombstone barrier isn’t satisfied:
> NAMESPACE CREATE old-namespace(error) ERR Not all cluster members have observed the tombstone for namespace 'old-namespace'