Back to home page

Enduro/X

 
 

    


0001 LIBNDRXXAQDISKS(8)
0002 ==================
0003 :doctype: manpage
0004 
0005 
0006 NAME
0007 ----
0008 libndrxxaqdisks - Enduro/X TMQ static XA switch loader
0009 libndrxxaqdiskd - Enduro/X TMQ dynamic registration XA switch loader
0010 
0011 
0012 SYNOPSIS
0013 --------
0014 libndrxxaqdisks.so
0015 libndrxxaqdiskd.so
0016 
0017 --------------------------------------------------------------------------------
0018 NDRX_XA_RES_ID=1
0019 NDRX_XA_OPEN_STR=datadir="/path/to/data/directory",qspace="SAMPLESPACE"
0020 NDRX_XA_CLOSE_STR=$NDRX_XA_OPEN_STR
0021 NDRX_XA_DRIVERLIB=libndrxxaqdisks.so
0022 NDRX_XA_RMLIB=libndrxxaqdisk.so
0023 NDRX_XA_LAZY_INIT=1
0024 [NDRX_XA_FLAGS=[FSYNC|FDATASYNC][;DSYNC]]
0025 --------------------------------------------------------------------------------
0026 
0027 DESCRIPTION
0028 -----------
0029 This is Enduro/X *tmqueue(8)* XA driver loader and actual disk based message
0030 queue driver. The actual logic is implemented in *libndrxxaqdisk* library. All
0031 following text describes the work logic of *libndrxxaqdisk*.
0032 
0033 The Open String *NDRX_XA_OPEN_STR* contains comma separated parameters.
0034 The value for parameters may be put in single or double quotes.
0035 
0036 The Open string specifies the the data directory in *datadir* parameter,
0037 where the transaction and message data is kept. The queue space name is 
0038 specified in *qspace* parameter.
0039 
0040 *WARNING:* the data directory (*dataadir*) cannot be shared between different 
0041 queue spaces.
0042 
0043 The XA switch provided *libndrxxaqdisk* is used by *tmqueue(8)* and *tmsrv(8)*
0044 processes. XA operations are processed in following way:
0045 
0046 - If process which processes command is not *tmqueue*, the command is sent to
0047 queue space service.
0048 
0049 - If XA command is processed by *tmqueue* process, then actual logic is performed.
0050 
0051 When library is started, it prepare the following directories,
0052 under the *NDRX_XA_OPEN_STR:*
0053 
0054 - 'NDRX_XA_OPEN_STR'/*active* - used for active command block files. File names
0055 contain global transaction id with sequence number suffix.
0056 
0057 - 'NDRX_XA_OPEN_STR'/*prepared* - used for prepared command block files. File names
0058 contain global transaction id with sequence number suffix.
0059 
0060 - 'NDRX_XA_OPEN_STR'/*committed* - used for committed command block files. File
0061 names are set to message id. Here only message files are stored, and no other
0062 command blocks (.e.g. nor delete, nor update files).
0063 
0064 *NDRX_XA_OPEN_STR* specified directory cannot be shared between different 
0065 *tmqueue(8)* processes having different *NDRX_XA_RES_ID*.
0066 
0067 Command block files have following types:
0068 
0069 - New message, including message blob.
0070 
0071 - Update message command file (used for automatic forward queue updates). Contains
0072 updated header information to replace in message file.
0073 
0074 - Delete message (after dequeue).
0075 
0076 - Dummy message (used for marking prepared read only transactions, and are associated
0077 at startup with any active transaction, to perform rollbacks with out message file
0078 content read).
0079 
0080 Each command block file refers to one message only, thus sequence numbers are
0081 used for keeping them linked to one global. Thought this architecture partially 
0082 breaks the Atomicity property of ACID, as committed or rollbacked messages
0083 in queue appears one by one, instead of all by once.
0084 
0085 To ensure that messages does not corrupt in case of power outage, disk synchronization 
0086 *NDRX_XA_FLAGS* configuration may be set (the default is not set):
0087 
0088 - Set flag *FSYNC* to ensure the enqueued message contents are flushed to disk.
0089 
0090 - Set flag *FDATASYNC* instead of *FSYNC*, to ensure that message contents are
0091 persisted to disk, but file modification time stamps are not updated (for
0092 faster flushing reasons).
0093 
0094 - Conditionally set *DSYNC* (for Linux and Solaris), to synchronize file system
0095 contents to disk when new message file is created. For other operating systems,
0096 please consult with vendor manuals, when directory must flushed (fsync()) in order
0097 to persist the new file.
0098 
0099 - The default approach by tmqueue disk queue driver is to use fflush() unix call
0100 to submit changes to OS kernel, instead to disk.
0101 
0102 NB: If using *FSYNC*, *FDATASYNC*, *DSYNC* expect performance impact of the
0103 message processing.
0104 
0105 Operations with disk are following for *tpenqueue(3)*:
0106 
0107 - New file containing the new message command block (including message buffer content)
0108 is create in *active* directory. If configured *FSYNC* or *FDATASYNC* flags, 
0109 the file contents are synchronized to disk with fsync() or fdatasync(). File
0110 name corresponds to global transaction id, with "-NNN" suffix, where NNN is command
0111 block sequence number in the transactions.
0112 
0113 - When prepare happens (tpcommit() issued), command file (new message) is 
0114 moved to *prepared* directory, if *DSYNC* flag is set, fsync() call is 
0115 used to synchronize directory to disk.
0116 
0117 - When commit happens from 2PC, message file is moved to *committed* directory.
0118 If *DSYNC* is set, directory is synchronized with fsync(). During the move of
0119 the message files, the file is renamed to match the message id, instead of 
0120 transaction id.
0121 
0122 Operations with disk are following for *tpdequeue(3)*:
0123 
0124 - New file containing delete message command block file is create in *active* directory. 
0125 If configured *FSYNC* or *FDATASYNC* flags, the file contents are synchronized 
0126 to disk with fsync() or fdatasync(). File name corresponds to global transaction id, 
0127 with "-NNN" suffix, where NNN is command block sequence number in the transactions.
0128 
0129 - When prepare happens (tpcommit()), command file (delete message) is 
0130 moved to *prepared* directory, if *DSYNC* flag is set, fsync() call is 
0131 used to synchronize directory to disk.
0132 
0133 - When commit happens of 2PC, the dequeued message is removed from *committed*
0134 directory. If *DSYNC* is set, *committed* directory is synchronized with disk. 
0135 Afterwards command block of delete message is removed from *prepared* directory.
0136 
0137 ASSUMPTIONS
0138 -----------
0139 To ensure transaction of the message files, following assumptions are used:
0140 
0141 - File system file rename operation is atomic.
0142 
0143 - Disk sector writes are assumed to be atomic.
0144 
0145 BUGS
0146 ----
0147 Report bugs to support@mavimax.com
0148 
0149 If data directory is located on Linux *ext4* file system
0150 and FSYNC/FDATASYNC/DSYNC flags are used, the queue might perform much slower
0151 than physical hard disk is capable of. Instead, it is recommended to
0152 use *xfs* file system for Linux data partitions, which performs better.
0153 
0154 SEE ALSO
0155 --------
0156 *tmqueue(8)* *ndrxconfig.xml(5)* *tmsrv(8)* *ex_env(5)*
0157 
0158 COPYING
0159 -------
0160 (C) Mavimax, Ltd
0161