Logo Search packages:      
Sourcecode: maxdb-7.5.00 version File versions

HRESULT STDMETHODCALLTYPE LVCSim_liveCacheSink::NewConsistentView ( unsigned char *  lpConsistentView,
short *  lpb_error 
) [virtual]

New consistent view.

Creates a new consistent view. If the current transaction already holds a consistent view when this method is called, this view is released and a new consistent view is returned.

Parameters:
lpConsistentView [in,out] kb identification of the consistent view,
lpb_error [out] error code of the operation, e_ok if no error occured.
Returns:
HRESULT of the operation. Has no meaning (S_OK) in inproc case.

Reimplemented from IliveCacheSink.

Definition at line 2308 of file LVCSim_liveCacheSink.cpp.

References consViewList, EndConsistentView(), m_activeVersion, m_commitTime, m_commitTimeRef, m_otherTXs, m_readView, LVCSim_TXList::Release(), txCounterLock, and txOldest.

Referenced by getReadConsistentView().

{
      // TODO: this is probably not quite OK, we can theoretically
      // close more than one view here - check m_versions

      //CHECK_TID(lpConsistentView)
      LVCSim_TID *tid = (LVCSim_TID*) lpConsistentView;
    LVCSIM_ASSERT((*tid == m_readView))
      if (*tid != LVCSim_TID_NONE) {
            // end old consistent view
            EndConsistentView(lpConsistentView, lpb_error);
            if (*lpb_error != e_ok) return S_OK;
      }
      if (m_readView != LVCSim_TID_NONE) {
            // end old consistent view
            *tid = m_readView;
            EndConsistentView(lpConsistentView, lpb_error);
            if (*lpb_error != e_ok) return S_OK;
      }

      // generate new consistent view ID
    if (m_otherTXs) {
        m_otherTXs->Release(true);
        m_otherTXs = NULL;
    }

    {
        ConsViewList *pview = new ConsViewList;
        m_otherTXs = new LVCSim_TXList;

        RTESync_LockedScope lck(txCounterLock);
        new(m_otherTXs) LVCSim_TXList(m_readView);
        *tid = m_readView;

          // set 2 high bytes to 0
          *((tsp00_Int2*) (tid + 1)) = 0;

          // enter consistent view into TID list
            consViewList = new(pview) ConsViewList(m_readView, consViewList);
        if (m_commitTime <= 0) {
            m_commitTime = m_readView;
            m_commitTimeRef = pview;
            pview->AddRef();
        }
        if (txOldest == LVCSim_TID_MAX) {
            txOldest = m_readView;
        }
    }

    if (m_activeVersion) {
        SIM_TRACE(SIM_VER | SIM_TX, "new view version %08x", m_activeVersion)
        m_activeVersion->openView(m_otherTXs, m_readView);
    }


      SIM_TRACE(SIM_TX, "new read view: %d", m_readView)
#ifdef SIM_DO_TRACE
    RTESync_LockedScope rlock(txCounterLock);
    const ConsViewList *v = consViewList;
    while (v) {
        SIM_TRACE(SIM_TX, " - %d", v->m_tid);
        v = v->m_next;
    }
    SIM_TRACE(SIM_TX, "oldest read view: %d", txOldest);
#endif

      *lpb_error = e_ok;
      return S_OK;
}


Generated by  Doxygen 1.6.0   Back to index