Forum OpenACS Development: Search error?

Collapse
Posted by Gilbert Wong on
Does anyone know what this error means? It looks like it's caused by the search_indexer. Thanks.
[29/Jan/2002:03:08:56][70078.2051][-sched-] Error: blob_get only 
allowed in tran
saction
blob_get only allowed in transaction
    while executing
"ns_pg blob_get $db $content"
    ("lob" arm line 3)
    invoked from within    
"switch $storage_type {
                        file {
                            if {[file exists $content]} {
                                set if..."
    ("blob_get" arm line 4)
    invoked from within
"switch $type {
    
            blob_get {

                if {[info exists storage_type]} {
                    switch $storage_type {
                 ..."
    invoked from within
"db_exec_lob blob_get $db $full_statement_name $sql"
    invoked from within
"set data [db_exec_lob blob_get $db $full_statement_name $sql]"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $code_block "
    invoked from within
"db_with_handle db {
        set data [db_exec_lob blob_get $db $full_statement_name $sql]
    }"
    (procedure "db_blob_get" line 6)
    invoked from within
"db_blob_get data "select $content as content, 'lob' as storage_type""
    ("lob" arm line 2)
    invoked from within
"switch $storage_type {
        text {
            set data $content
        }
        file {
            set data [db_blob_get data "select '$content' as 
content, 'file' as
storage_type..."
    (procedure "search_content_get" line 6)
    invoked from within
"search_content_get txt $datasource(content) $datasource(mime) 
$datasource(stora
ge_type)"
    ("INSERT" arm line 5)
    invoked from within
"switch $event {
            INSERT {
                set object_type [db_exec_plsql 
get_object_type "select acs_objec
t_util__get_object_type($object_id)"]
                if [acs_sc_bin..."
    ("uplevel" body line 3)
    invoked from within
"uplevel 1 $code_block "
    ("1" arm line 1)
    invoked from within
"switch $errno {
                0 {
                    # TCL_OK
                }
                1 {
                    # TCL_ERROR
                    global errorInfo errorCode
                    error $error $errorInfo $errorCode
                }
                2 {
        ..."
    ("while" body line 20)
    invoked from within
"while { [db_getrow $db $selection] } {
            incr counter
            if { [info exists array_val] } {
                unset array_val
            }
            if { ![info exists column..."
    ("uplevel" body line 5)
    invoked from within
"db_with_handle db {
        set selection [db_exec select $db $full_statement_name $sql]

        set counter 0
        while { [db_getrow $db $selection] } {
            incr co..."
    (procedure "db_foreach" line 35)
    invoked from within
"db_foreach search_observer_queue_entry {
        select object_id, date, event
        from search_observer_queue
        order by date asc
    } {

        switch $event {
            ..."
    (procedure "search_indexer" line 5)
    invoked from within
"search_indexer"
    ("eval" body line 1)
    invoked from within
"eval [concat [list $proc] $args]"
    (procedure "ad_run_scheduled_proc" line 43)
    invoked from within
"ad_run_scheduled_proc {f f 30 search_indexer {} 1012289996 0 t}"
Collapse
2: Response to Search error? (response to 1)
Posted by Don Baccus on
"search_content_get" seems to be the culprit if I read your dump right.

blob_get needs to be wrapped in a begin/end pair or called within db_transaction.  That's because it is pulling a bunch of segments from its blob table.  If it's not executed in a transaction another thread could delete the blob and remove the segments when the blob_get's halfway through, screwing things up.

I could've made the driver smart enough to wrap it in a transaction if it weren't being called from within one, but didn't bother.  It's simple enough to do so at the caller's end.

I'd welcome a patch, I'm sure!