Пример #1
0
/* PROGRAM: cxProcessDeleteChain - process all  the 
 *          delete lock chain blocks ie, till as many
 *          blocks as are on the chain are processed
 *
 * RETURNS: DSMVOID
 * 
 */
DSMVOID
cxProcessDeleteChain(
        dsmContext_t    *pcontext, 
        dsmObject_t      tableNum,
        dsmArea_t        area)
{
    int           chainLength;
    bkAreaDesc_t *pbkAreaDesc;

    pbkAreaDesc = BK_GET_AREA_DESC(pcontext->pdbcontext, area);

    chainLength = pbkAreaDesc->bkNumBlocksOnChain[LOCKCHN];

    while( chainLength-- )
    {
        rlTXElock(pcontext,RL_TXE_UPDATE,RL_MISC_OP);
        cxRemoveFromDeleteChain(pcontext, tableNum,  area);
        rlTXEunlock(pcontext);
    }

}  /* end cxProcessDeleteChain */
Пример #2
0
/* PROGRAM: dsmDatabaseProcessEvents - perform xxx processing
 *
 * NOTE: Quiet points and tmdelayed commit are supported here
 * 
 * RETURNS: DSM_S_SUCCESS
 *          DSM_S_INVALID_USER
 *          DSM_S_SHUT_DOWN on EXBAD or EXGOOD
 */
dsmStatus_t
dsmDatabaseProcessEvents(
        dsmContext_t *pcontext)
{
    dbcontext_t *pdbcontext = pcontext->pdbcontext;
    dbshm_t     *pdbshm     = pdbcontext->pdbpub;
    usrctl_t    *pusr       = pcontext->pusrctl;
    mstrblk_t   *pmstr;
    dsmStatus_t  returnCode;

#if OPSYS==WIN32API
    if (fWin95)
        return -1;
#endif

    pdbcontext->inservice++;  /* "post-pone" signal handling while in DSM API */
 
    SETJMP_ERROREXIT(pcontext, returnCode) /* Ensure error exit address set */

    if ((returnCode = dsmThreadSafeEntry(pcontext)) != DSM_S_SUCCESS)
    {
        returnCode = dsmEntryProcessError(pcontext, returnCode,
                      (TEXT *)"dsmDatabaseProcessEvents");
        goto done;
    }

    /* Check for quiet point command requests */
    if (pdbshm->quietpoint == QUIET_POINT_REQUEST)
    {
        /* Shut off update activity for the quiet point */
        rlTXElock(pcontext,RL_TXE_EXCL,RL_MISC_OP);
        MT_LOCK_MTX();
        pmstr = pdbcontext->pmstrblk;

        /* Switch after imaging extent if there are ai extents */
        if( rlaiqon(pcontext) && pmstr->mb_aibusy_extent > 0 )
        {
            MT_LOCK_AIB();
            if (rlaiswitch(pcontext, (int)RLAI_NEW, 1) )
            {
                MT_UNLK_AIB();
                /* Unable to switch to new ai extent */
                MSGN_CALLBACK(pcontext, drMSG205);
                if ( MTHOLDING(MTL_MTX) )
                     MT_UNLK_MTX();

                if ( pusr->uc_txelk )
                    rlTXEunlock(pcontext);
                goto done;
            }
            MT_UNLK_AIB();
        }

        /* Flush the buffer pool and bi buffers */
        rlbiflsh(pcontext,RL_FLUSH_ALL_BI_BUFFERS);
 
        /* At this point, the quiet point is in place */
        MSGN_CALLBACK(pcontext, drMSG402);
        pdbshm->quietpoint = QUIET_POINT_ENABLED;
        while(pdbshm->quietpoint == QUIET_POINT_ENABLED &&
              !pdbshm->shutdn)
        {
            utsleep(1);
        }
        MT_UNLK_MTX();
        rlTXEunlock(pcontext);        /* Release transaction end lock */

        /* At this point, normal operations can return */
        MSGN_CALLBACK(pcontext, drMSG403);
        pdbshm->quietpoint = QUIET_POINT_NORMAL;       
    }
 
    /* Process delayed commit (-Mf) */
    tmchkdelay(pcontext, 0);
    /* Check if table locking can be shut off    */
    lkTableLockCheck(pcontext);

    returnCode = DSM_S_SUCCESS;

done:
    dsmThreadSafeExit(pcontext);
    pdbcontext->inservice--;  /* re-allow signal handling */

    return returnCode;

}  /* end dsmDatabaseProcessEvents */