Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : ABL API for Multi-tenant and Table Partition Management : Executing DataAdminService utilities : PartitionSplitUtility class : Split from a composite partition
 
Split from a composite partition
The table data of a partitioned table resides in the composite partition (the default partition) until the table data is moved to the respective partitions as per the table partition policy. You can mark partition details as split targets and then split them incrementally from the composite partition to dedicated partitions.
The following sample code shows how to split from a composite partition:
block-level on error undo, throw

using OpenEdge.DataAdmin.Lang.Collections.IIterator from propath.
using OpenEdge.DataAdmin.DataAdminService from propath.
using OpenEdge.DataAdmin.IPartitionPolicy from propath.
using OpenEdge.DataAdmin.IPartitionPolicyDetail from propath.
using OpenEdge.DataAdmin.Util.PartitionSplitUtility from propath.
using OpenEdge.DataAdmin.Error.DataAdminErrorHandler from propath.

define variable service as DataAdminService no-undo.
define variable policy as IPartitionPolicy no-undo.
define variable detail as IPartitionPolicyDetail no-undo.
define variable iter as IIterator no-undo.
define variable split as PartitionSplitUtility no-undo.
define variable errorhandler as DataAdminErrorHandler no-undo.

assign
service = new DataAdminService(ldbname(1))
/* get the policy */
policy = service:GetPartitionPolicy("OrderPolicy")

/* get an iterator of policy details that are still in composite*/
iter = policy:Details:Iterator().

do while iter:HasNext():
detail = cast(iter:Next(), IPartitionPolicyDetail).
detail:IsSplitTarget = true.
end.

/* commit the splittarget changes */
service:UpdatePartitionPolicy(policy).

/* Pass the policy and (optional) transaction size to the constructor to split
the details from the composite partition */
split = new PartitionSplitUtility(policy, 100).
service:ExecuteUtility(split).

catch e as Progress.Lang.Error:
errorHandler = new DataAdminErrorHandler().
errorHandler:Error(e).
end catch.

finally:
delete object service no-error.
end finally.
Partition details are marked as split targets. Using PartionSplitUtility, data from the composite partition is split to the marked partition details.
When splitting a composite partition, you can alternatively pass the table, ITable, to PartionSplitUtility.
The following sample code-snippet illustrates how to split a partition using the ITable interface:
using OpenEdge.DataAdmin.ITable from propath.
using OpenEdge.DataAdmin.DataAdminService from propath.
using OpenEdge.DataAdmin.IDataAdminService from propath.
using OpenEdge.DataAdmin.Util.PartitionSplitUtility from propath.

define variable myTable as ITable no-undo.
define variable service as IDataAdminService no-undo.
define variable split as PartitionSplitUtility no-undo.

assign
service = new DataAdminService(ldbname(1))
myTable = service:GetTable("myPolicy")

/* Pass the table to the constructor to split the composite partition, set transaction size to 100 */
split = new PartitionSplitUtility(myTable, 100).
service:ExecuteUtility(split).