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

DataMove.Data

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

SQL Table Name: DataMove.Data

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.

Parameters

parameter DEFAULTCONCURRENCY = 0;
Inherited description: 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 methods: FlagsDisplayToLogical(), FlagsGet(), FlagsGetStored(), FlagsIsValid(), FlagsLogicalToDisplay(), FlagsNormalize(), FlagsSet(), FlagsXSDToLogical()
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 methods: JRNAppliedDisplayToLogical(), JRNAppliedGet(), JRNAppliedGetStored(), JRNAppliedIsValid(), JRNAppliedLogicalToDisplay(), JRNAppliedNormalize(), JRNAppliedSet(), JRNAppliedXSDToLogical()
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
Property methods: StateApplyJournalsDisplayToLogical(), StateApplyJournalsGet(), StateApplyJournalsGetStored(), StateApplyJournalsIsValid(), StateApplyJournalsLogicalToDisplay(), StateApplyJournalsNormalize(), StateApplyJournalsSet(), StateApplyJournalsXSDToLogical(), StateCalculateMBToCopyDisplayToLogical(), StateCalculateMBToCopyGet(), StateCalculateMBToCopyGetStored(), StateCalculateMBToCopyIsValid(), StateCalculateMBToCopyLogicalToDisplay(), StateCalculateMBToCopyNormalize(), StateCalculateMBToCopySet(), StateCalculateMBToCopyXSDToLogical(), StateDeleteDstGlobalsDisplayToLogical(), StateDeleteDstGlobalsGet(), StateDeleteDstGlobalsGetStored(), StateDeleteDstGlobalsIsValid(), StateDeleteDstGlobalsLogicalToDisplay(), StateDeleteDstGlobalsNormalize(), StateDeleteDstGlobalsSet(), StateDeleteDstGlobalsXSDToLogical(), StateDeleteSrcGlobalsDisplayToLogical(), StateDeleteSrcGlobalsGet(), StateDeleteSrcGlobalsGetStored(), StateDeleteSrcGlobalsIsValid(), StateDeleteSrcGlobalsLogicalToDisplay(), StateDeleteSrcGlobalsNormalize(), StateDeleteSrcGlobalsSet(), StateDeleteSrcGlobalsXSDToLogical(), StateDisplayToLogical(), StateGet(), StateGetStored(), StateIsValid(), StateLogicalToDisplay(), StateLogicalToDisplay1(), StateMoveGlobalsDisplayToLogical(), StateMoveGlobalsGet(), StateMoveGlobalsGetStored(), StateMoveGlobalsIsValid(), StateMoveGlobalsLogicalToDisplay(), StateMoveGlobalsNormalize(), StateMoveGlobalsSet(), StateMoveGlobalsXSDToLogical(), StateNormalize(), StateRollbackDisplayToLogical(), StateRollbackGet(), StateRollbackGetStored(), StateRollbackIsValid(), StateRollbackLogicalToDisplay(), StateRollbackNormalize(), StateRollbackSet(), StateRollbackXSDToLogical(), StateRunDisplayToLogical(), StateRunGet(), StateRunGetStored(), StateRunIsValid(), StateRunLogicalToDisplay(), StateRunNormalize(), StateRunSet(), StateRunXSDToLogical(), StateSet(), StateValidateSizesDisplayToLogical(), StateValidateSizesGet(), StateValidateSizesGetStored(), StateValidateSizesIsValid(), StateValidateSizesLogicalToDisplay(), StateValidateSizesNormalize(), StateValidateSizesSet(), StateValidateSizesXSDToLogical(), StateXSDToLogical()

Methods

classmethod Activate(Name As %String, Display As %Boolean = 1, Timeout As %Integer = 120) as %Status [ Language = objectscript ]
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 [ Language = objectscript ]
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 [ Language = objectscript ]
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 [ Language = objectscript ]
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 [ Language = objectscript ]
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 [ Language = objectscript ]
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 [ Language = objectscript ]
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) [ Language = objectscript ]
Simple display of current DataMove status and Ranges
classmethod Exists(Name As %String, ByRef Obj As %ObjectHandle, ByRef Status As %Status) as %Boolean [ Language = objectscript ]
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 [ Language = objectscript ]
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 [ Language = objectscript ]
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 [ Language = objectscript ]
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 [ Language = objectscript ]
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 [ Language = objectscript ]
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.

Inherited Methods

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

Storage

Storage Model: Storage (DataMove.Data)

^IRIS.DataMoveD(ID)
=
UpdateTime
EndTime
Flags
LogFile
MBCopied
MBToCopy
Name
PctCopied
Pid
StartTime
State
Status
Stop
TransOpen
Username
%%CLASSNAME
Started
StateCalculateMBToCopy
StateDeleteDstGlobals
StateDeleteSrcGlobals
StateMoveGlobals
EM
Suspend
StateApplyJournals
JRNMBToApply
JRNCUR
StateRun
StateRollback
JRNFirst
StateValidateSizes
Description
JRNApplied