Databases 11 min read

Understanding OceanBase Clog Directory Structure and Disk Usage Control

This article explains the physical layout of OceanBase's clog directory, the roles of log_pool and tenant_id sub‑directories, how log disk capacity is allocated via configuration parameters, the concept of meta tenants and log streams, and provides scripts for monitoring clog usage and disk utilization.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Understanding OceanBase Clog Directory Structure and Disk Usage Control

In OceanBase the /data/log1/clustername/clog directory stores physical log files (clog) that record database modifications. Starting with version 4.1.0, OceanBase introduces tenant‑level log streams, grouping physical changes into a system log stream and multiple user log streams that are synchronized via the Paxos protocol.

The original clog files are no longer placed directly under the OBServer node; instead two new layers appear: log_pool and tenant_id directories. The log_pool pre‑allocates clog files based on the node's total log disk capacity ( LOG_DISK_CAPACITY ) and the default clog size of 64 MiB. Allocation follows the configuration items log_disk_size and log_disk_percentage :

If log_disk_size is 0 and log_disk_percentage is non‑zero, the percentage value determines the allocated space.

If log_disk_size is non‑zero, it overrides the percentage setting.

If both are zero, OceanBase automatically assigns 30 % of the disk to Redo logs when the log and data share the same disk, otherwise 90 % when they are on separate disks.

The system table __all_virtual_server records the total log‑disk capacity ( log_disk_capacity ) and two important fields: log_disk_assigned (pre‑allocated space in the log pool) and log_disk_in_use (actual space used by a tenant). These values are reflected in the view gv$ob_units for each tenant unit.

Each tenant appears as a tenant_id sub‑directory under clog . The space is not allocated to the tenant immediately; it is reserved in the log pool and becomes visible in log_disk_assigned . When a tenant writes new clog files, OceanBase moves the reserved files to the tenant’s directory, updating log_disk_in_use . The meta‑tenant (e.g., tenant_1001 ) is automatically created for every user tenant starting from version 4.0.0 to store internal metadata.

Below the tenant_id directory there is an additional numeric ID directory that corresponds to the log‑stream ID (LS_ID). The view gv$ob_log_stat can be used to query a tenant’s log‑stream IDs, while CDB_OBJECTS and CDB_OB_TABLET_TO_LS map tables to tablets and tablets to log streams, respectively.

Clog disk usage is limited per tenant. When the utilization ratio (log_disk_in_use / log_disk_size * 100%) reaches the default threshold of 80 % (non‑configurable), the system stops requesting new clog files from the log pool and reuses the oldest ones.

To monitor clog generation and disk consumption, the article provides a Bash script that counts clog files per tenant, calculates their total size, and aggregates hourly and daily statistics using find , stat , and awk . Sample output shows the remaining clog files in the log pool and per‑tenant usage.

References:

[1] LOG_DISK_CAPACITY documentation

[2] LOG_DISK_SIZE documentation

[3] Meta tenant concept

[4] Log stream documentation

OceanBaseDisk UsageCloglog_poollog streamtenant_id
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.