Forum OpenACS Q&A: file storage problem

Collapse
Posted by bill kellerman on
i'm using file storage for a class i'm teaching.  students are storing assignments and various files.

suddenly, when clicking on "view details" to look at revision info, one particular revision will list many times when it should be listing once.  i assume the sql query is screwing up and returning a record for each revision in file storage total, so that one revision of a particular file repeats around 300 times...

there aren't any errors in the error logs.

i worked with the query in file.tcl that returns revisions for way, way too long before i realized the query being used is actually in an xql file (if queries are being drawn from xql files, shouldn't they be removed from the tcl files?)

has anyone had this problem, or even know where to start looking to solve it?  i'm afraid to do much because losing the student data would be very bad and they need to use file storage tomorrow...

thanks for any help...

Collapse
2: Re: file storage problem (response to 1)
Posted by bill kellerman on
eek...  too sleepy...

redhat 7.3, postgresql 7.3.4, aolserver4beta10, oacs4.6.3

haven't messed with the code.  installed a few packages to see what they actually did then uninstalled them (some wouldn't uninstall).  etp screwed things up royally and doesn't uninstall.  i'm not sure if that messed something up with revisions or something.

Collapse
3: Re: file storage problem (response to 2)
Posted by bill kellerman on
i took the version info query from file.tcl and put it in file-postgresql.xql in the version-info query:

select r.title,
      r.revision_id as version_id,
      person__name(o.creation_user) as author,
      r.mime_type as type,
      to_char(o.last_modified,'YYYY-MM-DD HH24:MI') as last_modified,
      r.description,
      acs_permission__permission_p(r.revision_id,:user_id,'admin') as admin_p,
      acs_permission__permission_p(r.revision_id,:user_id,'delete') as delete_p,
      r.content_length as content_size
from  acs_objects o, cr_revisions r
where  o.object_id = r.revision_id
and    acs_permission__permission_p(r.revision_id, :user_id, 'read') = 't'
and    o.context_id = :file_id
        $show_versions order by last_modified desc

i had to add the line "add o.context_id = :file_id".

it seems to be working now.  what's going on??

Collapse
4: Re: file storage problem (response to 3)
Posted by bill kellerman on
mmph...  sorry, correction...  version-info query in file-postgresql.xql changed to:

select  r.title,
                r.revision_id as version_id,
                person__name(o.creation_user) as author,
                r.mime_type as type,
                to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI') as last_modified,
                r.description,
                acs_permission__permission_p(r.revision_id,:user_id,'admin') as admin_p,
                acs_permission__permission_p(r.revision_id,:user_id,'delete') as delete_p,
                r.content_length as content_size
        from  acs_objects o, cr_revisions r, cr_items i
        where o.object_id = r.revision_id
          and r.item_id = i.item_id
          and r.item_id = :file_id
          and exists (select 1
                      from acs_object_party_privilege_map m
                      where m.object_id = r.revision_id
                        and m.party_id = :user_id
                        and m.privilege = 'read')
        $show_versions order by last_modified desc

i don't know if this query is correct or efficient, but so far it is working.