nsmcp::AccessCardinalityStore object method failureDiagnostic (public)

 nsmcp::AccessCardinalityStore[i] failureDiagnostic phase message options \
    [ handle ]

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

Classify a storage failure and log a correlation ID.

Parameters:
phase (required)
The aggregation phase.
message (required)
The caught error message, used only for classification.
options (required)
The Tcl return options from the failure.
handle (optional)
Optional database handle for native exception details.
Returns:
Bounded diagnostic fields without SQL or raw exception text.

Testcases:
No testcase defined.
Source code:
set native {}
set code [lrange [dict get $options -errorcode] 0 1]
if {$handle ne {} && $phase in {detach-spool attach-spool configure-spool disk-budget create-schema verify-owner write-batch read-results record-store}
    && ![catch {
    ns_db exception $handle
} exception]} {
    if {[lindex $exception 0] ne {}} {
        set code [lindex $exception 0]
    }
    set native [lindex $exception 1]
}
if {![regexp {^[A-Za-z0-9_ -]{1,64}$} $code]} {
    set code UNSPECIFIED
}
set text [string tolower "$message $native"]
set kind operation-failed
foreach {pattern label} {
    {*record-store-pool-wait-limit*} pool-timeout
    {*record-store-disk-limit*} disk-limit
    {*record-store-generation-changed*} source-changed
    {*record-store-range-limit*} range-limit
    {*aggregation-pool-wait-limit*} pool-timeout
    {*aggregation-spool-missing*} spool-missing
    {*aggregation-owner-mismatch*} owner-mismatch
    {*aggregation-wrong-driver*} wrong-driver
    {*aggregation-disk-limit*} disk-limit
    {*database*locked*} database-locked
    {*database*busy*} database-busy
    {*database or disk is full*} disk-full
    {*unable to open database*} database-open-failed
    {*not a database*} invalid-database
    {*database*malformed*} corrupt-database
    {*readonly*} read-only
    {*permission denied*} permission-denied
    {*no such table*} missing-schema
    {*already in use*} attachment-conflict
    {*no access to pool*} pool-access-denied
    {*could not allocate*handle*} pool-allocation-failed
    {*no such file*} file-missing
} {
    if {[string match $pattern $text]} {
        set kind $label
        break
    }
}
set id [ns_crypto::randombytes -encoding hex 12]
ns_log error "nsmcp: access aggregation failed: phase=$phase class=$kind code=$code diagnostic=$id"
return [dict create phase $phase class $kind code $code diagnosticId $id]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: