Write-ahead log
const wal = require('internal').wal
This module provides functionality for administering the write-ahead logs.Most of these functions only return sensible values when invoked with the mmfiles engine being active.
Configuration
retrieves the configuration of the write-ahead loginternal.wal.properties()
Retrieves the configuration of the write-ahead log. The result is a JSONarray with the following attributes:
- allowOversizeEntries: whether or not operations that are bigger than asingle logfile can be executed and stored
- logfileSize: the size of each write-ahead logfile
- historicLogfiles: the maximum number of historic logfiles to keep
- reserveLogfiles: the maximum number of reserve logfiles that ArangoDBallocates in the background
- syncInterval: the interval for automatic synchronization of not-yetsynchronized write-ahead log data (in milliseconds)
- throttleWait: the maximum wait time that operations will wait beforethey get aborted if case of write-throttling (in milliseconds)
- throttleWhenPending: the number of unprocessed garbage-collectionoperations that, when reached, will activate write-throttling. A value of0 means that write-throttling will not be triggered.Examples
- arangosh> require("internal").wal.properties();
Show execution results
- {
- "allowOversizeEntries" : true,
- "logfileSize" : 33554432,
- "historicLogfiles" : 10,
- "reserveLogfiles" : 3,
- "syncInterval" : 100,
- "throttleWait" : 15000,
- "throttleWhenPending" : 0
- }
Hide execution results
configures the write-ahead loginternal.wal.properties(properties)
Configures the behavior of the write-ahead log. properties must be a JSONJSON object with the following attributes:
- allowOversizeEntries: whether or not operations that are bigger than asingle logfile can be executed and stored
- logfileSize: the size of each write-ahead logfile
- historicLogfiles: the maximum number of historic logfiles to keep
- reserveLogfiles: the maximum number of reserve logfiles that ArangoDBallocates in the background
- throttleWait: the maximum wait time that operations will wait beforethey get aborted if case of write-throttling (in milliseconds)
- throttleWhenPending: the number of unprocessed garbage-collectionoperations that, when reached, will activate write-throttling. A value of0 means that write-throttling will not be triggered.Specifying any of the above attributes is optional. Not specified attributeswill be ignored and the configuration for them will not be modified.
Examples
- arangosh> require("internal").wal.properties({
- ........> allowOverSizeEntries: true,
- ........> logfileSize: 32 * 1024 * 1024 });
Show execution results
- {
- "allowOversizeEntries" : true,
- "logfileSize" : 33554432,
- "historicLogfiles" : 10,
- "reserveLogfiles" : 3,
- "syncInterval" : 100,
- "throttleWait" : 15000,
- "throttleWhenPending" : 0
- }
Hide execution results
Flushing
flushes the currently open WAL logfileinternal.wal.flush(waitForSync, waitForCollector)
Flushes the write-ahead log. By flushing the currently active write-aheadlogfile, the data in it can be transferred to collection journals anddatafiles. This is useful to ensure that all data for a collection ispresent in the collection journals and datafiles, for example, when dumpingthe data of a collection.
The waitForSync option determines whether or not the operation shouldblock until the not-yet synchronized data in the write-ahead log wassynchronized to disk.
The waitForCollector operation can be used to specify that the operationshould block until the data in the flushed log has been collected by thewrite-ahead log garbage collector. Note that setting this option to _true_might block for a long time if there are long-running transactions andthe write-ahead log garbage collector cannot finish garbage collection.
Examples
- arangosh> require("internal").wal.flush();
Show execution results
Hide execution results