Forum OpenACS Development: upgrade to 5.3.2 -cache_key error

Collapse
Posted by Matthew Coupe on
I'm upgrading from Openacs-5.2.3 to 5.3.2 with Postgres 8.2.4 and Aolserver 4.0.10.

No idea what is causing this. Is there some kind of tutorial for reading these error logs?!

Any help would be greatly appreciated. Thanks.

[-conn:nccedudotlrn::3] Error: apm_package_install: Error installing Localization version 5.3.2:
Invalid switch: "-cache_key"
Invalid switch: "-cache_key"
while executing
"db_string__arg_parser"
(procedure "db_string" line 1)
invoked from within
"db_string -cache_key ad_lang_mime_charset_$locale charset_for_locale {}"
(procedure "lang::util::charset_for_locale" line 3)
invoked from within
"lang::util::charset_for_locale $locale"
(procedure "get_catalog_file_path" line 13)
invoked from within
"get_catalog_file_path -package_key $package_key -locale $locale"
(procedure "get_catalog_paths_for_import" line 27)
invoked from within
"get_catalog_paths_for_import -package_key $package_key -locales $locales"
(procedure "lang::catalog::import" line 30)
invoked from within
"lang::catalog::import -cache -package_key $package_key"
(procedure "apm_load_catalog_files" line 9)
invoked from within
"apm_load_catalog_files -upgrade $package_key"
invoked from within
"if { $upgrade_p } {
# We are upgrading a package

# Load catalog files with upgrade switch before package version is changed i..."
("uplevel" body line 59)
invoked from within
"uplevel $body "
[24/Oct/2007:20:03:59][2031.3054709680][-conn:nccedudotlrn::3] Error:

Failed to install Localization, version 5.3.2. The following error was generated:

Invalid switch: "-cache_key"

<font color="red">NOTE:</font> If the error comes from a sql script you may try to source it manually. When you are done with that you should revisit
the APM and try again but remember to leave the manually souced sql scipts unchecked on the previous page.

Collapse
Posted by Matthew Coupe on
Sorry, postgres 8.2.5.
Collapse
Posted by Matthew Coupe on
I've done a fresh install using the code base and it seems to work perfectly so it must be something in the upgrade. This cache problem seems to happen for quite a few different packages. Will keep digging but I don't really know what I'm looking for!
Collapse
Posted by Gustaf Neumann on
The problem seems to be that the upgrade executes calls for the relatively new db_* interface with caching without having the functions defined. see:
http://cvs.openacs.org/cvs/openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl?r1=1.61&r2=1.62

have you tried to boot from the new kernel with the old database and use acs-admin/apm/packages-install to run the update scripts then?

Collapse
Posted by Matthew Coupe on
The process I followed:

Checked out latest version of the code, oacs-core 5-3 etc.

Copied these files over my existing code base in packages/

In my browser I went to /acs-admin/apm/packages-install

Went through the installation process, following it in the error log and it kept hitting these cache problems.

When you say 'boot from the new kernel' what do you mean?

Collapse
Posted by Gustaf Neumann on
"boot" means start the aolserver new, using the new kernel files.
Collapse
Posted by Dave Bauer on
Gustaf is right. The new tcl api is required so you'll need to restart aolserver after copying the new code.
Collapse
Posted by Matthew Coupe on
Thanks for the help, that worked for everything except xowiki. I should be home and dry after this one to merge all of my custom changes.

Cheers

Database operation "dml" failed (exception ERROR, "ERROR:  insert or update on table "xowiki_object" violates foreign key constraint "$1"
DETAIL:  Key (xowiki_object_id)=(2475969) is not present in table "xowiki_plain_page".
")

ERROR:  insert or update on table "xowiki_object" violates foreign key constraint "$1"
DETAIL:  Key (xowiki_object_id)=(2475969) is not present in table "xowiki_plain_page".

SQL: insert into xowiki_objecti (item_id,revision_id,creation_user,title,description,mime_type,nls_language,text,creator)  values ('2475970','2475969','14554','Weblog',NULL,'text/plain','en_US','#
  # A sample Weblog object.
  #
  my initialize -parameter {
    {-page_size:integer 10}
    {-page_number:integer 1}
    {-summary:boolean 0}
    {-date ""}
    {-tag ""}
    {-ptag ""}
    {-entries_of ""}
  }

  #
  # The following definition is the default rendering per
  # weblog entry. This is executed in the context of every displayed page.
  #
  Class create EntryRenderer -instproc render {} {
    my instvar package_id name title creator creation_user pretty_date description
    [my set __parent] instvar weblog_obj

    # We get the instance_attributes, if these are available. For the
    # time being, we have these only in full mode (no summary)
    if {[my exists instance_attributes]} {
      set instance_attributes [my set instance_attributes]
    } else {
      set instance_attributes ""
    }
    set link [::xowiki::Portlet detail_link -package_id $package_id -name $name  -instance_attributes $instance_attributes]
    set show_more [expr {[$weblog_obj summary] && [my exists text] && [my text] ne ""}]
    set more [expr {$show_more ?
                    " <span class=''more''> \\[<a href=''$link''>more...</a>\\]</span>" : ""}]
    append more "<p></p>"
    set my_footer [my htmlFooter]

    append content "<DIV class=''post'' style=''clear: both; background: #f8f8f8;''>"  "<h2><a href=''$link''>$title</a></h2>"  "<p class=''auth''>Created by $creator, "  "last modified by [::xo::get_user_name $creation_user] "  "<span class=''date''>$pretty_date</span></p>"  $description $more $my_footer \\n "</DIV>"
  }

  #
  # The following definition is the renderer for the full weblog.
  # This is executed in the context of the whole weblog object
  #
  Class create WeblogRenderer -instproc render {} {
    my instvar filter_msg link name prev_page_link next_page_link

    set filter ""
    set prev ""
    set next ""

    if {[info exists filter_msg]} {
      set filter  "<div class=''filter''>$filter_msg</div>"
    }
    if {[info exists prev_page_link]} {
      set prev "<a href=''$prev_page_link''> <img border=0 src=''/resources/acs-subsite/left.gif''  alt=''Previous Page'' style=''float: left;  top: 0px;''></a>"
    }
    if {[info exists next_page_link]} {
      set next "<a href=''$next_page_link''> <img border=0 src=''/resources/acs-subsite/right.gif''  alt=''Next Page'' style=''float: left;  top: 0px;''></a>"
    }
    return "<div class=''weblog''> $filter [next] $prev $next </div>"
  }

  my proc content {} {
    my get_parameters
    set page [my info parent]

    if {[$page exists __including_page]} {
      set i [$page set __including_page]
      set exclude_item_ids [$i item_id]
      $i set render_adp 0  ;# no double substitutions
      #my log "--W including page $i"
    } else {
      #my log "--W NO including page"
      set exclude_item_ids [$page item_id]
      $page set __no_footer 1
    }

    # on the weblog-portlet page, an edit-new should not create an object
    ::xo::cc set_parameter object_type ::xowiki::Page

    # the default renderer
    #set renderer      ::xowiki::Weblog::WeblogRenderer
    #set entry_renderer ::xowiki::Weblog::EntryRenderer

    # the above custom renderers
    set renderer      [self]::WeblogRenderer
    set entry_renderer [self]::EntryRenderer

    set w [::xowiki::Weblog new -destroy_on_cleanup  -package_id $package_id  -page_size $page_size  -page_number $page_number  -summary $summary  -date $date  -category_id [ns_queryget category_id]  -tag $tag  -ptag $ptag  -entries_of $entries_of  -exclude_item_ids $exclude_item_ids  -entry_renderer $entry_renderer  ]

    $w mixin add $renderer
    return [$w render]
  }',NULL)
    while executing
"ns_pg_bind dml nsdb0 {insert into xowiki_objecti (item_id,revision_id,creation_user,title,description,mime_type,nls_language,text,creator)  values (:i..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
    ("postgresql" arm line 2)
    invoked from within
"switch $driverkey {
                oracle {
                    return [uplevel $ulevel [list ns_ora $type $db $sql] $args]
                }
      ..."
    invoked from within
"db_exec dml $db $full_statement_name $sql"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $code_block "
    invoked from within
"db_with_handle -dbn $dbn db {
            db_exec dml $db $full_statement_name $sql
        }"
    (procedure "db_dml" line 100)
    invoked from within
"$insert_view_operation [my qn revision_add]  [[my info class] insert_statement $__atts __postponed_vars]"
    ("uplevel" body line 22)
    invoked from within
"uplevel 1 $transaction_code "
    (procedure "db_transaction" line 1)
    invoked from within
"db_transaction {
      $__class instvar storage_type object_type
      #$__class folder_type -folder_id $parent_id register
      [self class] lock ac..."
    (procedure "save_new" line 28)
    invoked from within
"next"
    (procedure "save_new" line 3)
    ::xotcl::__#d ::Generic::CrCache::Item->save_new
    invoked from within
"$page save_new"
    (procedure "import_prototype_page" line 33)
    ::1978766 ::xowiki::Package->import_prototype_page
    invoked from within
"$package_id import_prototype_page weblog-portlet"
    (procedure "::xowiki::upgrade_callback" line 223)
    invoked from within
"::xowiki::upgrade_callback  -from_version_name 0.47 -to_version_name 0.60.1"
    ("eval" body line 1)
    invoked from within
"eval $command"
    (procedure "apm_invoke_callback_proc" line 37)
    invoked from within
"apm_invoke_callback_proc -version_id $version_id -type after-upgrade -arg_list [list from_version_name $upgrade_from_version_name to_version_name $ver..."
    (procedure "apm_package_install" line 191)
    invoked from within
"apm_package_install  -enable=$enable_p  -package_path $package_path  -callback apm_ns_write_callback  -load_data_model  -data_model_files $data_model_..."
    ("foreach" body line 42)
    invoked from within
"foreach pkg_info $pkg_install_list {
    set spec_file [pkg_info_spec $pkg_info]
    set package_path [pkg_info_path $pkg_info]

    if { [catch {
    ar..."
    ("uplevel" body line 34)
    invoked from within
"uplevel {
ad_page_contract {

    Installs the packages.

    @author Bryan Quinn (mailto:bquinn@arsdigita.com)
    @creation-date Mon Oct  9 00:22:31 2000
..."
    (procedure "code::tcl::/var/lib/aolserver/nccedudotlrn/packages/acs-admi..." line 2)
    invoked from within
"code::tcl::$__adp_stub"
    invoked from within
"if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init tcl $__adp_stub
..."
    ("uplevel" body line 3)
    invoked from within
"uplevel {

    if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init t..."
    (procedure "adp_prepare" line 2)
    invoked from within
"adp_prepare"
    invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
    (procedure "adp_parse_ad_conn_file" line 5)
    invoked from within
"$handler"
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
                $handler
            } ad_script_abort val {
                # do nothing
            }"
    invoked from within
"rp_serve_concrete_file [ad_conn file]"
    (procedure "rp_serve_abstract_file" line 60)
    invoked from within
"rp_serve_abstract_file "$root/$path""
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
            rp_serve_abstract_file "$root/$path"
            set tcl_url2file([ad_conn url]) [ad_conn file]
            set tcl_url2path_info..."

Collapse
Posted by Gustaf Neumann on
The error message says that during the creation of a weblog page the insert in the the automically generated view xowiki_objecti fails (this view should insert the key in the supertype xowiki_plain_page as well).

i am wondering about the following line from your error message:

    (procedure "db_dml" line 100)
in acs-5-3, the insert operation should be a db_0or1row and not a db_dml! The command name should be returned by
   ::Generic::CrItem set insert_view_operation
in ds/shell in the oacs-5-3 branch. What version of the acs-content-repository have you installed? did you run the update scripts for the content-repository?
Collapse
Posted by Matthew Coupe on
I've installed 5.3.2 of content repository. I didn't source anything manually for content repository, it all ran from APM. I'll try sourcing the upgrade scripts manually and see what happens.
Collapse
Posted by Gustaf Neumann on
did you restart the server after the upgrade?
xotcl-core checks during startup the version of acs-content-repository, if it is lower than 5.3.0d1, it uses db_dml, otherwise db_0or1row (this was the version, where the update was changed into a stored procedure, therefore postgres does not accept db_dml there). A restart of openacs makes sure, that xotcl-core sees the right version of the content-repository. What do you get from running
   ::Generic::CrItem set insert_view_operation
in ds/shell?
Collapse
Posted by Matthew Coupe on
I seem to have broken all of my DEV installations! When I get it sorted I'm going to try upgrading the Openacs core first and then the rest of the packages after a restart. Does that sound sensible to avoid the last problem?

I can't do the /ds/shell.

Collapse
Posted by Gustaf Neumann on
Oops, sounds bad. i would try the following sequence:
  1. get the new core files
  2. start aolserver + openacs with the "old" database + new core files
  3. do upgrade of kernel packages
  4. restart
  5. do upgrade of application packages
  6. restart
Collapse
Posted by Matthew Coupe on
That's done it!!

Thanks for all the help, I learnt some valuable tricks there. Hopefully this thread will be useful for others wanting to take the upgrade too.

Matthew

Collapse
Posted by Matthew Coupe on
G'argh!

One more problem with the Static-Portlets. I seem to have always had trouble with these things but there was no alternative when we first put our system together so I've got quite a few of the things kncoking around.

Any ideas what this is all about what be greatly appreciated. I'm sure it should know what "pretty_name" is?!

Error: Error in include template "/var/lib/aolserver/nccedudotlrn/packages/static-portlet/www
/static-portlet": can't read "pretty_name": no such variable
can't read "pretty_name": no such variable
while executing
"lang::util::localize $pretty_name"
invoked from within
"set pretty_name [lang::util::localize $pretty_name]"
("uplevel" body line 41)
invoked from within
"uplevel {
#
# Copyright (C) 2001, 2002 MIT
#
# This file is part of dotLRN.
#
# dotLRN is free software; you can redistribute it and/or modify it u..."
(procedure "code::tcl::/var/lib/aolserver/nccedudotlrn/packages/static-p..." line 2)
invoked from within
"code::tcl::$__adp_stub"
invoked from within
"if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init tcl $__adp_stub
..."
("uplevel" body line 3)
invoked from within
"uplevel {

if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init t..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare"
invoked from within
"template::adp_parse [template::util::url_to_file "static-portlet" "$__adp_stub"] [list cf "shaded_p f shadeable_p t package_id 1388 hideable_p t link_..."