CREATE LOG STORE Statement

Creates a log store for use by one or more windows. Unlike a memory store, which is the default, a log store persists data to disk so that it can be recovered after a shutdown or failure.

Syntax

CREATE [DEFAULT] LOG STORE storename 
PROPERTIES
filename='filepath'
[sync={ true | false},]
[sweepamount=size,]
[reservepct=size,]
[ckcount=size,]
[maxfilesize=filesize];

Properties

filename

The absolute or relative path to the folder where log store files should be written. The relative path is preferred.

maxfilesize

The maximum size of the log store file in MB. Default is 8MB.

sync

Specifies whether the persisted data is updated synchronously with input (source) streams being updated; it does not have an effect on derived (local or output) streams. A value of true guarantees that every record acknowledged by the system is persisted at the expense of performance. A value of false improves performance, but it may result in a loss of data that is acknowledged, but not yet persisted. Default is false.

reservepct

The percentage of the log to keep as free space. Default is 20 percent.

sweepamount

The amount of data, in megabytes, that can be cleaned in a single pass. Default is 20 percent of maxfilesize.

ckcount

The maximum number of records written before writing the intermediate metadata. Default is 10,000.

Components

storename An identifier that can be referenced in the STORE clause of stateful elements. Must be unique.
filepath A path to the log store folder, enclosed in single quotes
size An integer.
filesize A size in MB.

Usage

A log store is a disk-optimized store that is persisted on the disk. The state of windows assigned to a log store are restored upon recovery, and the state of memory store windows that receive data from a log store window are recomputed when possible. Log stores are implemented as memory mapped files. The filename property is required; however, sync, sweepamount, reservepct, and ckcount are optional. If these properties are not specified, the store refers to their default values.

Specify properties in the PROPERTIES clause, in any order.

You cannot specify memory store properties for log store properties, or log store properties for memory properties.

If DEFAULT is specified, the store is the default store for the module or project. The store is used for stateful elements that do not explicitly specify a store with a STORE clause. When a store is not defined for the project or module, a default memory store is automatically created for holding the stateful elements. Due to the restrictions on the use of log stores, making a log store the default store for a project is NOT recommended

Example

CREATE LOG STORE myStore
PROPERTIES
filename='myfile',
maxfilesize=16,
sweepamount=4,
ckcount=15000,
reservepct=20,
sync=false;