|Statements / CREATE Statements|
Disk stores provide disk storage for tables and queues that need to overflow or persist (for instance when using an asynchronous write-behind listener).
CREATE DISKSTORE diskstore_name [ MAXLOGSIZE integer-constant ] [ AUTOCOMPACT boolean-constant ] [ ALLOWFORCECOMPACTION boolean-constant ] [ COMPACTIONTHRESHOLD integer-constant ] [ TIMEINTERVAL integer-constant ] [ WRITEBUFFERSIZE integer-constant ] [ QUEUESIZE integer-constant ] [ ( 'dir-name' [ integer-constant ] [,'dir-name' [ integer-constant ] ]* ) ]
The tables in the same disk store will share the same disk persistence attributes. A table without a disk store name belongs to the default disk store.
By default, GemFire XD uses the working directory of the member as the default disk store.
GemFire XD records DML statements in an operation log (oplog) files. This option sets the maximum size in megabytes that the oplog can become before GemFire XD automatically rolls to a new file. This size is the combined sizes of the .crf and .drf oplog files. When GemFire XD creates an oplog file, it immediately reserves this amount of file space. GemFire XD only truncates the unused space on a clean shutdown (for example, gfxd server stop or gfxd shut-down-all).
The default value is 1 GB.
Set this option to "true" (the default) to automatically compact disk files. Set the option to "false" if compaction is not needed or if you intend to manually compact disk files using the gfxd utility.
GemFire XD performs compaction by removing "garbage" data that DML statements generate in the oplog file.
Set this option to "true" to enable online compaction of oplog files using the gfxd utility. By default, this option is set to "false" (disabled).
Sets the threshold for the amount of "garbage" data that can exist in the oplog before GemFire XD initiates automatic compaction. Garbage data is created as DML operations create, update, and delete rows in a table. The threshold is defined as a percentage (an integer from 0–100). The default is 50. When the amount of "garbage" data exceeds this percentage, the disk store becomes eligible for auto-compaction if AUTOCOMPACT is enabled.
Sets the number of milliseconds that can elapse before GemFire XD asynchronously flushes data to disk. TIMEINTERVAL is only used for tables that were created using the asynchronous option in the persistence clause of the CREATE TABLE statement. See CREATE TABLE. The default value is 1000 milliseconds (1 second).
Sets the buffer size in bytes to use when persisting data to disk. The default is 32768 bytes.
Sets the maximum number of row operations that GemFire XD asynchronously queues to disk. After this number of asynchronous operations are queued, additional asynchronous operations block until existing writes are flushed to disk. A single DML operation may affect multiple rows, and each row modification, insertion, and deletion is considered a separate operation. The default QUEUESIZE value is 0, which specifies no limit.
The dir-name element defines the host system directories to use for the disk store. It contains one or more single dir-name elements, made up of:
You can specify any number of dir-name subelements in a CREATE DISKSTORE statement. The data is spread evenly among the active disk files in the directories, keeping within any limits you set.
Use different disk-dir specifications for different disk stores. You cannot use the same directory for the same named disk store in two different members.
This example uses the default base directory and parameter values to create a named disk store:
CREATE DISKSTORE STORE1
This example configures disk store parameters and specifies a storage directory:
CREATE DISKSTORE STORE1 MAXLOGSIZE 1024 AUTOCOMPACT TRUE ALLOWFORCECOMPACTION FALSE COMPACTIONTHRESHOLD 80 TIMEINTERVAL 223344 WRITEBUFFERSIZE 19292393 QUEUESIZE 17374 ('dir1' 456)
This example specifies multiple storage directories and directory sizes for oplog files:
CREATE DISKSTORE STORE1 WRITEBUFFERSIZE 19292393 QUEUESIZE 17374 ('dir1' 456 , 'dir2', 'dir3' 532 )