nsmcp::AccessRecordStoreSQLite method maintenancePressure (public)
<instance of nsmcp::AccessRecordStoreSQLite> maintenancePressure
Defined in /usr/local/ns/tcl/nsmcp/log-traffic-record-store.tcl
Inspect expiry backlog and reusable capacity without counting records. Indexed existence probes bound the work independently of store size. Free pages remain reusable even when the database file is at its ceiling.
- Returns:
- Expiry and capacity-pressure flags used to defer backfill.
- Testcases:
- No testcase defined.
Source code: set cutoff [:retentionFloor] set peerCutoff [expr {[clock seconds]-[dict get ${:settings} peerRetention]}] if {${:partitionInterval}>0} { set expired [${:db} scalar {SELECT EXISTS(SELECT 1 FROM main.partitions WHERE stop<=:cutoff) OR EXISTS(SELECT 1 FROM main.peer_addresses WHERE seen<:peerCutoff LIMIT 1)}] } else { set expired [${:db} scalar { SELECT EXISTS(SELECT 1 FROM main.rows INDEXED BY by_time_status WHERE t<:cutoff AND kind=0 LIMIT 1) OR EXISTS(SELECT 1 FROM main.peer_addresses INDEXED BY peer_expiry WHERE seen<:peerCutoff LIMIT 1) }] } set capacity [:capacity] set pageSize [${:db} scalar {PRAGMA main.page_size}] set freePages [${:db} scalar {PRAGMA main.freelist_count}] set used [expr {[dict get $capacity mainAllocatedBytes]-$freePages*$pageSize}] set pressure [expr {$used>=0.9*[dict get $capacity mainMaxBytes] || [dict get $capacity diskBytes]>=0.9*[dict get $capacity maxBytes]}] return [dict create expired $expired capacityPressure $pressure]XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)