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”Argument errors:
| Error Code | Error message | Cause |
|---|---|---|
ERR | Namespace '<path>' is reserved for internal use | The namespace path contains the reserved __internal__ name. |
ERR | Namespace depth exceeds maximum allowed depth of 10 | - |
Namespace errors:
| Error Code | Error message | Cause |
|---|---|---|
NAMESPACEALREADYEXISTS | Namespace already exists: <path> | - |
NAMESPACEBEINGREMOVED | Namespace '<path>' is being removed | - |
BARRIERNOTSATISFIED | Not all cluster members have observed the tombstone for namespace '<path>' | The tombstone from a prior NAMESPACE MOVE is not yet visible on all members. Retry the command. |
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'