arXiv:2610.32247cs.DBOct 2026

Manuscript Offprint

arXiv:2610.32247

MetaDB: Putting File-System Structure Back into Distributed Databases

Zebin Ren, Biao Cao, Kang Chen, Zhihui Yin, Qiushi Chen, Jielong Jian, Jiwei Xiong, Xinxing Wang, Yan Xing, Liguo Duan, Ran Zheng, Xianjun Meng, Zhenyu Hou

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Storage systems in production increasingly rely on distributed databases for metadata management, yet our experience at Baidu shows that treating a general-purpose database as a black box leaves substantial performance and efficiency untapped. File-system metadata exhibits directory-tree locality, differentiated consistency requirements, and clustered deletions that general-purpose databases largely ignore. We thus propose MetaDB, a metadata-aware distributed transactional database that serves as the shared metadata layer for Baidu's large-scale storage systems. MetaDB addresses three key mismatches between general-purpose databases and metadata workloads: Data Model Mismatch, Transaction Model Mismatch, and Storage Implementation Mismatch. To bridge these gaps, MetaDB combines ① tree-topology-induced sharding and execution, ② semantic-aware off-critical-path processing, and ③ a lifecycle-aware storage engine with in-memory MVCC and locality-aware compaction.

MetaDB achieves 2.2×−4.1×2.2 \times -4.1 \times the throughput of our previous general-purpose database and halves the number of metadata machines. Deployed in production at Baidu for over five years, MetaDB unifies metadata management across the company's storage fleet and scales to over 1,000 metadata nodes, tens of trillions of metadata records, and exabyte-scale storage in a single cluster.

1 Introduction

Distributed storage systems are fundamental to modern cloud infrastructure, but efficiently managing massive metadata remains challenging. Many systems therefore adopt distributed relational or key-value databases for file-system metadata management (e.g., Tectonic [33], Colossus [6], Mantle [25], ACOS [17]). This decoupled architecture reduces development complexity by delegating state management, elasticity, and fault tolerance to database systems, while still providing high scalability and reliability.

At Baidu, we also use this paradigm to manage metadata for our exabyte-scale cloud storage infrastructure, including our cloud file system (CFS) and object storage services (BOS and Mantle) ( §2.1§2.1). We therefore built and deployed a unified general-purpose distributed database as the common metadata layer across all our storage systems.

However, our production experience shows that treating the database as a “black box” for metadata workloads leaves substantial performance untapped and causes severe bottlenecks. Because general-purpose databases are designed for generic relational or key-value data, they overlook the unique structural, semantic, and dynamic properties of file-system metadata. We identify three mismatches between general-purpose databases and metadata workloads.

First, the flat data model of traditional databases conflicts with the hierarchical tree structure of file-system metadata (Data Model Mismatch). General-purpose databases typically rely on range or hash sharding, often splitting entries of the same parent directory across shards and thereby turning high-frequency single-directory updates into expensive distributed transactions. Even when locality is preserved within a shard, the database lacks directory-tree semantics, so a single logical operation (e.g., file creation) can still incur multiple network round-trips for the required transactional steps.

Second, the generic transaction model imposes a rigid, one-size-fits-all atomicity model for all records in a transaction. However, this model fails to accommodate the highly differentiated consistency requirements of metadata updates (Transaction Model Mismatch). Single metadata operations often trigger updates to parent-directory attributes and derived auxiliary metadata. Enforcing strict ACID guarantees across all these fields in a single transaction creates severe contention on shared parent-directory records. It also forces unnecessary multi-shard coordination for auxiliary metadata, even though such metadata can safely tolerate relaxed timeliness.

Third, the underlying storage implementation mismatches metadata access patterns (Storage Implementation Mismatch).

∗^{*}Equal contribution.

†^{\dagger} Corresponding author.

‡^{\ddagger} Work done while the author was at Tsinghua University.

Traditional Multi-Version Concurrency Control (MVCC) persists all tombstones to storage to support long-running transactions, whereas metadata transactions are short-lived (< 10 ms). Under cloud-scale consecutive bulk deletions, these persisted tombstones rapidly accumulate in the underlying Log-Structured Merge-tree (LSM-tree) and degrade range scans such as listdir. Such deletions also exhibit strong spatial locality (e.g., tens of megabytes within a 4 GB shard), but conventional compaction does not exploit this locality and thus cannot purge tombstones in time.

To bridge these gaps, we propose MetaDB, a high-performance, metadata-aware distributed database at Baidu. Rather than treating the database as a generic black box, MetaDB co-designs the database engine around metadata-specific structures, semantics, and dynamics through the following three techniques.

① Tree-Topology-Induced Sharding and Execution. To resolve the data model mismatch, MetaDB aligns database shard boundaries with the directory tree via policy/size-based sharding, keeping single-directory operations within a single shard. We further push down transactional logic directly to the storage nodes, collapsing multi-round network coordination into a single remote execution.

② Semantic-Aware Off-Critical-Path Processing. To resolve the transaction model mismatch, MetaDB extracts aggregatable hotspot directory attributes and auxiliary metadata from the critical path. For hotspot parent-directory attributes, synchronous in-place updates are removed from the write critical path and replaced with asynchronous aggregation through an in-memory queue plus read-path reconciliation, reducing lock contention while preserving the latest visible state. We employ an asynchronous off-critical-path update mechanism: auxiliary metadata (quotas and indexes) are updated out-of-band without strict timeliness requirements, thereby avoiding multi-shard transactions.

③ Lifecycle-Aware Storage Engine. To resolve the storage implementation mismatch, MetaDB optimizes the storage engine specifically for metadata lifecycles. By introducing an in-memory MVCC layer, we prevent short-lived MVCC tombstones from being flushed to disk. Combined with locality-aware range compaction, MetaDB promptly purges localized tombstones, sustaining low latency for listdir.

By resolving the mismatches between databases and metadata workloads, MetaDB delivers 2.2×−4.1×2.2 \times -4.1 \times the throughput of our previous general-purpose database. MetaDB has been deployed in Baidu's production environment for over five years, unifying metadata management across our entire storage fleet. MetaDB reduces the number of cluster machines required for metadata management by approximately 50%. Today, a single MetaDB cluster scales to over 1,000 metadata machines, managing tens of trillions of records and supporting exabyte-scale storage.

This paper makes the following key contributions:

• We identify the root cause of metadata inefficiency in general-purpose distributed databases as the loss of structural information along three dimensions: tree topology, transaction semantics, and operation dynamics.

• We propose and implement three corresponding designs in MetaDB to restore the tree structure in the database.

• We evaluate MetaDB on massive-scale production metadata workloads, demonstrating substantial performance improvements and resource savings over general-purpose databases.

References (27)