INT32 _dpsLogWrapper::commit( BOOLEAN deeply, DPS_LSN *committedLsn ) { ossTimestamp t ; ossGetCurrentTime( t ) ; _lastSyncTime = t.time * 1000 + t.microtm / 1000 ; _writeReordNum = 0 ; return _buf.commit( deeply, committedLsn ) ; }
void _onTimer(UINT64 timerID, UINT32 interval, UINT64 occurTime) { ossTimestamp ts; ossGetCurrentTime(ts); if (ts.time - occurTime > 2) { PD_LOG( PDINFO, "[%s]Timer(ID:%u,interval:%u) lantcy %u " "seconds", name(), timerID, interval, (UINT32)(ts.time - occurTime) ); } onTimer ( timerID, interval ) ; }
// PD_TRACE_DECLARE_FUNCTION ( SDB__DPSLGWRAPP_CANSYNC, "_dpsLogWrapper::canSync" ) BOOLEAN _dpsLogWrapper::canSync( BOOLEAN &force ) const { BOOLEAN needSync = FALSE ; force = FALSE ; PD_TRACE_ENTRY( SDB__DPSLGWRAPP_CANSYNC ) ; if ( !_buf.hasDirty() ) { } else if ( _syncRecordNum > 0 && _writeReordNum >= _syncRecordNum ) { PD_LOG( PDDEBUG, "Write record number[%u] more than threshold[%u]", _writeReordNum, _syncRecordNum ) ; force = TRUE ; needSync = TRUE ; } else if ( pmdGetTickSpanTime( _lastWriteTick ) < DPS_NO_WRITE_TIME ) { } else if ( _syncInterval > 0 ) { ossTimestamp tm ; ossGetCurrentTime( tm ) ; UINT64 curTime = tm.time * 1000 + tm.microtm / 1000 ; if ( curTime - _lastSyncTime >= _syncInterval ) { PD_LOG( PDDEBUG, "Time interval threshold tiggered, " "CurTime:%llu, LastSyncTime:%llu, SyncInterval:%u", curTime, _lastSyncTime, _syncInterval ) ; needSync = TRUE ; } } PD_TRACE1 ( SDB__DPSLGWRAPP_CANSYNC, PD_PACK_INT( needSync ) ) ; PD_TRACE_EXIT( SDB__DPSLGWRAPP_CANSYNC ) ; return needSync ; }