|
1 | 1 | --- |
2 | | -draft: true |
3 | 2 | sidebar_label: RocksDB Schema |
4 | 3 | --- |
5 | 4 |
|
6 | 5 | # Ozone Manager RocksDB Schema |
7 | 6 |
|
8 | | -**TODO:** File a subtask under [HDDS-9862](https://issues.apache.org/jira/browse/HDDS-9862) and complete this page or section. |
| 7 | +This page describes the RocksDB layout used by the Ozone Manager (OM). The OM persists namespace and related metadata in RocksDB: volumes, buckets, keys, S3-style multipart uploads, snapshots, tenancy, and supporting system state. |
| 8 | + |
| 9 | +The exact column families and key encodings can evolve between Ozone releases; treat this as a guide to how data is organized, not a stable API. |
| 10 | + |
| 11 | +## Database overview |
| 12 | + |
| 13 | +| Property | Value | |
| 14 | +| -------- | ----- | |
| 15 | +| Database directory | Configured by [`ozone.om.db.dirs`](../../../05-administrator-guide/02-configuration/99-appendix) (falls back to `ozone.metadata.dirs` if unset) | |
| 16 | +| On-disk name | `om.db` | |
| 17 | +| Engine | RocksDB with multiple column families | |
| 18 | + |
| 19 | +## Column families |
| 20 | + |
| 21 | +Column families are grouped by role below. **Key format** uses placeholders such as `volume`, `bucket`, and `key` for path-style keys, or `volId`, `buckId`, `parentId` for ID-based (FSO) keys. Most namespace keys use a leading `/`, per `OzoneConsts.OM_KEY_PREFIX`. |
| 22 | + |
| 23 | +### 1. Hierarchy and ownership |
| 24 | + |
| 25 | +Stores the top levels of the namespace: users, volumes, and buckets. |
| 26 | + |
| 27 | +| Table name | Key format | Value type | Description | |
| 28 | +| ---------- | ---------- | ---------- | ----------- | |
| 29 | +| `userTable` | `userName` | `UserVolumeInfo` | User to owned volumes | |
| 30 | +| `volumeTable` | `/{volume}` | `OmVolumeArgs` | Volume metadata (owner, quota, ACLs) | |
| 31 | +| `bucketTable` | `/{volume}/{bucket}` | `OmBucketInfo` | Bucket metadata (layout, quota, ACLs) | |
| 32 | + |
| 33 | +### 2. Object store (OBS) layout |
| 34 | + |
| 35 | +Used for buckets with **LEGACY** or **OBJECT_STORE** layout. Keys are stored under their full path names. |
| 36 | + |
| 37 | +| Table name | Key format | Value type | Description | |
| 38 | +| ---------- | ---------- | ---------- | ----------- | |
| 39 | +| `keyTable` | `/{volume}/{bucket}/{key}` | `OmKeyInfo` | Committed keys (includes block locations) | |
| 40 | +| `openKeyTable` | `/{volume}/{bucket}/{key}/{clientId}` | `OmKeyInfo` | In-progress writes (uncommitted) | |
| 41 | +| `deletedTable` | `/{volume}/{bucket}/{key}/{objectID}` | `RepeatedOmKeyInfo` | Keys pending deletion / GC | |
| 42 | + |
| 43 | +### 3. File system optimized (FSO) layout |
| 44 | + |
| 45 | +Used for buckets with **FILE_SYSTEM_OPTIMIZED** layout. Keys use volume ID, bucket ID, and parent object ID so directory operations (for example `ls`, rename) can avoid scanning full string paths. See also [Filesystem optimization](../../07-features/01-filesystem-optimization). |
| 46 | + |
| 47 | +| Table name | Key format | Value type | Description | |
| 48 | +| ---------- | ---------- | ---------- | ----------- | |
| 49 | +| `directoryTable` | `/{volId}/{buckId}/{parentId}/{dirName}` | `OmDirectoryInfo` | Directories | |
| 50 | +| `fileTable` | `/{volId}/{buckId}/{parentId}/{fileName}` | `OmKeyInfo` | Committed files | |
| 51 | +| `openFileTable` | `/{volId}/{buckId}/{parentId}/{fileName}/{clientId}` | `OmKeyInfo` | Files currently being written | |
| 52 | +| `deletedDirectoryTable` | `/{volId}/{buckId}/{parentId}/{dirName}/{objId}` | `OmKeyInfo` | Directories marked for deletion | |
| 53 | + |
| 54 | +### 4. Multipart upload |
| 55 | + |
| 56 | +Metadata for S3-style multipart uploads. |
| 57 | + |
| 58 | +| Table name | Key format | Value type | Description | |
| 59 | +| ---------- | ---------- | ---------- | ----------- | |
| 60 | +| `multipartInfoTable` | `/{volume}/{bucket}/{key}/{uploadId}` | `OmMultipartKeyInfo` | Overall upload session | |
| 61 | +| `multipartPartsTable` | `{uploadId}/{partNumber}` | `OmMultipartPartInfo` | Individual parts (`partNumber` is not a full path key) | |
| 62 | + |
| 63 | +### 5. Snapshots |
| 64 | + |
| 65 | +Snapshot metadata and bookkeeping for snapshot-related garbage collection. |
| 66 | + |
| 67 | +| Table name | Key format | Value type | Description | |
| 68 | +| ---------- | ---------- | ---------- | ----------- | |
| 69 | +| `snapshotInfoTable` | `/{volume}/{bucket}/{snapshotName}` | `SnapshotInfo` | One snapshot’s metadata | |
| 70 | +| `snapshotRenamedTable` | `/{volName}/{buckName}/{objectId}` | `String` | Tracks renames across snapshots for correct GC | |
| 71 | +| `compactionLogTable` | `{dbTrxId}-{compactionTime}` | `CompactionLogEntry` | Compaction history used by snapshot services | |
| 72 | + |
| 73 | +### 6. Multi-tenant and security |
| 74 | + |
| 75 | +Tenants, access mappings, S3 secrets, and delegation tokens. |
| 76 | + |
| 77 | +| Table name | Key format | Value type | Description | |
| 78 | +| ---------- | ---------- | ---------- | ----------- | |
| 79 | +| `tenantStateTable` | `tenantId` | `OmDBTenantState` | Tenant configuration and state | |
| 80 | +| `tenantAccessIdTable` | `accessId` | `OmDBAccessIdInfo` | Access ID to secret and tenant | |
| 81 | +| `principalToAccessIdsTable` | `userPrincipal` | `OmDBUserPrincipalInfo` | Kerberos principal to access IDs | |
| 82 | +| `s3SecretTable` | `accessKeyId` | `S3SecretValue` | S3 secrets | |
| 83 | +| `dTokenTable` | `OzoneTokenID` | `Long` | Delegation tokens and renewal times | |
| 84 | + |
| 85 | +### 7. Administrative and system |
| 86 | + |
| 87 | +Prefix ACLs, Ratis apply point, and miscellaneous metadata. |
| 88 | + |
| 89 | +| Table name | Key format | Value type | Description | |
| 90 | +| ---------- | ---------- | ---------- | ----------- | |
| 91 | +| `prefixTable` | `prefix` | `OmPrefixInfo` | Prefix-level ACLs and metadata | |
| 92 | +| `transactionInfoTable` | `#TRANSACTIONINFO` (literal key) | `TransactionInfo` | Last applied Ratis transaction index and term | |
| 93 | +| `metaTable` | `metaDataKey` | `String` | Misc. system metadata (for example DB layout version) | |
| 94 | + |
| 95 | +## Key concepts |
| 96 | + |
| 97 | +- **OBS vs. FSO:** OBS encodes the namespace with path strings under volume and bucket names. FSO encodes parents with numeric **object IDs** (`parentId`), which makes hierarchical FS operations cheaper at scale. |
| 98 | +- **Object ID:** A 64-bit identifier for volumes, buckets, keys, and directories. In FSO tables, `parentId` refers to the parent object’s ID. |
| 99 | +- **OM epoch:** The high bits of object IDs can encode an **epoch** so IDs stay unique across OM restarts or metadata migrations. |
| 100 | +- **Key prefix:** Most hierarchy and object keys start with `/` as defined by `OzoneConsts.OM_KEY_PREFIX`. Some tables (multipart parts, compaction log) use other key shapes as noted above. |
0 commit comments