Home > Class Reference > %SYS namespace > DataMove.Data
Private  Storage   

DataMove.Data


persistent class DataMove.Data extends
%Persistent, %XML.Adaptor, %SYSTEM.Help

This class will copy globals from one database to another based on changes to global Mappings.

Use should be limited to documented and supported (not Internal) methods. See CreateFromMapEdits(), Copy() and Activate() methods for more details. Config.Map.InitializeEdits() must be used prior to editing the Mappings and creating the DataMove object.

Inventory


Parameters Properties Methods Queries Indices ForeignKeys Triggers
2 30 107


Summary


Properties
Flags JRNApplied State

Methods
%AddToSaveSet %AddToSyncSet %BMEBuilt %BuildIndicesAsync
%BuildIndicesAsyncResponse %CheckConstraints %CheckConstraintsForExtent %ClassIsLatestVersion
%ClassName %ComposeOid %ConstructClone %Delete
%DeleteExtent %DeleteId %DispatchClassMethod %DispatchGetModified
%DispatchGetProperty %DispatchMethod %DispatchSetModified %DispatchSetMultidimProperty
%DispatchSetProperty %Exists %ExistsId %Extends
%GUID %GUIDSet %GetLock %GetParameter
%GetSwizzleObject %Id %InsertBatch %IsA
%IsModified %IsNull %KillExtent %KillExtentData
%LoadFromMemory %LockExtent %LockId %New
%NormalizeObject %ObjectIsNull %ObjectModified %Oid
%OnBeforeAddToSync %OnDetermineClass %Open %OpenId
%OriginalNamespace %PackageName %PhysicalAddress %PurgeIndices
%Reload %RemoveFromSaveSet %ResolveConcurrencyConflict %RollBack
%Save %SaveDirect %SaveIndices %SerializeObject
%SetModified %SortBegin %SortEnd %SyncObjectIn
%SyncTransport %UnlockExtent %UnlockId %ValidateIndices
%ValidateObject Activate Copy CreateFromMapEdits
Delete DeleteSrcGlobals Dispatch DispatchJob
Display Exists Finish Help
Rollback StopCopy Validate ValidateSizes
XMLDTD XMLExport XMLExportToStream XMLExportToString
XMLNew XMLSchema XMLSchemaNamespace XMLSchemaType


Parameters


• parameter DEFAULTCONCURRENCY = 0;
DEFAULTCONCURRENCY is the default value for the concurrency formal argument defined for %Open, %OpenId, %Delete and %DeleteId methods. It is not the default value of the %Concurrency property of persistent classes. If the value of the actual concurrency argument passed to any of the above methods is -1 then the formal argument value will be set to the value of the DEFAULTCONCURRENCY parameter value defined for the class.
• parameter DOMAIN = "%Utility";
Default Localization Domain

Properties


• property Flags as %Integer [ InitialExpression = 0 ];
Bit Flags to control Data Move.
$$$BitNoSrcJournal - Allow source database to be non-journaled
$$$BitNoWorkerJobs - Don't use 'worker' jobs during the copying of data
$$$BitBatchMode - Run Copy jobs in 'batch' mode
$$$BitCheckActivate - Call $$CheckActivate^ZDATAMOVE() during Activate()
• property JRNApplied as %Integer [ InitialExpression = 0 ];
Number of times that Copy has run ApplyJournals. Note that Activate can not be called until the first ApplyJournals has completed.
• property State as %Integer [ InitialExpression = $$$NotStarted ];
Current State of the operation.
Valid States are as follows:
Done 1
NotStarted 2
Started 3
Size 4
SizeDone 5
Copy 6
CopyDone 7
JrnApply 8
JrnApplyDone 9
FreezeSystem 10
CPFUpdate 11
CPFUpdateDone 12
NSPActivate 13
NSPActivateDone 14
Delete 15
DeleteDone 16
Cleanup 17
CleanupDone 18

Methods


• classmethod Activate(Name As %String, Display As %Boolean = 1, Timeout As %Integer = 120) as %Status
Activate Mapping changes done using the $$$CPFMappingEdit flag. 'Display' enables writing progress messages to the terminal.

Stop the DataMove Copy() background job, finish processing any journal files, and activate the Namespace changes. The application of the final journal file, activation of the Namespace changes, and the handling of Locks will be done using Switch10 to freeze the system.

This may also check the application status, by calling $$CheckActivate^ZDATAMOVE() before starting (if the $$$BitCheckActivate DataMove Flag is set). This must return '1' or Activate will stop.

Note that Activate must acquire a Lock to stop the Copy job from running ApplyJournals. By default, it will wait 120 seconds for the Copy job to finish running an ApplyJournals operation and release its Lock (the wait time may be modified using the 'TimeOut' argument). If it fails for this reason, this may indicate that the system is busy now (too many journal entries), and it might be better to try Activate at a later time. For the same reason, we also require that at least the initial ApplyJournals has completed.

Any errors during the Namespace Activation will try to rollback the mapping changes and leave the original mappings active. Once the problem is resolved, the Copy JOB may be restarted to catch up journal files, or Activate may be tried again.
• method Copy() as %Status
Call from DispatchJob to do the initial DataMove copy as a background job (which may also create other 'worker' jobs). Once the initial copy has completed the job will continue in a loop calling ApplyJournal() to process journal files.

The user can verify that the initial copy has completed by checking that DataMove.Data.State > $$$CopyDone.
• classmethod CreateFromMapEdits(Name As %String, ByRef Properties As %String, ByRef Warnings As %String, ByRef Errors As %String) as %Status
Create a new DataMove object based on Mapping Edits done using the $$$CPFMappingEdit flag.

Parameters:
Name - A name for the DataMove object to create.
Properties - Array of properties used to create the object. The following properties may optionally be specified. See the class definition for more information on each property.
Properties("Description") - Description of the Data Move operation, default ="".
Properties("Flags") - Flags describing the operation, default = 0.
Properties("LogFile") - Directory and filename of the logfile, default = \iris\mgr\DataMovename.log.

Returns:
- Array of 'Warnings', which indicate Namespace conflicts that could result from a DataMove. These indicate that the data being moved is also mapped from another Namespace, which is not being updated
- Array of 'Errors', which indicate conflicts in DataMoves such that the DataMove cannot be done.

'Warnings' will allow you to continue, but if 'Errors' are returned, no DataMove is created.
• method Delete() as %Status
Delete a Data Move operation after is has finished.
If the Data Move operation you want to delete has been started and then stopped, you must first call the Rollback() method to rollback any of the data which had previously been moved.
• method DeleteSrcGlobals() as %Status
Delete the globals in the source databases which have been copied to the destination databases.
This method loops through all the globals which were copied into the destination databases, and deletes those ranges from the source database.
For each global we are deleting, we queue the work to one of the worker processes so we can delete multiple globals simultaneously.
Since it may take a while for the globals to be delete, this method may be run in the background by using the DispatchJob() method, and then using the GetWorkState() method to determine when complete.
• classmethod Dispatch(Name As %String, Method As %String, Args... As %String) as %Status
Run a Data Move method.
Open an existing Data Move Object using the unique name for the operation, then run the method on that object.

Parameters:
Name - Unique identifier for the Data Move operation.
Method - Name of method to run.
Args - List of arguments to the method.

Currently published methods are "Validate", "ValidateSizes", "DeleteSrcGlobals", "Finish", "Delete", and "Rollback".
• classmethod DispatchJob(Name As %String, Method As %String, Args... As %String) as %Status
Run a Data Move method as a background job.
This method takes the passed parameters, and passes them to the Dispatch() method in a jobbed job.

Parameters:
Name - Unique identifier for the Data Move operation.
Method - Name of method to run.
Args - List of arguments to the method.

Only currently published method is "Copy".
• classmethod Display(Name As %String)
Simple display of current DataMove status and Ranges
• classmethod Exists(Name As %String, ByRef Obj As %ObjectHandle, ByRef Status As %Status) as %Boolean
Data Move operation exists.
This method checks for the existence of a Data Move operation, and optionally instantiates the DataMove.Data object.

Parameters:
Name - Name of the Data Move operation to check existence of
Return values:
If Value of the method = 0 (Data Move operation does not exist, or some error occured)
Obj = Undefined
Status = Data Move operation does not exist, or other error message

If Value of the method = 1 (Data Move operation exists)
Obj = Object handle to DataMove.Data object
Status = $$$OK
• method Finish() as %Status
Finish the Data Move.
Close out log files, and move State to $$$Done so the DataMove can be subsequently deleted.
• method Rollback(Flags As %Integer = 0) as %Status
Delete the globals from any DataMove Ranges which have been copied to the destination databases.
Allow the user to 'rollback' or undo the DataMove. Note that any running Copy JOB must first be stopped (see StopCopy).
• classmethod StopCopy(Name As %String) as %Status
Stop the DataMove Copy background job. Allow the user to gracefully stop the Copy if they change their mind, so they can do a Rollback and start over (or Delete the DataMove).
• method Validate() as %Status
Validate the Data Move object and all of its Ranges.
Checks all source and destination databases, ensures that destination globals don't already exist.
• method ValidateSizes() as %Status
Validate the Data Move object and all of its Ranges for size restrictions.
Determines the current size of data to be copied, and makes sure there is space available.