OceanBase AI Database supports automatic expansion based on the actual usage of disk data files.
Background information
In OceanBase AI Database, the file that stores data is named block_file. The block_file is located in the /store/sstable directory under the installation directory of the OBServer node. This file is created after each OBServer node starts up. The size of the block_file is controlled by the datafile_size or datafile_disk_percentage parameter.
OceanBase AI Database introduces a user-configurable option for progressive disk space usage by data files. That is, the system first pre-allocates a reasonable disk size for data files and then automatically expands the capacity based on the actual disk usage and user configuration.
Related parameters
OceanBase AI Database primarily uses the following parameters in combination to achieve automatic expansion of disk data files:
datafile_size: Sets the amount of available disk space that data files can occupy. The default value is0M. For detailed information about the cluster-level parameterdatafile_size, see datafile_size.datafile_disk_percentage: The percentage of total disk space occupied by data files. The default value is0. For detailed information about the cluster-level parameterdatafile_disk_percentage, see datafile_disk_percentage.datafile_next: Sets the step size for automatic expansion of disk data files. The default value is0, which means growth is not enabled. To enable automatic growth, set this parameter to a value other than0. For detailed information about the cluster-level parameterdatafile_next, see datafile_next.datafile_maxsize: Sets the maximum size for automatic expansion of disk data files. The default value is0, which means automatic expansion is not enabled. For detailed information about the cluster-level parameterdatafile_maxsize, see datafile_maxsize.
When configuring the above parameters, note the following:
Both
datafile_sizeanddatafile_disk_percentagecan be used to set the disk space occupied by data files. You can choose either one to configure. In other cases:If both parameters are configured, that is, both
datafile_sizeanddatafile_disk_percentageare set to non-zero values, the value set bydatafile_sizeprevails.If neither parameter is configured, that is,
datafile_sizeis0Manddatafile_disk_percentageis0, the system automatically calculates the percentage of total disk space occupied by data files based on whether logs and data share the same disk, as follows:If logs and data share the same disk, data files occupy 60% of the total disk space.
If logs and data are stored on separate disks, data files occupy 90% of the disk space on which they reside.
When configuring
datafile_maxsize, its value must be greater than the current disk space occupied by the data file, which isdatafile_size(ordatafile_disk_percentage). If the set value is less than the current disk space occupied by the data file, automatic expansion will not be triggered.The maximum size of a data file is the smaller value of
datafile_maxsizeand the maximum available disk space.For
datafile_next:When
datafile_nextis set to a value less than or equal to1G, its value ismin (1G, datafile_maxsize * 10%).When
datafile_nextis set to a value greater than1G, its value ismin (datafile_next, remaining disk space).
Considerations and limitations
When configuring the automatic expansion feature for disk data files, it is recommended to initially set the step size
datafile_nextto about 20% ofdatafile_maxsizeto avoid frequent expansions.After enabling automatic data file expansion, plan the capacity for other applications deployed on the same server to prevent the actual maximum expandable space from being smaller than the configured
datafile_maxsize.Dynamic shrinking of disk data files is not supported.
If you do not want to enable the automatic expansion feature, you can directly set the value of
datafile_nextordatafile_maxsizeto0Mor keep them at their default value0. The system will then reserve a portion of disk space for data files using the original pre-allocation method.
How to enable automatic data file expansion
Step 1: View the values of current parameters
Before configuring dynamic expansion for disk data files, you need to view the values of each parameter to understand their current configurations.
Log in to the
systenant of the cluster as therootuser.Run the following command to view the values of each parameter.
obclient> SHOW PARAMETERS LIKE '%datafile_%';
Step 2: Configure dynamic expansion for disk data files
After obtaining the values of each parameter, you can modify their values according to your actual usage scenario to enable automatic expansion for disk data files.
datafile_size (or datafile_disk_percentage), datafile_next, and datafile_maxsize are configured during cluster startup
If you have configured datafile_size (or datafile_disk_percentage), datafile_next, and datafile_maxsize to non-zero values when deploying and starting the OceanBase AI Database cluster, then:
If the value of
datafile_maxsizeis greater than the value ofdatafile_size, or ifdatafile_maxsizeis greater than the disk space calculated based on thedatafile_disk_percentageratio, automatic expansion will take effect after the cluster starts.If the value of
datafile_maxsizeis less than the value ofdatafile_size, or ifdatafile_maxsizeis less than the disk space calculated based on thedatafile_disk_percentageratio, you need to modify the value ofdatafile_maxsizeto be greater thandatafile_sizebefore enabling automatic data file expansion.
Only datafile_size (or datafile_disk_percentage) is configured during cluster startup
If you have set only the value of datafile_size or datafile_disk_percentage when deploying and starting the OceanBase AI Database cluster, you only need to manually set the values for datafile_maxsize and datafile_next, ensuring that the value of datafile_maxsize is greater than datafile_size or greater than the disk space calculated based on the datafile_disk_percentage ratio.
No datafile_size (or datafile_disk_percentage), datafile_next, or datafile_maxsize is configured during cluster startup
If you did not set datafile_size (or datafile_disk_percentage), datafile_next, or datafile_maxsize when deploying and starting the OceanBase AI Database cluster, you can follow these steps to enable automatic expansion for disk data files.
Note
Whether to set datafile_size or datafile_disk_percentage during the initial cluster startup primarily affects the initial size of the disk data file.
The specific procedure is as follows:
Log in to the
systenant of the cluster as therootuser.Execute the following statement to confirm the pre-allocated space on the current disk.
obclient> SELECT data_disk_allocated/1024/1024/1024 AS datafile_G FROM oceanbase.GV$OB_SERVERS;An example of the query result is shown below.
+-------------------+ | datafile_G | +-------------------+ | 1770.000000000000 | +-------------------+ 1 row in setAccording to the query result, the pre-allocated space for the current disk data file,
data_disk_allocated, is 1770 GB, which is approximately 1.7 TB.For more information about the fields in the
GV$OB_SERVERSview, see GV$OB_SERVERS.Based on the result from the previous step, set the value of
datafile_maxsizeto a value greater thandata_disk_allocated, and also setdatafile_nextto a non-zero value.A sample configuration is as follows:
ALTER SYSTEM SET datafile_maxsize='4TB';ALTER SYSTEM SET datafile_next='1TB';After the settings are successfully applied, execute the following statement to confirm whether the automatic expansion setting takes effect.
SELECT data_disk_allocated/1024/1024/1024 AS datafile_G, data_disk_capacity/1024/1024/1024 AS datafile_max_G FROM oceanbase.GV$OB_SERVERS;A sample query result is shown below.
+-------------------+-------------------+ | datafile_G | datafile_max_G | +-------------------+-------------------+ | 1770.000000000000 | 4096.000000000000 | +-------------------+-------------------+ 1 row in setAccording to the query result, if the maximum auto-expansion space for the current disk data file,
data_disk_capacity, is set to the value ofdatafile_maxsize, anddata_disk_capacityis greater thandata_disk_allocated, it indicates that the automatic expansion setting was successful.
What to do next
After successful configuration, the system will automatically expand the data file based on its actual usage, taking into account the values of datafile_next and datafile_maxsize, thereby minimizing disk allocation.
References
Installation directory structure of an OBServer node