In a DB2® pureScale® environment, each member maintains its own set of transaction log files (that is, a log stream) on the shared disk, each set in a separate log path. The log files for a member contain a history of all data changes that occurred on that member.
Multiple applications, each accessing a different member simultaneously, might generate dependent transactions during run time. A dependency between two transactions can occur if, for example, both transactions change the same row. To effectively interpret the log records, the DB2 data server must examine the records from all log streams and order the records so that they reflect the order of the updates that occurred at run time. This ordering is known as a log stream merge operation. Several operation types in a DB2 pureScale environment require log stream merges; these include (among others) group crash recovery, database roll-forward operations, and table space roll-forward operations.
Parameter | Global? | Dynamically updatable? |
---|---|---|
archretrydelay | Yes | Yes |
blk_log_dsk_ful | No | Yes |
failarchpath | Yes | Yes |
logarchcompr1 | Yes | Yes |
logarchcompr2 | Yes | Yes |
logarchmeth1 | Yes | Yes |
logarchmeth2 | Yes | Yes |
logarchopt1 | Yes | Yes |
logarchopt2 | Yes | Yes |
logbufsz | No | Yes |
logfilsiz | Yes | No |
logprimary | Yes | No |
logsecond | Yes | Yes |
max_log | No | Yes |
mirrorlogpath 1 | Yes | No |
newlogpath 1 | Yes | No |
num_log_span | No | Yes |
numarchretry | Yes | Yes |
overflowlogpath | Yes | Yes |
page_age_trgt_grc | Yes | No |
page_age_trgt_mrc | Yes | No |
softmax2 | Yes | No |
vendoropt | Yes | Yes |
1 The first
member that connects to or activates the database processes the changes
to this log path parameter. The DB2 database
manager verifies that the path exists and that it has both read and
write access to that path. It also creates member-specific subdirectories
for the log files. If any one of these operations fails, the DB2 database manager rejects the
specified path and brings the database online using the old path.
If the database manager accepts the specified path, the new value
is propagated to each member. If a member fails while trying to switch
to the new path, subsequent attempts to activate the database or to
connect to it fails, and SQL5099N is returned. All members must use
the same log path. 2
Important: The softmax database
configuration parameter is deprecated is deprecated in Version 10.5 and
might be removed in a future release. For more information, see Some database configuration parameters are deprecated.
|
Member 0 retrieves its own logs here:
/home/dbuser/overflow/NODE0000/LOGSTREAM0000/LOGSTREAM0000
Member 0 retrieves logs that belong to member 1 here:
/home/dbuser/overflow/NODE0000/LOGSTREAM0000/LOGSTREAM0001
Member 0 retrieves logs that belong to member 2 here:
/home/dbuser/overflow/NODE0000/LOGSTREAM0000/LOGSTREAM0002
When reading archived log files that are owned by other members, a member might need to retrieve log files in to its own log path or overflow log path. In this case, the log stream merge operation creates a db2logmgr engine dispatchable unit (EDU) for each log stream, as needed.
Output from the GET DATABASE CONFIGURATION command in a DB2 pureScale environment identifies each log path followed by the name of the member. For example, if the mirror log path was set to /home/dbuser/mirrorpath/, for member 2, the output displays /home/dbuser/mirrorpath/NODE0000/LOGSTREAM0002.
If you must manually retrieve log files that are owned by other members, ensure that the database manager can access the log files by using the same directory structure that is automatically created. For example, to make logs from member 2 available in the overflow log path of member 1, place the logs in the /home/dbuser/overflow/NODE0000/LOGSTREAM0001/LOGSTREAM0002 directory.
Retrieved log files are automatically deleted when they are no longer needed. Subdirectories that were created during a log stream merge operation are retained for future use.
If you accidentally deleted, moved, or archived and lost a log file that is required for a recovery operation, you can roll-forward recover the database to the last consistent point before the missing log file.
If, during a log stream merge operation, the DB2 database manager determines that there is a missing log file in one of the log streams, an error is returned. The roll-forward utility returns SQL1273N; the db2ReadLog API returns SQL2657N.
Consider a scenario where only log file 4 from log stream 1 is missing, a roll-forward operation to time A succeeds while roll-forward operations to time B, time C, or to the END OF LOGS fail. The ROLLFORWARD command returns SQL1273N because log file 4 is not available. Furthermore, since the log records in files 2 and 3 on log stream 0 were written during the same time period as the beginning of log file 4 on log stream 1, the roll-forward operation cannot process log files 2 and 3 until log file 4 from log stream 1 is available. The result is that the roll-forward operation stops at time A, and any subsequent roll-forward operations cannot proceed beyond time A until log 4 from stream 1 becomes available.
Consider another scenario where only log file 4 from log stream 0 is missing during a roll-forward operation. If you issue a ROLLFORWARD command with the END OF LOGS option (or anytime after time B), the operation will stop at time B and will return SQL1273N because log file 4 on stream 0 is missing. A roll-forward operation can replay log records from files 2 and 3 on log stream 0 and some logs from file 4 on stream 1 up to time B. The roll-forward operation must stop at time B even though additional logs from stream 1 are available because the log merge process requires that all the logs from all the streams be available.
If you can find the missing log file, make it available and reissue the ROLLFORWARD DATABASE command. If you cannot find the missing log file, issue the ROLLFORWARD DATABASE...STOP command to complete the roll-forward operation at the last consistent point just before the missing log file.
Although missing log detection ensures that database corruption does not occur as a result of missing log files, the presence of missing log files prevents some transactions from being replayed and, as a result, data loss could occur if the missing log files are not located.
Log stream merge operations require additional EDUs. During database activation, one db2lfr EDU is created on each member. When a log read operation that requires a log stream merge is initiated, one db2shred EDU and one db2lfr EDU is created for each log stream. Although each db2lfr-db2shred group allocates its own set of log page and log record buffers, this is not a significant amount of additional memory or system resources; approximately 400 KB is allocated for each member that is involved in the log stream merge.
During a log stream merge operation, a member retrieves log files that are owned by other members into its overflow log path, primary log path, or mirror log path. In a DB2 pureScale environment, ensure that there is adequate free disk space in the retrieval path before starting a roll-forward operation. This allows the operation to retrieve the larger number of files from the archive, as required in a DB2 pureScale environment, without affecting performance. Use the following rule-of-thumb to calculate how much space you need to retrieve the active log files for all members: (logprimary + logsecond) * number of members.
db2 update db cfg for db mydb using newlogpath /home/dbuser/logdir
db2 update db cfg for db mydb member 1 using max_log 5
db2 connect to mydb
db2 update db cfg for mydb using newlogpath /home/dbuser/newlogpath
db2 get db cfg for mydb
...
Changed path to log files (NEWLOGPATH) = /home/dbuser/newlogpath/NODE0000/LOGSTREAM0000/
Path to log files = /home/dbuser/dbuser/NODE0000/LOGSTREAM0000/
...
The change does not take effect because the member
is still active.db2 terminate
db2 deactivate db mydb
db2 connect to mydb
db2 get db cfg for mydb
...
Changed path to log files (NEWLOGPATH) =
Path to log files = /home/dbuser/newlogpath/NODE0000/LOGSTREAM0000/
...
Each member uses the /home/dbuser/newlogpath/NODE0000/LOGSTREAMxxxx log
path, where xxxx is the log stream ID of the log
stream that uses the path.db2 restore db mydb newlogpath '/home/dbuser/newlogpath' without prompting