HS.HC.SYS.Mirror
class HS.HC.SYS.Mirror extends %Library.RegisteredObject
This is a utility to setup mirroring of the HSSYS database with minimal user interaction.Two methods are offered:
RunValidate() can be used to ensure the configuration will support setting up mirroring before actually executing the process. The RunValidate method can be useful to ensure it is valid before scheduling off peak updates. The actual update does not take long to take a copy of the HSSYS database.
Run() executes the validation code and then performs the update by dismounting and copying the HSSYS database on the primary.
The full process entails ensuring that mirroring HSSYS will not cause any loss of data from HSSYS by first ensuring all configured foundation namespaces exist on both systems, and ensuring that there is no FHIRSQL data stored in the HSSYS database. The code also checks to see that HSSYS does not exceed 1GB in size (a reasonable assumption, a requirement to ensure the primary is not suspended for excessive amounts of time to copy the database).
Before making changes on either system, Ensure HSSYS isn't already mirrored, Ensure the HS_Services user is enabled (don't enable it, allow the user to set passwords). Backup %SYS("HealthShare"), add mirroring to HSSYS, backup HSSYS database and copy to backup member. Restore HSSYS on backup member and enable mirroring. Failover to complete the process. Ideally the various config item namespaces would be activated to ensure the cpf's (global mappings) are updated to be the same from I4H / HC perspective
Method Inventory
Parameters
parameter CONNECTION = MirrorHSSYS;
this is what we'll name the JDBC connection
parameter COPYFILENAME = COPY_IRIS.DAT;
Before replacing the IRIS.DAT we'll make a copy, this is the name
parameter DOMAIN = HSSYSToolsLoc;
parameter EXPORTVERSION;
When code is exported as a file for WRC download, update the parameter with the filename for tracking purposes.
For example, a customer can Write $parameter("HS.HC.SYS.Mirror","EXPORTVERSION") to retrieve the version that is running.
For example, a customer can Write $parameter("HS.HC.SYS.Mirror","EXPORTVERSION") to retrieve the version that is running.
parameter MAXFILESIZE = 1000;
Maximum file size of HSSYS before we report that it can't be downloaded (in MB)
Methods
classmethod Cleanup()
@API
Remove the generated classes (connecting to primary system) and the Gateway connection
Remove the generated classes (connecting to primary system) and the Gateway connection
classmethod Comparison(pComparison As %DynamicObject, pErrorsAreFatal As %Boolean = 1)
@API
Performs comparison of system configurations between mirror members. This method orchestrates the validation of security objects and namespace configurations to ensure both primary and a backup system are properly aligned before HSSYS database mirroring.
The method is coded as an API so that users could specifically call Configuration() on each system and build a pComparison object with 'thisSystem' and 'remoteSystem' objects set, providing the ability to bypass using JDBC in cases where perhaps there isn't connectivitiy ie a disconnected DR member.
The method performs validation in two main phases:
1. **Security Object Comparison**: Validates roles, resources, csp applications, tasks and users are identical
2. **Namespace Analysis**:
- Existence validation across both systems
- Mirror status verification (globals database must be mirrored)
- Activation status
- Detailed namespace mapping comparison
**Error Categories Detected:**
- **NotMirrored**: Namespace exists but is not configured for mirroring
- **Missing**: Namespace exists on one system but not the other
- **NotActivated**: Namespace activation status differs between systems
- **Mapping Differences**: Global, Routine, or Package mapping discrepancies
@param pComparison %DynamicObject - Comparison object containing system comparison data and collecting validation results
- Input: Must contain thisSystem and remoteSystem properties with complete configuration data
- Output: pComparison is updated with validation errors in errors array, maintains done boolean status
@param pErrorsAreFatal - Whether all errors including mapping, roles, resources are fatal. Only set to false when advised by InterSystems Support
@throws None - All validation errors are logged to pComparison object via LogError() method
**Prerequisites:**
- pComparison.thisSystem must contain complete system configuration from Configuration() method
- pComparison.remoteSystem must contain complete remote system configuration from remote Configuration() call
**Side Effects:**
- Modifies pComparison.errors array with any validation failures found
- Will set pComparison.done to false if errors are encountered
Performs comparison of system configurations between mirror members. This method orchestrates the validation of security objects and namespace configurations to ensure both primary and a backup system are properly aligned before HSSYS database mirroring.
The method is coded as an API so that users could specifically call Configuration() on each system and build a pComparison object with 'thisSystem' and 'remoteSystem' objects set, providing the ability to bypass using JDBC in cases where perhaps there isn't connectivitiy ie a disconnected DR member.
The method performs validation in two main phases:
1. **Security Object Comparison**: Validates roles, resources, csp applications, tasks and users are identical
2. **Namespace Analysis**:
- Existence validation across both systems
- Mirror status verification (globals database must be mirrored)
- Activation status
- Detailed namespace mapping comparison
**Error Categories Detected:**
- **NotMirrored**: Namespace exists but is not configured for mirroring
- **Missing**: Namespace exists on one system but not the other
- **NotActivated**: Namespace activation status differs between systems
- **Mapping Differences**: Global, Routine, or Package mapping discrepancies
@param pComparison %DynamicObject - Comparison object containing system comparison data and collecting validation results
- Input: Must contain thisSystem and remoteSystem properties with complete configuration data
- Output: pComparison is updated with validation errors in errors array, maintains done boolean status
@param pErrorsAreFatal - Whether all errors including mapping, roles, resources are fatal. Only set to false when advised by InterSystems Support
@throws None - All validation errors are logged to pComparison object via LogError() method
**Prerequisites:**
- pComparison.thisSystem must contain complete system configuration from Configuration() method
- pComparison.remoteSystem must contain complete remote system configuration from remote Configuration() call
**Side Effects:**
- Modifies pComparison.errors array with any validation failures found
- Will set pComparison.done to false if errors are encountered
classmethod Configuration() as %Stream.FileCharacter [ SQLProc = Mirror_Configuration ]
Projected as the stored procedure: Mirror_Configuration
@API
Build a configuration object, returned as a json string for this system, which may be useful when performing a comparison between Primary and DR systems
Build a configuration object, returned as a json string for this system, which may be useful when performing a comparison between Primary and DR systems
classmethod Run(pHostname As %String = "", pSuperServerPort As %Integer = 1972, pNamespace As %String = "HSLIB", pUsername As %String = "", pPassword As %String = "", pVerbose As %Boolean = 1, pFatal As %Boolean = 1) as %DynamicObject
@API
Execute setting up HSSYS as a mirrored database. This is required to be run from the backup member
@argument pHostName The the host fqdn or ip address of the Primary host
@argument pSuperServerPort The super server port number of the primary instance
@argument pNamespace Defaulted to HSLIB
@argument pUsername Username for an authorized user
@argument pPassword Password for an authorized user
@argument pVerbose 1/0 whether to display informational messages
@argument pFatal Whether all errors including mapping, roles, resources are fatal. Only set to false when advised by InterSystems Support
@returns DynamicObject A dynamic object containing any status information with nodes described below
done a boolean true/false indicating the completion of the mapping of HSSYS
messages an array of success messages (strings) for completed steps
errors an array of objects with properties code, text, stack
Execute setting up HSSYS as a mirrored database. This is required to be run from the backup member
@argument pHostName The the host fqdn or ip address of the Primary host
@argument pSuperServerPort The super server port number of the primary instance
@argument pNamespace Defaulted to HSLIB
@argument pUsername Username for an authorized user
@argument pPassword Password for an authorized user
@argument pVerbose 1/0 whether to display informational messages
@argument pFatal Whether all errors including mapping, roles, resources are fatal. Only set to false when advised by InterSystems Support
@returns DynamicObject A dynamic object containing any status information with nodes described below
done a boolean true/false indicating the completion of the mapping of HSSYS
messages an array of success messages (strings) for completed steps
errors an array of objects with properties code, text, stack
classmethod RunValidate(pHostname As %String = "", pSuperServerPort As %Integer = 1972, pNamespace As %String = "HSLIB", pUsername As %String = "", pPassword As %String = "", pVerbose As %Boolean = 1, pFatal As %Boolean = 1) as %DynamicObject
@API
Validate that it is possible to setup HSSYS as a mirrored database. This step can be called before executing Run() but is not necessary, Run() will also validate before continuing the configuraiton.
This is required to be run from the backup member
@argument pHostName The the host fqdn or ip address of the Primary host
@argument pSuperServerPort The super server port number of the primary instance
@argument pNamespace Defaulted to HSLIB
@argument pUsername Username for an authorized user
@argument pPassword Password for an authorized user
@argument pVerbose 1/0 whether to display informational messages
@argument pFatal Whether all errors including mapping, roles, resources are fatal. Only set to false when advised by InterSystems Support
@returns DynamicObject A dynamic object containing any status information with nodes described below
done a boolean true/false indicating the potential completion of the mapping of HSSYS
messages an array of success messages (strings) for completed steps
errors an array of objects with properties code, text, stack
Validate that it is possible to setup HSSYS as a mirrored database. This step can be called before executing Run() but is not necessary, Run() will also validate before continuing the configuraiton.
This is required to be run from the backup member
@argument pHostName The the host fqdn or ip address of the Primary host
@argument pSuperServerPort The super server port number of the primary instance
@argument pNamespace Defaulted to HSLIB
@argument pUsername Username for an authorized user
@argument pPassword Password for an authorized user
@argument pVerbose 1/0 whether to display informational messages
@argument pFatal Whether all errors including mapping, roles, resources are fatal. Only set to false when advised by InterSystems Support
@returns DynamicObject A dynamic object containing any status information with nodes described below
done a boolean true/false indicating the potential completion of the mapping of HSSYS
messages an array of success messages (strings) for completed steps
errors an array of objects with properties code, text, stack
Inherited Members
Inherited Methods
- %AddToSaveSet()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %IsModified()
- %New()
- %NormalizeObject()
- %ObjectModified()
- %OriginalNamespace()
- %PackageName()
- %RemoveFromSaveSet()
- %SerializeObject()
- %SetModified()
- %ValidateObject()