Try OpenEdge Now
skip to main content
Programming Interfaces
Database Administration Entity Interface Reference : ITenantGroup interface : ITenantGroup examples : Managing partitions for a tenant group
 
Managing partitions for a tenant group
Tenant group partitioning is managed by various default settings on the tenant group. The partitions for a tenant group can be accessed through the Partitions property collection on the ITenantGroup interface.
Setting DefaultAllocation to "Immediate" causes the partitioning to take place in the same transaction as the tenant group creation using the default areas defined for the tenant group. Setting the property to "Delayed" or "None" postpones the allocation and allows the area to be edited before the allocation.
The "Delayed" setting allows the partitions to be allocated in one operation by invoking the Allocate( ) method on ITenantGroup, which sets the AllocationState property for every tenant group partition (IPartition) to "Allocated". However, the IsAllocated property on ITenantGroup returns FALSE when any individual partition has an AllocationState setting of "Delayed". The "None" setting is considered a permanent setting, and partitions that have an AllocationState setting of "None" do not affect a tenant group's IsAllocated property setting. Also, allocating individual partitions do not affect the tenant group's IsAllocated property setting. So, while changing the AllocationState setting of a partition from "None" to "Delayed" sets the tenant group's IsAllocated property to FALSE, changing the AllocationState setting of an individual partition to "Allocated" does not set the tenant group's IsAllocated property to TRUE.
Note: The IsAllocated property on ITenantGroup does not necessarily reflect the state of all the tenant group partitions. While it is always FALSE if one of the tenant group partitions has an AllocationState setting of "Delayed", IsAllocated can be set to TRUE only by invoking the Allocate( ) method on ITenantGroup. It cannot be set to TRUE by invoking the Allocate( ) method on the Partitions property (an IPartitionMap) of ITenantGroup or on any individual partition (IPartition). In other words, for IsAllocated to be TRUE for a tenant group, the Allocate( ) method must be invoked on the tenant group itself, not on any one or more of the partitions (in a collection) owned by the tenant group.
The following example creates a tenant group with DefaultAllocation set to "None" to postpone the allocation and changes the area on one index partition before allocating all partitions:
define variable tenantgroup as ITenantGroup no-undo.
define variable partition as IPartition no-undo.

assign
  tenantgroup = service:NewTenantGroup ("ABCEmployee")
  tenantgroup:Table      = service:GetTable("Employee")
  tenantgroup:DefaultDataArea = service:GetArea("FirstClassDataArea")
  tenantgroup:DefaultIndexArea = service:GetArea("FirstClassIndexArea")
  tenantgroup:DefaultLobArea = service:GetArea("GeneralLobArea").
  tenantgroup:DefaultAllocation = "None".

service:CreateTenantGroup(tenantgroup).

assign
  partition = tenantgroup:Partitions:Get(
             tenantgroup:Table:Indexes("EmployeeIdx"))
  partition:Area = service:GetArea("EmpIndexArea").

tenantgroup:Allocate().
Service:UpdateTenantGroup(tenantgroup).
See also:
*IArea interface
*IDataAdminElement interface
*ITable interface
*ITenant interface
*ITenantGroupSet interface
*ITenantSet interface
*IPartition interface
*IPartitionMap interface