Tejaskriya commented on code in PR #8740:
URL: https://github.com/apache/ozone/pull/8740#discussion_r2242026563


##########
hadoop-hdds/docs/content/concept/RocksDB.md:
##########
@@ -0,0 +1,125 @@
+---
+title: "RocksDB in Apache Ozone"
+menu:
+  main:
+    parent: Architecture
+---
+
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+RocksDB is a critical component of Apache Ozone, providing a high-performance 
embedded key-value store. It is used by various Ozone services to persist 
metadata and state.
+
+## 1. Introduction to RocksDB
+
+RocksDB is a log-structured merge-tree (LSM-tree) based key-value store 
developed by Facebook. It is optimized for fast storage environments like SSDs 
and offers high write throughput and efficient point lookups. For more details, 
refer to the [RocksDB GitHub project](https://github.com/facebook/rocksdb) and 
the [RocksDB Wiki](https://github.com/facebook/rocksdb/wiki).
+
+## 2. How Ozone uses RocksDB
+
+RocksDB is utilized in the following Ozone components to store critical 
metadata:
+
+*   **Ozone Manager (OM):** The OM uses RocksDB as its primary metadata store, 
holding the entire namespace and related information. As defined in 
`OMDBDefinition.java`, this includes tables for:
+    *   **Namespace:** `volumeTable`, `bucketTable`, `keyTable` (for object 
store layout), `directoryTable`, and `fileTable` (for file system layout).
+    *   **Security:** `userTable`, `dTokenTable` (delegation tokens), and 
`s3SecretTable`.
+    *   **State Management:** `transactionInfoTable` for tracking 
transactions, `deletedTable` for pending key deletions, and `snapshotInfoTable` 
for managing Ozone snapshots.
+
+*   **Storage Container Manager (SCM):** The SCM persists the state of the 
storage layer in RocksDB. The structure, defined in `SCMDBDefinition.java`, 
includes tables for:
+    *   `pipelines`: Manages the state and composition of data pipelines.
+    *   `containers`: Stores information about all storage containers in the 
cluster.
+    *   `deletedBlocks`: Tracks blocks that are marked for deletion and 
awaiting garbage collection.
+    *   `move`: Coordinates container movements for data rebalancing.
+
+*   **Datanode:** A Datanode utilizes RocksDB for two main purposes:
+    1.  **Per-Volume Metadata:** It maintains one RocksDB instance per storage 
volume. Each of these instances manages metadata for the containers and blocks 
stored on that specific volume. As specified in 
`DatanodeSchemaThreeDBDefinition.java`, this database is structured with column 
families for `block_data`, `metadata`, and `delete_txns`. To optimize 
performance, it uses a fixed-length prefix based on the container ID, enabling 
efficient lookups with RocksDB's prefix seek feature.
+    2.  **Global Container Tracking:** Additionally, each Datanode has a 
single, separate RocksDB instance to record the set of all containers it 
manages. This database, defined in `WitnessedContainerDBDefinition.java`, 
contains a `containerIds` table that provides a complete index of the 
containers hosted on that Datanode.
+
+*   **Recon:** Ozone's administration and monitoring tool, Recon, maintains 
its own RocksDB database to store aggregated and historical data for analysis. 
The `ReconDBDefinition.java` outlines tables for:
+    *   `containerKeyTable`: Maps containers to the keys they contain.
+    *   `namespaceSummaryTable`: Stores aggregated namespace information for 
quick reporting.
+    *   `replica_history`: Tracks the historical locations of container 
replicas, which is essential for auditing and diagnostics.
+
+## 3. Tunings applicable to RocksDB
+
+Effective tuning of RocksDB can significantly impact Ozone's performance. 
Ozone exposes several configuration properties to tune RocksDB behavior. These 
properties are typically found in `ozone-default.xml` and can be overridden in 
`ozone-site.xml`.
+
+### Ozone Manager (OM)
+
+Key tuning parameters for the OM often involve:
+
+*   **Write Options:**
+    *   `ozone.metastore.rocksdb.writeoption.sync`: Whether to sync RocksDB 
writes to disk. This is a general metastore setting that also applies to the 
OM. Default value: `false` (based on common RocksDB usage for performance).
+
+For other settings, such as Write-Ahead Log (WAL) management, the Ozone 
Manager currently relies on the default RocksDB configurations.
+
+### DataNode
+
+Key tuning parameters for the DataNode often involve:
+
+*   **Memory usage:** Configuring block cache, write buffer manager, and other 
memory-related settings.
+    *   `hdds.datanode.metadata.rocksdb.cache.size`: Configures the block 
cache size for RocksDB instances on Datanodes. Default value: `1GB`.
+*   **Compaction strategies:** Optimizing how data is merged and organized on 
disk.
+    *   `hdds.datanode.rocksdb.auto-compaction-small-sst-file`: Enables or 
disables auto-compaction for small SST files. Default value: `true`.
+    *   `hdds.datanode.rocksdb.auto-compaction-small-sst-file-size-threshold`: 
Threshold for small SST file size for auto-compaction. Default value: `1MB`.
+    *   `hdds.datanode.rocksdb.auto-compaction-small-sst-file-num-threshold`: 
Threshold for the number of small SST files for auto-compaction. Default value: 
`512`.
+*   **Write-ahead log (WAL) settings:** Balancing durability and write 
performance.
+    *   `hdds.datanode.rocksdb.log.max-file-size`: Maximum size of each 
RocksDB log file. Default value: `32MB`.
+    *   `hdds.datanode.rocksdb.log.max-file-num`: Maximum number of RocksDB 
log files. Default value: `64`.
+
+### General Settings
+
+Ozone also manages RocksDB's `DBOptions` and `ColumnFamilyOptions` through 
`DBProfile`s (e.g., `DatanodeDBProfile`), which can be configured based on 
storage types (SSD, HDD). This can be configured using the `hdds.db.profile` 
property.
+
+*   `hdds.db.profile`: Specifies the RocksDB profile to use, which determines 
the default `DBOptions` and `ColumnFamilyOptions`. Default value: `DISK`.
+    *   Possible values include `SSD` and `DISK`.
+    *   For example, setting this to `SSD` will apply tunings optimized for 
SSD storage.
+
+## 4. Troubleshooting and repair tools relevant to RocksDB
+
+Troubleshooting RocksDB issues in Ozone often involves:
+
+*   Analyzing RocksDB logs for errors and warnings.
+*   Using RocksDB's built-in tools for inspecting database files:
+    *   [**ldb**](https://github.com/facebook/rocksdb/wiki/LDB-Tool): A 
command-line tool for inspecting and manipulating the contents of a RocksDB 
database.

Review Comment:
   The current link ends up redirecting to the home page 
https://github.com/facebook/rocksdb/wiki. The below would work better:
   ```suggestion
       *   
[**ldb**](https://github.com/facebook/rocksdb/wiki/Administration-and-Data-Access-Tool#ldb-tool):
 A command-line tool for inspecting and manipulating the contents of a RocksDB 
database.
   ```



##########
hadoop-hdds/docs/content/concept/RocksDB.md:
##########
@@ -0,0 +1,125 @@
+---
+title: "RocksDB in Apache Ozone"
+menu:
+  main:
+    parent: Architecture
+---
+
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+RocksDB is a critical component of Apache Ozone, providing a high-performance 
embedded key-value store. It is used by various Ozone services to persist 
metadata and state.
+
+## 1. Introduction to RocksDB
+
+RocksDB is a log-structured merge-tree (LSM-tree) based key-value store 
developed by Facebook. It is optimized for fast storage environments like SSDs 
and offers high write throughput and efficient point lookups. For more details, 
refer to the [RocksDB GitHub project](https://github.com/facebook/rocksdb) and 
the [RocksDB Wiki](https://github.com/facebook/rocksdb/wiki).
+
+## 2. How Ozone uses RocksDB
+
+RocksDB is utilized in the following Ozone components to store critical 
metadata:
+
+*   **Ozone Manager (OM):** The OM uses RocksDB as its primary metadata store, 
holding the entire namespace and related information. As defined in 
`OMDBDefinition.java`, this includes tables for:
+    *   **Namespace:** `volumeTable`, `bucketTable`, `keyTable` (for object 
store layout), `directoryTable`, and `fileTable` (for file system layout).
+    *   **Security:** `userTable`, `dTokenTable` (delegation tokens), and 
`s3SecretTable`.
+    *   **State Management:** `transactionInfoTable` for tracking 
transactions, `deletedTable` for pending key deletions, and `snapshotInfoTable` 
for managing Ozone snapshots.
+
+*   **Storage Container Manager (SCM):** The SCM persists the state of the 
storage layer in RocksDB. The structure, defined in `SCMDBDefinition.java`, 
includes tables for:
+    *   `pipelines`: Manages the state and composition of data pipelines.
+    *   `containers`: Stores information about all storage containers in the 
cluster.
+    *   `deletedBlocks`: Tracks blocks that are marked for deletion and 
awaiting garbage collection.
+    *   `move`: Coordinates container movements for data rebalancing.
+
+*   **Datanode:** A Datanode utilizes RocksDB for two main purposes:
+    1.  **Per-Volume Metadata:** It maintains one RocksDB instance per storage 
volume. Each of these instances manages metadata for the containers and blocks 
stored on that specific volume. As specified in 
`DatanodeSchemaThreeDBDefinition.java`, this database is structured with column 
families for `block_data`, `metadata`, and `delete_txns`. To optimize 
performance, it uses a fixed-length prefix based on the container ID, enabling 
efficient lookups with RocksDB's prefix seek feature.
+    2.  **Global Container Tracking:** Additionally, each Datanode has a 
single, separate RocksDB instance to record the set of all containers it 
manages. This database, defined in `WitnessedContainerDBDefinition.java`, 
contains a `containerIds` table that provides a complete index of the 
containers hosted on that Datanode.
+
+*   **Recon:** Ozone's administration and monitoring tool, Recon, maintains 
its own RocksDB database to store aggregated and historical data for analysis. 
The `ReconDBDefinition.java` outlines tables for:
+    *   `containerKeyTable`: Maps containers to the keys they contain.
+    *   `namespaceSummaryTable`: Stores aggregated namespace information for 
quick reporting.
+    *   `replica_history`: Tracks the historical locations of container 
replicas, which is essential for auditing and diagnostics.
+
+## 3. Tunings applicable to RocksDB
+
+Effective tuning of RocksDB can significantly impact Ozone's performance. 
Ozone exposes several configuration properties to tune RocksDB behavior. These 
properties are typically found in `ozone-default.xml` and can be overridden in 
`ozone-site.xml`.
+
+### Ozone Manager (OM)
+
+Key tuning parameters for the OM often involve:
+
+*   **Write Options:**
+    *   `ozone.metastore.rocksdb.writeoption.sync`: Whether to sync RocksDB 
writes to disk. This is a general metastore setting that also applies to the 
OM. Default value: `false` (based on common RocksDB usage for performance).
+
+For other settings, such as Write-Ahead Log (WAL) management, the Ozone 
Manager currently relies on the default RocksDB configurations.
+
+### DataNode
+
+Key tuning parameters for the DataNode often involve:
+
+*   **Memory usage:** Configuring block cache, write buffer manager, and other 
memory-related settings.
+    *   `hdds.datanode.metadata.rocksdb.cache.size`: Configures the block 
cache size for RocksDB instances on Datanodes. Default value: `1GB`.
+*   **Compaction strategies:** Optimizing how data is merged and organized on 
disk.
+    *   `hdds.datanode.rocksdb.auto-compaction-small-sst-file`: Enables or 
disables auto-compaction for small SST files. Default value: `true`.
+    *   `hdds.datanode.rocksdb.auto-compaction-small-sst-file-size-threshold`: 
Threshold for small SST file size for auto-compaction. Default value: `1MB`.
+    *   `hdds.datanode.rocksdb.auto-compaction-small-sst-file-num-threshold`: 
Threshold for the number of small SST files for auto-compaction. Default value: 
`512`.
+*   **Write-ahead log (WAL) settings:** Balancing durability and write 
performance.
+    *   `hdds.datanode.rocksdb.log.max-file-size`: Maximum size of each 
RocksDB log file. Default value: `32MB`.
+    *   `hdds.datanode.rocksdb.log.max-file-num`: Maximum number of RocksDB 
log files. Default value: `64`.
+
+### General Settings
+
+Ozone also manages RocksDB's `DBOptions` and `ColumnFamilyOptions` through 
`DBProfile`s (e.g., `DatanodeDBProfile`), which can be configured based on 
storage types (SSD, HDD). This can be configured using the `hdds.db.profile` 
property.
+
+*   `hdds.db.profile`: Specifies the RocksDB profile to use, which determines 
the default `DBOptions` and `ColumnFamilyOptions`. Default value: `DISK`.
+    *   Possible values include `SSD` and `DISK`.
+    *   For example, setting this to `SSD` will apply tunings optimized for 
SSD storage.
+
+## 4. Troubleshooting and repair tools relevant to RocksDB
+
+Troubleshooting RocksDB issues in Ozone often involves:
+
+*   Analyzing RocksDB logs for errors and warnings.
+*   Using RocksDB's built-in tools for inspecting database files:
+    *   [**ldb**](https://github.com/facebook/rocksdb/wiki/LDB-Tool): A 
command-line tool for inspecting and manipulating the contents of a RocksDB 
database.
+    *   [**sst_dump**](https://github.com/facebook/rocksdb/wiki/SST-Dump): A 
command-line tool for inspecting the contents of SST (Static Table) files, 
which are the files that store the data in RocksDB.

Review Comment:
   Same here:
   ```suggestion
       *   
[**sst_dump**](https://github.com/facebook/rocksdb/wiki/Administration-and-Data-Access-Tool#sst-dump-tool):
 A command-line tool for inspecting the contents of SST (Static Table) files, 
which are the files that store the data in RocksDB.
   ```



##########
hadoop-hdds/docs/content/concept/RocksDB.md:
##########
@@ -0,0 +1,125 @@
+---
+title: "RocksDB in Apache Ozone"
+menu:
+  main:
+    parent: Architecture
+---
+
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+RocksDB is a critical component of Apache Ozone, providing a high-performance 
embedded key-value store. It is used by various Ozone services to persist 
metadata and state.
+
+## 1. Introduction to RocksDB
+
+RocksDB is a log-structured merge-tree (LSM-tree) based key-value store 
developed by Facebook. It is optimized for fast storage environments like SSDs 
and offers high write throughput and efficient point lookups. For more details, 
refer to the [RocksDB GitHub project](https://github.com/facebook/rocksdb) and 
the [RocksDB Wiki](https://github.com/facebook/rocksdb/wiki).
+
+## 2. How Ozone uses RocksDB
+
+RocksDB is utilized in the following Ozone components to store critical 
metadata:
+
+*   **Ozone Manager (OM):** The OM uses RocksDB as its primary metadata store, 
holding the entire namespace and related information. As defined in 
`OMDBDefinition.java`, this includes tables for:
+    *   **Namespace:** `volumeTable`, `bucketTable`, `keyTable` (for object 
store layout), `directoryTable`, and `fileTable` (for file system layout).
+    *   **Security:** `userTable`, `dTokenTable` (delegation tokens), and 
`s3SecretTable`.
+    *   **State Management:** `transactionInfoTable` for tracking 
transactions, `deletedTable` for pending key deletions, and `snapshotInfoTable` 
for managing Ozone snapshots.
+
+*   **Storage Container Manager (SCM):** The SCM persists the state of the 
storage layer in RocksDB. The structure, defined in `SCMDBDefinition.java`, 
includes tables for:
+    *   `pipelines`: Manages the state and composition of data pipelines.
+    *   `containers`: Stores information about all storage containers in the 
cluster.
+    *   `deletedBlocks`: Tracks blocks that are marked for deletion and 
awaiting garbage collection.
+    *   `move`: Coordinates container movements for data rebalancing.
+
+*   **Datanode:** A Datanode utilizes RocksDB for two main purposes:
+    1.  **Per-Volume Metadata:** It maintains one RocksDB instance per storage 
volume. Each of these instances manages metadata for the containers and blocks 
stored on that specific volume. As specified in 
`DatanodeSchemaThreeDBDefinition.java`, this database is structured with column 
families for `block_data`, `metadata`, and `delete_txns`. To optimize 
performance, it uses a fixed-length prefix based on the container ID, enabling 
efficient lookups with RocksDB's prefix seek feature.
+    2.  **Global Container Tracking:** Additionally, each Datanode has a 
single, separate RocksDB instance to record the set of all containers it 
manages. This database, defined in `WitnessedContainerDBDefinition.java`, 
contains a `containerIds` table that provides a complete index of the 
containers hosted on that Datanode.
+
+*   **Recon:** Ozone's administration and monitoring tool, Recon, maintains 
its own RocksDB database to store aggregated and historical data for analysis. 
The `ReconDBDefinition.java` outlines tables for:
+    *   `containerKeyTable`: Maps containers to the keys they contain.
+    *   `namespaceSummaryTable`: Stores aggregated namespace information for 
quick reporting.
+    *   `replica_history`: Tracks the historical locations of container 
replicas, which is essential for auditing and diagnostics.
+
+## 3. Tunings applicable to RocksDB
+
+Effective tuning of RocksDB can significantly impact Ozone's performance. 
Ozone exposes several configuration properties to tune RocksDB behavior. These 
properties are typically found in `ozone-default.xml` and can be overridden in 
`ozone-site.xml`.
+
+### Ozone Manager (OM)
+
+Key tuning parameters for the OM often involve:
+
+*   **Write Options:**
+    *   `ozone.metastore.rocksdb.writeoption.sync`: Whether to sync RocksDB 
writes to disk. This is a general metastore setting that also applies to the 
OM. Default value: `false` (based on common RocksDB usage for performance).
+
+For other settings, such as Write-Ahead Log (WAL) management, the Ozone 
Manager currently relies on the default RocksDB configurations.

Review Comment:
   As these are general settings, can we move these to the main heading of 
"Tunings applicable to RocksDB" instead of under "Ozone Manager (OM)"?  And 
mention that by default OM and SCM use the rocksDB defaults?
   ```suggestion
   Key tuning parameters often involve:
   
   *   **Write Options:**
       *   `ozone.metastore.rocksdb.writeoption.sync`: Whether to sync RocksDB 
writes to disk. This is a general metastore setting. Default value: `false` 
(based on common RocksDB usage for performance).
   
   For other settings, such as Write-Ahead Log (WAL) management, Ozone 
currently relies on the default RocksDB configurations.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to