nsmcp::AccessRecordStoreSQLite method rollupBackfill (public)

 <instance of nsmcp::AccessRecordStoreSQLite[i]> rollupBackfill \
    [ batches ]

Defined in /usr/local/ns/tcl/nsmcp/log-traffic-record-store.tcl

Parameters:
batches (optional, defaults to "1")

Testcases:
No testcase defined.
Source code:
lassign [:stateGet rollupCursor {0 -1}] fid off
for {set i 0} {$i<$batches} {incr i} {
    set rows [${:db} execute {SELECT fid,off FROM nsmcp_records.rows WHERE (fid,off)>($fid,$off) AND rolled=0 ORDER BY fid,off LIMIT 512}]
    if {$rows eq {}} {:statePut rollupsReady 1; return true}
    ${:db} transaction {
        ${:db} execute {DELETE FROM temp.nsmcp_ingest_batch;
            INSERT INTO temp.nsmcp_ingest_batch SELECT * FROM nsmcp_records.rows WHERE (fid,off)>($fid,$off) AND rolled=0 ORDER BY fid,off LIMIT 512}
        :rollBatch
        :observeBatch
        ${:db} execute {UPDATE nsmcp_records.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 false
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: