nsmcp::AccessRecordStoreSQLite method rollupBackfill (public)
<instance of nsmcp::AccessRecordStoreSQLite> rollupBackfill \ [ batches ]
Defined in /usr/local/ns/tcl/nsmcp/log-traffic-record-store.tcl
Build missing minute rollups for previously stored requests. Process bounded batches in source order. Commit rollups, observations, rolled flags and the migration cursor atomically for each batch.
- Parameters:
- batches (optional, defaults to
"1")- Maximum number of migration batches to process in this invocation.
- Returns:
- True when no unrolled rows remain; false when the batch budget was exhausted.
- Testcases:
- No testcase defined.
Source code: if {${:partitionInterval}>0} { :statePut rollupsReady 1 return true } lassign [:stateGet rollupCursor {0 -1}] fid off for {set i 0} {$i<$batches} {incr i} { set rows [${:db} execute { SELECT fid, off FROM main.rows WHERE (fid, off)>(:fid, :off) AND rolled=0 ORDER BY fid, off LIMIT 512 }] if {$rows eq {}} { :statePut rollupsReady 1 return true } ${:db} execute { CREATE TEMP TABLE IF NOT EXISTS nsmcp_ingest_batch AS SELECT * FROM main.rows WHERE 0 } ${:db} transaction { ${:db} execute { DELETE FROM temp.nsmcp_ingest_batch; INSERT INTO temp.nsmcp_ingest_batch SELECT * FROM main.rows WHERE (fid, off)>(:fid, :off) AND rolled=0 ORDER BY fid, off LIMIT 512 } :rollBatch :observeBatch ${:db} execute { UPDATE main.rows SET rolled=1 WHERE (fid, off) IN(SELECT fid, off FROM temp.nsmcp_ingest_batch) } set last [lindex $rows end] set fid [dict get $last fid] set off [dict get $last off] :statePut rollupCursor [list $fid $off] } } return falseXQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)