4D v15.4

INTEGRATE MIRROR LOG FILE

Home

 
4D v15.4
INTEGRATE MIRROR LOG FILE

INTEGRATE MIRROR LOG FILE 


 

INTEGRATE MIRROR LOG FILE ( pathName {; operationNum} ) 
Parameter Type   Description
pathName  Text in Name or pathname of the log file to be integrated
operationNum  Real variable in Number of last operation integrated
in New number of last operation integrated

Preliminary note: This command only works with 4D Server. It can only be executed via the Execute on server command or in a stored procedure.

The INTEGRATE MIRROR LOG FILE integrates the log file designated by pathName into a 4D Server database, after the operationNum operation (optional). The command accepts to integrate any log file into the database, even if it does not correspond to the the data file. This command is specifically intended for use in the context of a mirror database. 

Note: Starting with 4D v14, it is possible to use a log file as part of a "mirror" database: the "Use Log File" option can now be checked in the Database Settings of a 4D Server used as a logical mirror, thus allowing the implementation of a series of cascading mirror servers (see the Setting up a logical mirror section in the 4D Server manual).

Unlike the existing INTEGRATE LOG FILE command, at the end of its execution INTEGRATE MIRROR LOG FILE does not replace the current log file with the integrated one: the current log file of the database continues to be used. Accordingly, any changes made during integration are saved in the current log file.

In pathName, you pass an absolute or relative path to the database folder. If you pass an empty string in this parameter, a standard open file dialog box appears so that you can specify the file to be integrated. If this dialog box is canceled, no file is integrated and the OK system variable is set to 0.

By default, when you omit the operationNum parameter, the command integrates all the operations of the log file.
If you pass a value in the operationNum parameter, integration begins at the operation whose number follows the one that it contains. After integration, the value of the operationNum variable is updated with the number of the last operation integrated. You must save this variable and then reuse it as the operationNum parameter for the next integration operation. This allows you to follow on with subsequent log file integrations using INTEGRATE MIRROR LOG FILE.

The following diagram (pseudocode) details the integration process depending on the various cases. In the log file to be integrated, X is the number of the first operation and Y is the number of the last one:

Case of
    : (operationNum < X-1)
                        --> Error 1260 (Selected log file is too recent)
    : (operationNum >= X-1) and (operationNum <= Y)
                        --> Start integration
        Case of
            : (Type of operation = "Addition")
                If (Record exists)
                        --> Error
                Else
                        --> Add record
                End if
            : (Type of operation = "Modification")
                If (Record exists)
                        --> Edit record
                Else
                        --> Error
                End if
            : (Type of operation = "Deletion")
                If (Record exists)
                        --> Delete record
                Else
                        --> Error
                End if
            End case
        Else// operationNum > Y
                        --> Error 1261 (Selected log file is too old for database)
End case

Note that integration will stop at the first error encountered. In this case, if you want to continue with the integration you will need to use the MSC.

If the integration is carried out correctly, the system variable OK is set to 1; otherwise, it is set to 0.



See also 

INTEGRATE LOG FILE

 
PROPERTIES 

Product: 4D
Theme: Backup
Number: 1312

The OK variable is changed by the commandThis command modifies the Error system variableDifferent in remote mode

 
HISTORY 

Created: 4D v14

 
ARTICLE USAGE

4D Language Reference ( 4D v15.4)
4D Language Reference ( 4D v15)
4D Language Reference ( 4D v15.3)