Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbGetKeepLock

Retrieves the current extended keep lock mode.

DECLARATION

CTKEEP_MODE ctdbDECL ctdbGetKeepLock(CTHANDLE Handle);

DESCRIPTION

ctdbGetKeepLock() retrieves the current state of how the transaction commit and abort will handle locks acquired before and during the transaction.

  • Handle is a session handle.

RETURN

One of the following keep lock modes is returned:

Value

Symbolic Constant

Explanation

0

CTKEEP_FREE

Release all locks. Clear LKISAM state, turning off session-wide record locking. This is the default mode.

1

CTKEEP_LOCK

Keep all locks acquired before and during transaction, leaving session-wide record locking as it was. The LKISAM state is not cleared.

2

CTKEEP_OUT

Release only locks obtained within transaction and/or locks on records updated within transaction. The LKISAM state is not cleared, leaving session-wide record locking as it was.

3

CTKEEP_OUTALL

Unconditionally keep all locks acquired before transaction began. Free locks obtained within the transaction. The LKISAM state is not cleared, leaving session-wide record locking as it was.

See Appendix A for a complete listing of valid c-tree Plus error values.

EXAMPLE

/* make sure the current keep lock mode is CTKEEP_LOCK */

if (ctdbGetKeepLock(hSession) != CTKEEP_LOCK)

if (ctdbSetKeepLock(hSession, CTKEEP_LOCK) != CTDBRET_OK)

printf("ctdbSetKeepLock failed\n");

SEE ALSO

ctdbAbort ctdbBegin(), ctdbCommit(), ctdbSetKeepLock()

TOCIndex