Top
ETERNUS SF AdvancedCopy Manager 14.1 Operator's Guide

A.2.2 Post-processing of backup

The name of a script file for post-processing of a backup is as follows.

In the case of non-cluster operation
environment-settings-directory \etc\scripts\OpcBackupPost.js
In the case of cluster operation
<Shared disk>:\etc\opt\swstorage\etc\backup\scripts\OpcBackupPost.js

A.2.2.1 Post-processing script for backup

  1: // AdvancedCopy Manager for Windows
  2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009
  3: //
  4: // OpcBackupPost.js: Post-Processing Script for swstbackup
  5: //
  6: // [Parameters]
  7: // 1st argument: device name of transaction volume
  8: //
  9: // [Return Values]
 10: // 0: The script ended normally.
 11: // 2: The number of the arguments is incorrect.
 12: // (1,3,5-8): not used, but must not be used because older versions use these values.
 13: // 4: An error other than the above occurred.
 14: 
 15: try {
 16:    // create global objects
 17:    var WshShell = WScript.CreateObject("WScript.Shell");              // create Shell object
 18:    var WshEnv    = WshShell.Environment("PROCESS");                    // create Environment object
 19:    var fsObj= WScript.CreateObject("Scripting.FileSystemObject"); // create FileSystemObject object
 20: 
 21:    // create SwstBackupPostProc object
 22:    var proc = new SwstBackupPostProc();
 23: 
 24:    // do nothing if postprocessing file exists
 25:    if (fsObj.FileExists(proc.postFileName) == false) {
 26:  SwstQuit(0);
 27:    }
 28: 
 29:    // get postprocessing type
 30:    var postProcType = proc.getPostProcData(proc.postFileName);
 31:    switch(postProcType) {
 32:    case "none":
 33:  proc.doNothing();
 34:  break;
 35:    }
 36: 
 37:    // do nothing if postprocessing file exists
 38:    if (fsObj.FileExists(proc.bdFileName) == true) {
 39:  var bvName = proc.getPostProcData(proc.bdFileName);
 40:  proc.doNothing();
 41:    }
 42: 
 43:    // clear temporary files
 44:    proc.deletePostFile(proc.postFileName);
 45:    proc.deletePostFile(proc.bdFileName);
 46:    SwstQuit(0);
 47: } catch (e) {
 48:    SwstQuit(6);
 49: }
 50: 
 51: function SwstBackupPostProc()
 52: {
 53:    // member variables
 54:    this.tvName   = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of transaction volume
 55:    this.postFileName = getDataPathName() + "\\" + getPutFileName(this.tvName) + ".pre";    // name of postprocessing file
 56:    this.bdFileName   = getDataPathName() + "\\" + getPutFileName(this.tvName) + ".bd";    // name of postprocessing file
 57: 
 58:    // member functions
 59:    this.getPostProcData    = getPostProcData;     // self-explanatory
 60:    this.doNothing      = doNothing;            // self-explanatory
 61:    this.deletePostFile= deletePostFile;      // self-explanatory
 62: }
 63: 
 64: function getPostProcData(postfile)
 65: {
 66:    var iomode = 1; // means read-only mode
 67:    var create = false; // means not to create a file
 68:    var postFileStream = fsObj.OpenTextFile(postfile, iomode, create);
 69:    var postData = postFileStream.ReadAll();
 70:    postFileStream.Close();
 71:    return postData;
 72: }
 73: 
 74: function doNothing()
 75: {
 76:    // do nothing
 77: }
 78: 
 79: function deletePostFile(postfile)
 80: {
 81:    if (fsObj.FileExists(postfile) == true) {
 82:  fsObj.DeleteFile(postfile);
 83:    }
 84: }
 85: 
 86: function SwstQuit(exitStatus)
 87: {
 88:    switch(exitStatus) {
 89:    case 0:
 90:  WScript.Quit(0);
 91:    case 1:
 92:  WScript.Echo("[Backup Postprocessing] The number of the arguments is incorrect.");
 93:  WScript.Quit(2);
 94:    default:
 95:  WScript.Echo("[Backup Postprocessing] The script exited abnormally.");
 96:  WScript.Quit(4);
 97:    }
 98: }
 99: 
100: function getDataPathName()
101: {
102:    return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\backup\\data\\DEFAULT";
103: }
104: 
105: function getBinPathName()
106: {
107:    return WshShell.RegRead(getSetupInfoKey() + "\\PathName") + "\\bin";
108: }
109: 
110: function getSetupInfoKey()
111: {
112:    var nodeName = WshEnv.Item("SWSTGNODE");
113:    if( nodeName != "" ){
114:  return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName;
115:    }
116:    return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion";
117: }
118: 
119: function getPutFileName(deviceName){
120:    var fileName;
121:    if( isSafeDISKName(deviceName) ){
122:  var re = /(\S+)\/(\S+):(\S+)/;
123:  fileName = deviceName.replace(re, "$1_$2_$3");
124:    }else{
125:  fileName = deviceName;
126:    }
127:    return(fileName);
128: }
129: 
130: function getGXDXPX(deviceName){
131:    var gXdXpX;
132:    if( isSafeDISKName(deviceName) ){
133:  var re = /(\S+)\/(\S+):(\S+)/;
134:  gXdXpX = deviceName.replace(re, "$3");
135:    }else{
136:  gXdXpX = deviceName;
137:    }
138:    return(gXdXpX);
139: }
140: 
141: function isSafeDISKName(deviceName){
142:    var key = ":g";
143:    var s = deviceName.indexOf(key);
144:    if ( s < 0 ) {
145:  return (false);
146:    } else {
147:  return (true);
148:    }
149: }

Point

The transaction volume is locked/unlocked, and the buffer is flushed by the command, not by the script. Therefore, the backup pre-processing script and backup post-processing script are executed immediately before and after (respectively) the transaction volume is locked/unlocked and the buffer is flushed. The backup pre-processing and post-processing scripts do not perform any processing.

Figure A.2 Snapshot-type backup (OPC)

Figure A.3 Synchronous-type backup (EC) in a non-cluster system

Figure A.4 Synchronous-type backup (EC) in a cluster system operation

Note

  • In the pre-processing for synchronous processing and the backup pre-processing, to avoid a temporary access contention with other applications, locking is retried if it cannot complete its operation. If the number of times the command is executed reaches the specified retry limit, locking ends abnormally.

    If an abnormal end occurs, any process that is using the transaction volume or backup volume remains active. Stop all applications and services involved or take other appropriate measures so that the volume cannot be used by another process.

    The retry limit can be changed by creating volume locking specification files and re-setting the limit (for details of these files, refer to the Transaction volume locking specification file for backups and to the Backup volume locking specification file for backups). However, the files do not need to be created if appropriate measures have been taken to prevent other processes from using the target volumes during backup processing execution.

  • For a synchronous-type backup in a cluster system operation, in order to prevent the cluster system from being monitored, the backup volume is locked only while the backup synchronous processing start command and the backup execution command are running (refer to the figure above). That is, the backup volume remains unlocked from the time that the backup synchronous processing start command is executed to the time that the backup execution command is executed.

    This may cause a message to be output to the event log. This message is described in "About the message outputted to an event viewer" in "General notes". Since there is no problem, the message can be ignored.

A.2.2.2 Transaction volume locking specification file for backups

If locking fails in the transaction volume backup pre-processing, locking is retried in order to avoid a temporary access conflict with other applications. The standard retry operations are as follows:

The maximum number of retries (the default value = 20 times) and retry interval (the default value = 1 second) can be changed by creating a setting file called the transaction volume locking specification file for backups. In this file, the following instructions can be specified for the transaction volume backup pre-processing:

Note

swstresback (resource backup command) cannot back up the transaction volume locking specification file for backups. In operations that use this file, the copy command, etc., must be executed to back up the transaction volume locking specification file for backups.


A.2.2.2.1 Creating a transaction volume locking specification file for backups

Use a name similar to the one below to create a transaction volume locking specification file for backups.

File name

In the case of non-cluster operation

"environment-settings-directory\etc\backup\data\BTRANLOCK.INI

In the case of cluster operation

<Shared disk>:\etc\opt\swstorage\etc\backup\data\BTRANLOCK.INI

Examples of settings in this file are listed below.

[g1d1p1]
BufferFlushOnly=off
LockForceMode=on
LockRetryNumber=10
LockRetryInterval=10
[g1d1p2]
BufferFlushOnly=on
[ANY]
BufferFlushOnly=off
LockForceMode=off
LockRetryNumber=20
LockRetryInterval=100

An explanation of how to create this file is given below.

BTRANLOCK.INI parameter settings

Key

Explanation

BufferFlushOnly

Specifies flushing the file system buffer of the transaction volume instead of locking the transaction volume:

off (default value) = the buffer is not flushed (locking)

on = the buffer is flushed (no locking)

If the Xflush option is specified in swstbackup or swstbackup_exchange and BufferFlushOnly=off, then the Xflush option has priority.
If BufferFlushOnly is set to on, all other parameters (LockForceMode, LockRetryNumber, and LockRetryInterval) become invalid.
Before this parameter is set to on, all write processing on the transaction volume must be stopped. If a replica is created without the write processing stopped, then the transaction volume data is not guaranteed.
If on is specified for NoPrePost, then this parameter becomes invalid.

LockForceMode

If locking of the transaction volume fails, locking is retried. This parameter specifies that the volume be dismounted before locking is retried.

off (default value) = no dismounting before locking is retried

on = dismounting before locking is retried

When the volume is dismounted, all handles opened for the volume become invalid.

* If the volume is set in the used state immediately after it is dismounted, then locking may be impossible.

If on is specified for BufferFlushOnly or NoPrePost, then this parameter becomes invalid.

LockRetryNumber

If locking of the transaction volume fails, locking is retried. This parameter specifies the retry count limit. A numeric value ranging from 1 to 10,000 can be specified.

The default value is 20 (retries).

If the transaction volume cannot be locked after locking is retried for the specified retry count limit, then the processing is suspended and the command ends abnormally.
If on is specified for BufferFlushOnly or NoPrePost, then this parameter becomes invalid.

LockRetryInterval

If locking of the transaction volume fails, locking is retried. This parameter specifies the retry interval (in milliseconds). A numeric value ranging from 1 to 600,000 (10 minutes) can be specified. The default value is 1,000 (1 second).
If on is specified for BufferFlushOnly or NoPrePost, then this parameter becomes invalid.

NoPrePost

Specifies that the backup pre-processing and post-processing are not to be performed.

off (default value) = The backup pre-processing and post-processing are performed.

on = The backup pre-processing and post-processing are not performed.

Setting NoPrePost to on disables all the other parameters (BufferFlushOnly, LockForceMode, LockRetryNumber, and LockRetryInterval).


A.2.2.3 Backup volume locking specification file for backups

If locking fails in the backup volume backup pre-processing, locking is retried to avoid a temporary access conflict with other applications. The standard retry operations are as follows:

The maximum number of retries (the default value is 20 attempts) and the retry interval (the default value is 1 second) can be changed by creating a setting file called the backup volume locking specification file for backups. In this file, the following instructions can be specified for the backup volume backup pre-processing:

Note

swstresback (resource backup command) cannot back up the backup volume locking specification file for backups. In operations that use this file, the copy command, etc., must be executed to back up this file.


A.2.2.3.1 Creating a backup volume locking specification file for backups

Use a name such as the one below to create a backup volume locking specification file for backups.

File name

For a non-cluster operation

environment-setting-directory\etc\backup\data\BBACKLOCK.INI

For a cluster operation

<shared-disk>:\etc\opt\swstorage\etc\backup\data\BBACKLOCK.INI

Examples of settings in the backup volume locking specification file for backup are listed below.

[g1d1p1]
LockForceMode=on
LockRetryNumber=10
LockRetryInterval=10
[ANY]
LockForceMode=off
LockRetryNumber=20
LockRetryInterval=100

An explanation of how to create a backup volume locking specification file for backups is given below.

BBACKLOCK.INI parameter settings

Key

Explanation

LockForceMode

If locking of the backup volume fails, locking is retried. This parameter specifies that the volume is to be dismounted before locking is retried.

off (default value) = no dismount before locking is retried

on = dismount before locking is retried

When the volume is dismounted, all handles opened for the volume become invalid.

* If the volume is set in the used state immediately after it is dismounted, then locking may be impossible.

LockRetryNumber

If locking of the backup volume fails, locking is retried. This parameter specifies the retry count. A numeric value ranging from 1 to 10,000 can be specified.
The default value is 20 (retries).
If the backup volume cannot be locked after locking is retried for the specified retry count, then the processing is suspended and the command ends abnormally.

LockRetryInterval

If locking of the backup volume fails, locking is retried. This parameter specifies the retry interval (in milliseconds). A numeric value ranging from 1 to 600,000 (10 minutes) can be specified. The default value is 1,000 (1 second).