Bug 597 - Aggressive cachemode leads to problems with grouped collections
: Aggressive cachemode leads to problems with grouped collections
Status: RESOLVED FIXED
: Helma
Database Layer
: 1.6.1
: All All
: P1 normal
: 1.6.3
Assigned To:
:
:
:
  Show dependency treegraph
 
Reported: 2008-01-28 18:27 by
Modified: 2008-10-20 13:11 (History)


Attachments
Collective patch for bugs #597, #614, and #615 (9.86 KB, patch)
2008-04-04 17:29, Hannes Wallnoefer
Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-01-28 18:27:28
Defining "cachemode=aggressive" for a grouped collection leads to wrong
behaviour: when adding a HopObject to a grouped collection where the
appropriate groupnode doesn't already exist the HopObject won't be accessible
using collection.get(groupname).get(0) afterwards. The HopObject will only be
part of the collection if the application is flushed, restarted or another
HopObject is added to the same groupnode of the grouped collection.

To reproduce this behaviour put the following action into a global or root .js
file in Gobi (note that you need to modify the Page id in the first line of the
action):

Root.prototype._debug_action = function() {
   // change the page id to an existing one (eg. a skin)
   var pageId = 1173;

   var page = Page.getById(pageId);
   var type = "system:justatest";
   var direction = "out";
   if (req.data.action) {
      if (req.data.action == "add") {
         this.addLink(type, direction, page);
      } else if (req.data.action == "remove") {
         this.removeLink(type, direction, page);
      } else if (req.data.action == "flush") {
         app.clearCache();
      }
      res.redirect(this.href(req.action));
   } else {
      var groupObj = this.links_out.get(type);
      res.debug("groupobject: " + groupObj);
      if (groupObj != null) {
         res.debug("link: " + groupObj.get(String(pageId)));
      }
   }
   return;
};

Then, with a freshly started gobi application, do the following:
1) request the _debug action: the groupobject should be null
2) request the debug action with "?action=add" as argument: the groupobject
will still be null, which is wrong
3) request the debug aciton with "?action=flush" and both groupobject and the
added link should be visible
4) from now on adding/removing will work, because the groupnode
"system:justatest" already exists. however, if the groupnode is empty and the
application is restarted or flushed, the wrong behaviour appears again.
------- Comment #1 From 2008-04-04 17:29:41 -------
Created an attachment (id=89) [details]
Collective patch for bugs #597, #614, and #615

Fixes this bug plus #614 and #615. Not sure if this is safe for helma 1.6.2,
though.
------- Comment #2 From 2008-04-07 17:24:41 -------
Committed patch to trunk.