Partitions

ctdbGetFirstPartition

Retrieves the first partition number of the table.

Declaration

LONG ctdbGetFirstPartition(CTHANDLE Handle)

Description

  • ctdbGetFirstPartition() returns the first raw partition number for the file if partitions exist. If -1 is returned, call ctdbGetError() to retrieve the ISAM error code. If this value is zero, the file has no active partitions. If uerr_cod is non-zero, an error occurred. For example, if the specified file number does not correspond to a partition host file, ctdbGetFirstPartition() returns -1 and ctdbGetError() returns PHST_ERR. ctdbGetError() will return CTDBRET_NOTACTIVE, or CTDBRET_NOTTABLE, if an invalid table handle is passed in.

Returns

ctdbGetFirstPartition() returns the first raw partition number or -1 if not found.

See also

ctdbGetLastPartition()

 

ctdbGetLastPartition

Retrieves the last partition number of the table.

Declaration

LONG ctdbGetLastPartition(CTHANDLE Handle)

Description

  • ctdbGetLastPartition() returns the last raw partition number for the file if partitions exist. If -1 is returned, call ctdbGetError() to retrieve the ISAM error code. If this value is zero, the file has no active partitions. If uerr_cod is non-zero, an error occurred. For example, if the specified file number does not correspond to a partition host file, ctdbGetLastPartition() returns -1 and ctdbGetError() returns PHST_ERR. ctdbGetError() will return CTDBRET_NOTACTIVE, or CTDBRET_NOTTABLE, if an invalid table handle is passed in.

Returns

ctdbGetLastPartition() returns the last raw partition number or -1 if not found.

See also

ctdbGetFirstPartition()

 

ctdbPartAdminByKey

Performs an administrative partition operation on the partition specified by key value.

Declaration

CTDBRET ctdbPartAdminByKey(CTHANDLE handle,pVOID keyval,CTPART_MODE_E partmode,pCOUNT partstatus)

Description

ctdbPartAdminByKey() manages the partitions for a table.

  • Handle [in] - a table handle.
  • keyval [in] - pointer to a partition key value that has been transformed
  • partmode [in] - partition operation mode. partmode is one of:

 

CTPART_PURGE

delete a partition

 

CTPART_ADD

add a partition

 

CTPART_ARCHIVE

archive a partition

 

CTPART_BASE

modify the lower limit partition number value

 

CTPART_ACTIVATE

activate an archived partition

 

CTPART_STATUS

return the partition status in partstatus

  • partstatus [out] - status code of partition when partmode specifies CTPART_STATUS. partstatus returns one of the following values:

 

pmSTATUSnone

0

partition member does not exist

 

pmSTATUSexst

1

partition member is active

 

pmSTATUSopnd

2

partition member is active and currently open

 

pmSTATUSarhv

3

partition member is archived

 

pmSTATUSpurg

4

partition member was purged

 

pmSTATUSparc

19

partition member is pending archive

 

pmSTATUSppnd

20

partition member is pending purge

Returns

ctdbPartAdminByKey() returns CTDBRET_OK on success. BMOD_ERR (446) is returned with a bad partmode value. A FairCom DB API C API error on failure.

See also

ctdbPartAdminByName(), ctdbPartAdminByNumber()

 

ctdbPartAdminByName

Performs an administrative partition operation on the partition specified by partition name.

Declaration

CTDBRET ctdbPartAdminByName(CTHANDLE handle, pTEXT partname, CTPART_MODE_E partmode, pCOUNT partstatus)

Description

ctdbPartAdminByName() manages the partitions for a table.

  • Handle [in] - a table handle.
  • partname [in] - partition name.
  • partmode [in] - partition operation mode. partmode is one of:

 

ptADMINpurge

delete a partition

 

ptADMINadd

add a partition

 

ptADMINarchive

archive a partition

 

ptADMINbase

modify the lower limit partition number value

 

ptADMINactivate

activate an archived partition

 

ptADMINstatus

return the partition status in partstatus

  • partstatus [out] - status code of partition when partmode specifies ptADMINstatus. partstatus returns one of the following values:

 

pmSTATUSnone

0

partition member does not exist

 

pmSTATUSexst

1

partition member is active

 

pmSTATUSopnd

2

partition member is active and currently open

 

pmSTATUSarhv

3

partition member is archived

 

pmSTATUSpurg

4

partition member was purged

 

pmSTATUSparc

19

partition member is pending archive

 

pmSTATUSppnd

20

partition member is pending purge

Returns

ctdbPartAdminByName() returns CTDBRET_OK on success. BMOD_ERR (446) is returned with a bad partmode value. A FairCom DB API C API error on failure.

See also

ctdbPartAdminByKey(), ctdbPartAdminByNumber()

 

ctdbPartAdminByNumber

Performs an administrative partition operation on the partition specified by partition number.

Declaration

CTDBRET ctdbPartAdminByNumber(CTHANDLE handle,LONG partno,CTPART_MODE_E partmode,pCOUNT partstatus)

Description

ctdbPartAdminByNumber() manages the partitions for a table.

  • Handle [in] - a table handle.
  • partno [in] - partition number
  • partmode [in] - partition operation mode. partmode is one of:

 

ptADMINpurge

delete a partition

 

ptADMINadd

add a partition

 

ptADMINarchive

archive a partition

 

ptADMINbase

modify the lower limit partition number value

 

ptADMINactivate

activate an archived partition

 

ptADMINstatus

return the partition status in partstatus

  • partstatus [out] - status code of partition when partmode specifies ptADMINstatus. partstatus returns one of the following values:

 

pmSTATUSnone

0

partition member does not exist

 

pmSTATUSexst

1

partition member is active

 

pmSTATUSopnd

2

partition member is active and currently open

 

pmSTATUSarhv

3

partition member is archived

 

pmSTATUSpurg

4

partition member was purged

 

pmSTATUSparc

19

partition member is pending archive

 

pmSTATUSppnd

20

partition member is pending purge

Returns

ctdbPartAdminByNumber() returns CTDBRET_OK on success. BMOD_ERR (446) is returned with a bad partmode value. A FairCom DB API C API error on failure.

See also

ctdbPartAdminByName(), ctdbPartAdminByKey()

 

 

ctdbSetTablePartitionIndexNbr

Set the Partition index number.

Declaration

CTDBRET ctdbDECL ctdbSetTablePartitionIndexNbr(CTHANDLE Handle, NINT idxno)

Description

Set the Partition index number.

Parameters:

  • Handle [IN] - Table handle
  • idxno [IN] - The index number for partition key*

Return Values

Value

Symbolic Constant

Explanation

0

CTDBRET_OK

Successful operation.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

 

ctdbSetTablePartitionNumberBits

Set the number of bits used to store the raw partition number.

Declaration

CTDBRET ctdbDECL ctdbSetTablePartitionNumberBits(CTHANDLE Handle, UCOUNT bitno)

Description

Sets the number of bits used to store the raw partition number.

By default, 16 bits of the 64-bit record offset are used to reference the raw partition number, allowing each partitioned file to support up to 65535 member files over its lifetime. This function allows adjusting this when it is called before creating the file.

A value of 0 defaults to 16 bits, values less than 4 bits default to 4 bits (maximum 15 member files), and 32 bits is the maximum value.

Parameters

  • Handle [IN] - Table handle
  • bitno [IN] - Number of bits to be used for raw partition number

Return Values

Value

Symbolic Constant

Explanation

0

CTDBRET_OK

Successful operation.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

 

ctdbSetTablePartitionRule

Set partition rule using an expression.

Declaration

CTDBRET ctdbDECL ctdbSetTablePartitionRule(CTHANDLE Handle, pTEXT expr)

Description

Sets a partition rule using an expression.

Parameters:

  • Handle [IN] - Table handle
  • expr [IN] - expression that evaluates into an integer that will be used as partition number

Return Values

Value

Symbolic Constant

Explanation

0

CTDBRET_OK

Successful operation.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.