blob: db0fd09788191bf35b5cc93f0c1d1e96e99d13f9 [file] [log] [blame]
---
title: Disk Store Operation Logs
---
<!--
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.
-->
At creation, each operation log is initialized at the disk store's `max-oplog-size`, with the size divided between the `crf` and `drf` files. When the oplog is closed, <%=vars.product_name_long%> shrinks the files to the space used in each file.
<a id="operation_logs__section_C0B1391492394A908577C29772902A42"></a>
After the oplog is closed, <%=vars.product_name%> also attempts to create a `krf` file, which contains the key names as well as the offset for the value within the `crf` file. Although this file is not required for startup, if it is available, it will improve startup performance by allowing <%=vars.product_name%> to load the entry values in the background after the entry keys are loaded.
When an operation log is full, <%=vars.product_name%> automatically closes it and creates a new log with the next sequence number. This is called *oplog rolling*. You can also request an oplog rolling through the API call `DiskStore.forceRoll`. You may want to do this immediately before compacting your disk stores, so the latest oplog is available for compaction.
**Note:**
Log compaction can change the names of the disk store files. File number sequencing is usually altered, with some existing logs removed or replaced by newer logs with higher numbering. <%=vars.product_name%> always starts a new log at a number higher than any existing number.
This example listing shows the logs in a system with only one disk directory specified for the store. The first log (`BACKUPCacheOverflow_1.crf` and `BACKUPCacheOverflow_1.drf`) has been closed and the system is writing to the second log.
``` pre
bash-2.05$ ls -tlra
total 55180
drwxrwxr-x 7 person users 512 Mar 22 13:56 ..
-rw-rw-r-- 1 person users 0 Mar 22 13:57 BACKUPCacheOverflow_2.drf
-rw-rw-r-- 1 person users 426549 Mar 22 13:57 BACKUPCacheOverflow_2.crf
-rw-rw-r-- 1 person users 0 Mar 22 13:57 BACKUPCacheOverflow_1.drf
-rw-rw-r-- 1 person users 936558 Mar 22 13:57 BACKUPCacheOverflow_1.crf
-rw-rw-r-- 1 person users 1924 Mar 22 13:57 BACKUPCacheOverflow.if
drwxrwxr-x 2 person users 2560 Mar 22 13:57 .
```
The system rotates through all available disk directories to write its logs. The next log is always started in a directory that has not reached its configured capacity, if one exists.
## <a id="operation_logs__section_8431984F4E6644D79292850CCA60E6E3" class="no-quick-link"></a>When Disk Store Oplogs Reach the Configured Disk Capacity
If no directory exists that is within its capacity limits, how <%=vars.product_name%> handles this depends on whether automatic compaction is enabled.
- If auto-compaction is enabled, <%=vars.product_name%> creates a new oplog in one of the directories, going over the limit, and logs a warning that reports:
``` pre
Even though the configured directory size limit has been exceeded a
new oplog will be created. The current limit is of XXX. The current
space used in the directory is YYY.
```
**Note:**
When auto-compaction is enabled, `dir-size` does not limit how much disk space is used. <%=vars.product_name%> will perform auto-compaction, which should free space, but the system may go over the configured disk limits.
- If auto-compaction is disabled, <%=vars.product_name%> does not create a new oplog, operations in the regions attached to the disk store block, and <%=vars.product_name%> logs this error:
``` pre
Disk is full and rolling is disabled. No space can be created
```