Forum OpenACS Q&A: cr_delete_scheduled_files causing errors

Request notifications

I get the following error message about once a day from cr_delete_scheduled_files proc (I guess). I would appreciate any ideas about what could be wrong here.
Errors since Wed Feb 12 17:48:53 2003

12/Feb/2003:18:47:55
    Error: Transaction aborted: no such key: /51/72/5173
no such key: /51/72/5173
    while executing
"nsv_get CR_LOCATIONS $location"
    (procedure "cr_fs_path" line 2)
    invoked from within
"cr_fs_path $storage_area_key"
    invoked from within
"set file "[cr_fs_path $storage_area_key]/${path}""
    ("uplevel" body line 4)
    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
"uplevel 1 $code_block "
    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 fetch_paths { *SQL* } {

             # try to remove file from filesystem
             set file "[cr_fs_path $storage_area_key]/${path}"
 ..."
    ("uplevel" body line 3)
    invoked from within
"uplevel 1 $transaction_code "
    (procedure "db_transaction" line 1)
    invoked from within
"db_transaction {
	# subselect makes sure there isn't a parent revision still lying around
         db_foreach fetch_paths { *SQL* } {

             # ..."
    (procedure "cr_delete_scheduled_files" line 2)
    invoked from within
"cr_delete_scheduled_files"
    ("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 {t f 86400 cr_delete_scheduled_files {} 1043858860 0 t}"
    Notice: Running scheduled proc search_indexer...
Collapse
Posted by Dan Wickstrom on
It appears that somebody reformatted the query and changed it's meaning. It used to be:


       select distinct crftd.path, crftd.storage_area_key
         from cr_files_to_delete crftd
         where not exists (select 1 from cr_revisions r where r.content = crftd.path)


and now it looks like:


  SELECT distinct crftd.path as storage_area_key
    FROM cr_files_to_delete crftd
   WHERE not exists (SELECT 1
                       FROM cr_revisions r
                      WHERE r.content = crftd.path)



I'll go ahead and change it back.

Collapse
Posted by Jarkko Laine on
Thanks, Dan

In oracle version (acs-content-repository-procs-oracle.xql) it seems to be something in between :-) :

select distinct crftd.path storage_area_key
          from cr_files_to_delete crftd
           where not exists (select 1
                             from cr_revisions r
                            where r.filename = crftd.path)
BTW, is your change just in HEAD or also in the 4-6 branch?

Collapse
Posted by Dan Wickstrom on
No it's the same mistake on the oracle side.  Oracle doesn't require the 'as' keyword when declaring an alias.  I'll go ahead and fix that one too.
Collapse
Posted by tammy m on
Did this make it into CVS? Because I am getting the same error on OACS 4.6.1 release.