Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Thu, Dec 11, 2003 at 11:03:35PM -0500, Jim Fulton wrote: > 3. The hard part is walking the object tree. You will need a function that, >given an object, will return the oids of the objects it references. >Perhaps Jeremy can help you with that. Perhaps some of the zodb utilities contain code that might be useful as a starting point? fsrefs.py, checkbtrees.py... > 5. You will want to keep a dictionary of the oids visited, just in case > there are >any cyles. I believe the version of checkbtrees.py in cvs now does that. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's PENGUIN FINALE! (random hero from isometric.spaceninja.com) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
| Think of it in terms of modules: | | objects from BTree -> objects from BTrees.OOBTree | objects from IOBTree -> objects from BTrees.IOBTree | objects from OIBTree -> objects from BTrees.OIBTree | objects from IIBTree -> objects from BTrees.IIBTree | objects from intSet -> objects from BTrees.IIBTree Ok. +++ |Old |New | +++ |BTree.BTree |BTrees.OOBTree.OOBtree | +++ |BTree.Bucket|BTrees.OOBTree.OOBucket | +++ |IOBTree.BTree |BTrees.IOBTree.IOBTree | +++ |IOBTree.Bucket |BTrees.IOBTree.IOBucket | +++ |OIBTree.BTree |BTrees.OIBTree.OIBTree | +++ |OIBTree.Bucket |BTrees.OIBTree.OIBucket | +++ |IIBTree.IIBTree |BTrees.IIBTree.IIBTree | +++ |IIBTree.Bucket |BTrees.IIBTree.IIBUcket | +++ |intSet |BTrees.IIBTree.IITreeSet| +++ | >| 3. The hard part is walking the object tree. You will need a function | >that, | >|given an object, will return the oids of the objects it references. | >|Perhaps Jeremy can help you with that. | > | >I hope so *wink*. | | Me too. He's pretty busy. If he can't, I'll try to help. I started with a slight variation of Shane's change_modules.py [1]. Had to make some changes because stuff seem to have changed in the Connection class. For example, invalidate() now expects a dict instead of a oid. My plan is to change around line 130, where it creates a new pickle with new_class_spec to wake the old object, create a new one and pickle the new object. Sounds reasonable? [1] http://cvs.sourceforge.net/viewcvs.py/zodbex/zodbex/ChangeModules/change_modules.py?rev=1.3&view=auto -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher A programming language is low level when its programs require attention to the irrelevant. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
Sidnei da Silva wrote: | >Is there any special trick to such script? Provided some pointers of | >what the script should do, I wouldn't mind writing and testing it. | | There are lots of special tricks to such a script. Otherwise, I would | have written it already. :) Obviously. /me slaps his forehead | OK, here's how I think it needs to happen, with some, hopefuly helpful | notes. | | 1. The script needs to be run under Zope 2.6 or 2.7. There should |be a product that people can install that installs some method to |be run. People should be able to run this method in a running zope. |They should not need to shut down their site to do the conversion. | | 2. The method should walk the object tree, converting: | |- old-style BTrees to modern BTrees |- old-style buckets to modern buckets |- intSets to IITreeSets. Just to check: +--+---+ | Old|New| +--+---+ | BTree | OOBTree | +--+---+ | IIBTree | IIBtree | +--+---+ | OIBTree | OIBTree | +--+---+ | IOBTree | IOBTree | +--+---+ | intSet | IITreeSet | +--+---+ | bucket? | bucket? | +--+---+ No, this isn't quite right. I don't remember the details off hand. Think of it in terms of modules: objects from BTree -> objects from BTrees.OOBTree objects from IOBTree -> objects from BTrees.IOBTree objects from OIBTree -> objects from BTrees.OIBTree objects from IIBTree -> objects from BTrees.IIBTree objects from intSet -> objects from BTrees.IIBTree |The individual conversions should be pretty simple. At worst involving |a for loop, but, in many cases, the constructors for the new types will |be able to accept the old types. | | 3. The hard part is walking the object tree. You will need a function that, |given an object, will return the oids of the objects it references. |Perhaps Jeremy can help you with that. I hope so *wink*. Me too. He's pretty busy. If he can't, I'll try to help. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
| >Is there any special trick to such script? Provided some pointers of | >what the script should do, I wouldn't mind writing and testing it. | | There are lots of special tricks to such a script. Otherwise, I would | have written it already. :) Obviously. /me slaps his forehead | OK, here's how I think it needs to happen, with some, hopefuly helpful | notes. | | 1. The script needs to be run under Zope 2.6 or 2.7. There should |be a product that people can install that installs some method to |be run. People should be able to run this method in a running zope. |They should not need to shut down their site to do the conversion. | | 2. The method should walk the object tree, converting: | |- old-style BTrees to modern BTrees |- old-style buckets to modern buckets |- intSets to IITreeSets. Just to check: +--+---+ | Old|New| +--+---+ | BTree | OOBTree | +--+---+ | IIBTree | IIBtree | +--+---+ | OIBTree | OIBTree | +--+---+ | IOBTree | IOBTree | +--+---+ | intSet | IITreeSet | +--+---+ | bucket? | bucket? | +--+---+ |The individual conversions should be pretty simple. At worst involving |a for loop, but, in many cases, the constructors for the new types will |be able to accept the old types. | | 3. The hard part is walking the object tree. You will need a function that, |given an object, will return the oids of the objects it references. |Perhaps Jeremy can help you with that. I hope so *wink*. | 4. You should do each conversion in a separate transaction. That is, when | you |encounter an object that needs to be converted, you should convert it |and commit. | | 5. You will want to keep a dictionary of the oids visited, just in case | there are |any cyles. Also, if you encounter an oid that was converted, you will |need to |subtitute the new value. This might be really hard. :( I think this |probably |won't happen, but perhaps you should at least check for it. | | 6. After the conversion has been run, the database should be usable with |the head. Kewl. I'm eager to get my hands on it. -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher Somebody's terminal is dropping bits. I found a pile of them over in the corner. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
Sidnei da Silva wrote: | Jim asked about it on zope-dev, and got no response; see: | | "Can we forsake database backward compatability on the head for | a while?" | | http://mail.zope.org/pipermail/zope-dev/2003-November/021055.html | | ... | | > This would mean that old databases would not be useable with the | > CVS head in the near term. Would this cause anyone any problems? | | I'm happy no one responded to this. Silence is assent, :) :P Is there any special trick to such script? Provided some pointers of what the script should do, I wouldn't mind writing and testing it. There are lots of special tricks to such a script. Otherwise, I would have written it already. :) OK, here's how I think it needs to happen, with some, hopefuly helpful notes. 1. The script needs to be run under Zope 2.6 or 2.7. There should be a product that people can install that installs some method to be run. People should be able to run this method in a running zope. They should not need to shut down their site to do the conversion. 2. The method should walk the object tree, converting: - old-style BTrees to modern BTrees - old-style buckets to modern buckets - intSets to IITreeSets. The individual conversions should be pretty simple. At worst involving a for loop, but, in many cases, the constructors for the new types will be able to accept the old types. 3. The hard part is walking the object tree. You will need a function that, given an object, will return the oids of the objects it references. Perhaps Jeremy can help you with that. 4. You should do each conversion in a separate transaction. That is, when you encounter an object that needs to be converted, you should convert it and commit. 5. You will want to keep a dictionary of the oids visited, just in case there are any cyles. Also, if you encounter an oid that was converted, you will need to subtitute the new value. This might be really hard. :( I think this probably won't happen, but perhaps you should at least check for it. 6. After the conversion has been run, the database should be usable with the head. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
I announced that, for now, The Zope head won't work with old databases. We are going to have to come up with some code to deal with the old btrees and intsets. The good news is that, databases created with Zope 2.7 final should work. :) Jim Jeremy Hylton wrote: On Thu, 2003-12-11 at 10:24, Sidnei da Silva wrote: On Thu, Dec 11, 2003 at 10:07:51AM -0500, Jeremy Hylton wrote: | I think there's a fix for this in CVS. Can you try it again? Just tried. Seems to have fixed it. Now, for the next step *wink*. If I try starting Zope with an old existing database I get the traceback below. Correct me if I'm wrong, but I think the error with 'UserDict' has nothing to do with the 'Could not import class 'BTree'' or am I wrong? I think the attribute error on data is just a symptom of the BTree failure. The object has no data attribute, because ZODB failed to unpickle the object that would be assigned to data. I don't know what happened with backwards compatibility for the old BTree classes. When Jim and I discussed it a while back, I thought we concluded that we would provide a script that would convert all the old BTree instances to new BTrees instance. But I don't know if that decision stuck or if the script was ever written. Jeremy -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Thu, 2003-12-11 at 15:15, Sidnei da Silva wrote: > Do'h, that's a bit difficult since Jim removed them for good :( Hmmm... I suppose you could write the script in Zope 2.7 and tell people they have to use that version of Zope to convert the database before upgrading. > Now, back to the automagically-converting idea, would it be possible > to provide an alias for the old BTree package that would feed the old > pickle into a new BTrees constructor on unpickling *wink*? I just remembered why the problem is harder. Any object that references as BTree has the name of the BTree class embedded in its pickle. The conversion script needs to frob each of those database records to refer to the new class. I'm not sure how to do that. Unpickle and repickle each one? A "simple" binary rewrite of the pickle to past in the new name. Just not sure. Jeremy ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
| Then it may not be necessary to extract the items -- a constructor for a | BTrees-style BTree object: | | /** | ** Accepts a sequence of 2-tuples, or any object with an items() | ** method that returns an iterable object producing 2-tuples. | */ Neat! I'm glad I didn't started on it as Leonardo suggested ;) | IOW, the constructor should invoke .items() for you -- just pass it the | old-style BTree. Of course this has to be done under a version of ZODB that | still *has* old-style BTree support! Do'h, that's a bit difficult since Jim removed them for good :( Now, back to the automagically-converting idea, would it be possible to provide an alias for the old BTree package that would feed the old pickle into a new BTrees constructor on unpickling *wink*? -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher fortune: cannot execute. Out of cookies. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] To the brave folks trying Zope HEAD...
[Jeremy Hylton] > I don't know if there is any documentation for BTree, I don't know of any dcos for (the old) BTree either. > so the code will need to be your guide. I checked the code and each of > the BTree types does support items(). So walk over the database, find > each top-level BTree object, extract its items, put them in a new > BTrees-style BTree, then save that in place of the old object. Then it may not be necessary to extract the items -- a constructor for a BTrees-style BTree object: /** ** Accepts a sequence of 2-tuples, or any object with an items() ** method that returns an iterable object producing 2-tuples. */ IOW, the constructor should invoke .items() for you -- just pass it the old-style BTree. Of course this has to be done under a version of ZODB that still *has* old-style BTree support! I don't know whether the old-style BTree comes in different type-dependent flavors, either. If not, an old BTree should probably become a new OOBTree, and an old IntSet a new IISet. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] To the brave folks trying Zope HEAD...
On Thu, 2003-12-11 at 13:16, Leonardo Rochael Almeida wrote: > On Thu, 2003-12-11 at 15:28, Tim Peters wrote: > > Anyone? Since Sidnei's efforts to use the head are exposing problems, it > > would be great if we could keep him obsessed with it a bit longer. > > Just point Sidnei torwards (sp?) some pretty API docs about old and new > BTrees and he'll be happy as an otter. He'll come up with a conversion > script in no time :-) I don't know if there is any documentation for BTree, so the code will need to be your guide. I checked the code and each of the BTree types does support items(). So walk over the database, find each top-level BTree object, extract its items, put them in a new BTrees-style BTree, then save that in place of the old object. Jeremy ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] To the brave folks trying Zope HEAD...
On Thu, 2003-12-11 at 15:28, Tim Peters wrote: > Anyone? Since Sidnei's efforts to use the head are exposing problems, it > would be great if we could keep him obsessed with it a bit longer. Just point Sidnei torwards (sp?) some pretty API docs about old and new BTrees and he'll be happy as an otter. He'll come up with a conversion script in no time :-) []'s -- Ideas don't stay in some minds very long because they don't like solitary confinement. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] To the brave folks trying Zope HEAD...
>> Jim asked about it on zope-dev, and got no response; see: >> >> "Can we forsake database backward compatability on the head for >> a while?" >> >> http://mail.zope.org/pipermail/zope-dev/2003-November/021055.html [Sidnei da Silva] > Is there any special trick to such script? Provided some pointers of > what the script should do, I wouldn't mind writing and testing it. I'm not sure Jim had a script in mind. For example, he may have wanted to convert "old" data structures to "new" ones magically when they're unpickled (and then when they're written again, the new data structure would get written out, so that the next load wouldn't suffer conversion expense again). I don't know, but Jim's Somehow, Zope 2.8 will convert these automatically reads as if he doesn't want to force people to "run a script" to do explicit database conversion. I have to expect that writing a script would be the most straightforward approach at this time, though. While I've maintained ZODB's "new" BTrees for the last couple years, I've never looked at "the old" BTree code, so I'm not even sure what the possible complications are. I *suspect* a script to convert old BTree instances to new ones would be straightforward, but don't know enough about the old ones to be sure, and am booked solid on different projects now. Anyone? Since Sidnei's efforts to use the head are exposing problems, it would be great if we could keep him obsessed with it a bit longer. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
| Jim asked about it on zope-dev, and got no response; see: | | "Can we forsake database backward compatability on the head for | a while?" | | http://mail.zope.org/pipermail/zope-dev/2003-November/021055.html | | ... | | > This would mean that old databases would not be useable with the | > CVS head in the near term. Would this cause anyone any problems? | | I'm happy no one responded to this. Silence is assent, :) :P Is there any special trick to such script? Provided some pointers of what the script should do, I wouldn't mind writing and testing it. -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher baz bat bamus batis bant. -- James Troup ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] To the brave folks trying Zope HEAD...
[Jeremy] > I think the attribute error on data is just a symptom of the BTree > failure. The object has no data attribute, because ZODB failed to > unpickle the object that would be assigned to data. > > I don't know what happened with backwards compatibility for the old > BTree classes. When Jim and I discussed it a while back, I thought we > concluded that we would provide a script that would convert all the > old BTree instances to new BTrees instance. But I don't know if that > decision stuck or if the script was ever written. Jim asked about it on zope-dev, and got no response; see: "Can we forsake database backward compatability on the head for a while?" http://mail.zope.org/pipermail/zope-dev/2003-November/021055.html ... > This would mean that old databases would not be useable with the > CVS head in the near term. Would this cause anyone any problems? I'm happy no one responded to this. Silence is assent, :) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Thu, 2003-12-11 at 10:24, Sidnei da Silva wrote: > On Thu, Dec 11, 2003 at 10:07:51AM -0500, Jeremy Hylton wrote: > | I think there's a fix for this in CVS. Can you try it again? > > Just tried. Seems to have fixed it. Now, for the next step *wink*. > > If I try starting Zope with an old existing database I get the > traceback below. Correct me if I'm wrong, but I think the error with > 'UserDict' has nothing to do with the 'Could not import class 'BTree'' > or am I wrong? I think the attribute error on data is just a symptom of the BTree failure. The object has no data attribute, because ZODB failed to unpickle the object that would be assigned to data. I don't know what happened with backwards compatibility for the old BTree classes. When Jim and I discussed it a while back, I thought we concluded that we would provide a script that would convert all the old BTree instances to new BTrees instance. But I don't know if that decision stuck or if the script was ever written. Jeremy ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Thu, Dec 11, 2003 at 10:07:51AM -0500, Jeremy Hylton wrote: | I think there's a fix for this in CVS. Can you try it again? Just tried. Seems to have fixed it. Now, for the next step *wink*. If I try starting Zope with an old existing database I get the traceback below. Correct me if I'm wrong, but I think the error with 'UserDict' has nothing to do with the 'Could not import class 'BTree'' or am I wrong? BTW, I've hit a similar problem (AttributeError on 'data') recently on Zope 3, and I thought it could be my fault. ,[ Python Info ] | [EMAIL PROTECTED]:~/src/instance/blog$ python | Python 2.3.3c1 (#2, Dec 6 2003, 16:44:56) | [GCC 3.3.3 20031203 (prerelease) (Debian)] on linux2 ` ,[ Traceback ] | | 2003-12-11T13:14:51 PROBLEM(100) ZODB Could not import class 'BTree' | from module 'BTree' | Traceback (most recent call last): | File "/var/src/zope/head/lib/python/Zope/Startup/run.py", line 27, | in ? | run() | File "/var/src/zope/head/lib/python/Zope/Startup/run.py", line 24, | in run | start_zope(opts.configroot) | File "/var/src/zope/head/lib/python/Zope/Startup/__init__.py", line | 50, in start_zope | starter.startZope() | File "/var/src/zope/head/lib/python/Zope/Startup/__init__.py", line | 218, in startZope | Zope.startup() | File "/var/src/zope/head/lib/python/Zope/__init__.py", line 46, in | startup | _startup() | File "/var/src/zope/head/lib/python/Zope/App/startup.py", line 90, | in startup | Globals.VersionNameName) | File "/var/src/zope/head/lib/python/ZODB/ZApplication.py", line 32, | in __init__ | if not root.has_key(name): | File "/usr/lib/python2.3/UserDict.py", line 41, in has_key | def has_key(self, key): return self.data.has_key(key) | AttributeError: data ` -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher Type louder, please. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
I think there's a fix for this in CVS. Can you try it again? Jeremy ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, 2003-12-10 at 15:36, Sidnei da Silva wrote: > | 'jar' gives: > | object : > | type: getset_descriptor > | refcount: 2 > | address : 0x40621e6c > | > | Thus, asking for the class's _p_jar gives the descriptor back. In ZODB4 > | I hacked around this by requiring that the value of _p_jar be None or a > | string. Would there be any objection to having the same requirement in > | ZODB3? > > I have no clue about the implications of this, but it seems like a > reasonable constraint to me. Actually, that's just a brain cramp on my part. We can check that an oid is a string or None, but not a jar. I'll have to think about an efficient check. Jeremy ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, Dec 10, 2003 at 03:26:03PM -0500, Jeremy Hylton wrote: | Actually, there are two equally valuable clues from the debugger | session: | | object : | type: ExtensionClass.ExtensionClass | refcount: 7 | address : 0x8503bec | | If I understand correctly: LabelField is a class that inherits from | Persistence and some other object has a reference to it that isn't via | __class__. Makes sense to me. How can I find the referencing object? | >>> persistent.Persistent._p_jar | | | If you ask a class for an attribute, it seems you can get a descriptor | back. I vaguely recall Guido saying that this was the intended behavior | last time I asked about it. Yes, I've learnt this the hard way, when Jim tried to explain me and I kept banging my head against the wall :) | 'jar' gives: | object : | type: getset_descriptor | refcount: 2 | address : 0x40621e6c | | Thus, asking for the class's _p_jar gives the descriptor back. In ZODB4 | I hacked around this by requiring that the value of _p_jar be None or a | string. Would there be any objection to having the same requirement in | ZODB3? I have no clue about the implications of this, but it seems like a reasonable constraint to me. -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher MS-DOS, you can't live with it, you can live without it. -- from Lars Wirzenius' .sig ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
Actually, there are two equally valuable clues from the debugger session: object : type: ExtensionClass.ExtensionClass refcount: 7 address : 0x8503bec If I understand correctly: LabelField is a class that inherits from Persistence and some other object has a reference to it that isn't via __class__. >>> persistent.Persistent._p_jar If you ask a class for an attribute, it seems you can get a descriptor back. I vaguely recall Guido saying that this was the intended behavior last time I asked about it. 'jar' gives: object : type: getset_descriptor refcount: 2 address : 0x40621e6c Thus, asking for the class's _p_jar gives the descriptor back. In ZODB4 I hacked around this by requiring that the value of _p_jar be None or a string. Would there be any objection to having the same requirement in ZODB3? Jeremy ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, Dec 10, 2003 at 02:17:23PM -0500, Jeremy Hylton wrote: | On Wed, 2003-12-10 at 14:18, Sidnei da Silva wrote: | > 'jar' gives: | > object : | > type: getset_descriptor | > refcount: 2 | > address : 0x40621e6c | > | > Does that help? | | Yes. The code is getting an unexpected raw descriptor. Someone should | be calling __get__() on this descriptor to get the value. I'll have to | look into it to see how it's going wrong. If I can do anything to help, just ask. -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher The program isn't debugged until the last user is dead. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, 2003-12-10 at 14:18, Sidnei da Silva wrote: > 'jar' gives: > object : > type: getset_descriptor > refcount: 2 > address : 0x40621e6c > > Does that help? Yes. The code is getting an unexpected raw descriptor. Someone should be calling __get__() on this descriptor to get the value. I'll have to look into it to see how it's going wrong. Jeremy ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
| I think you're looking for the helpers defined in Misc/gdbinit in the | Python distribution. If you add them to your .gdbinit, you'll be | golden. | | I've included that file's contents below so you don't have to go | hunting. Neat! There we have 'object', 'self' and 'self->jar', as of line 183 of coptimizations.c: object : type: ExtensionClass.ExtensionClass refcount: 7 address : 0x8503bec object : type: persistent_id refcount: 1 address : 0x415b87b8 object : type: Connection refcount: 238 address : 0x414b80ac 'jar' gives: object : type: getset_descriptor refcount: 2 address : 0x40621e6c Does that help? -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher [We] use bad software and bad machines for the wrong things. -- R.W. Hamming ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, 2003-12-10 at 14:01, Sidnei da Silva wrote: > | Probably a good next step is to set a breakpoint in > | ZODB/coptimizations.c where this exception is raised and find out what > | object is causing the problem, which jar it's already in, and why it's > | getting added to a different jar. Or you could add some print > | statements. > > I figured out how to set a breakpoint in gdb, but I don't know how to > get at the object and inspect it. Can I get a quick hint? I know there > has to be some pointer cast probably, just need to know which one. :) I think you're looking for the helpers defined in Misc/gdbinit in the Python distribution. If you add them to your .gdbinit, you'll be golden. I've included that file's contents below so you don't have to go hunting. # -*- ksh -*- # # If you use the GNU debugger gdb to debug the Python C runtime, you # might find some of the following commands useful. Copy this to your # ~/.gdbinit file and it'll get loaded into gdb automatically when you # start it up. Then, at the gdb prompt you can do things like: # #(gdb) pyo apyobjectptr # #refcounts: 1 #address: 84a7a2c #$1 = void #(gdb) # Prints a representation of the object to stderr, along with the # number of reference counts it current has and the hex address the # object is allocated at. The argument must be a PyObject* define pyo print _PyObject_Dump($arg0) end # Prints a representation of the object to stderr, along with the # number of reference counts it current has and the hex address the # object is allocated at. The argument must be a PyGC_Head* define pyg print _PyGC_Dump($arg0) end # If you are in an eval_frame() function, calling pyframe with no # arguments will print the filename, function name, and line number. # It assumes that f is the name of the current frame. define pyframe x/s ((PyStringObject*)f->f_code->co_filename)->ob_sval x/s ((PyStringObject*)f->f_code->co_name)->ob_sval p f->f_lineno end ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
| Probably a good next step is to set a breakpoint in | ZODB/coptimizations.c where this exception is raised and find out what | object is causing the problem, which jar it's already in, and why it's | getting added to a different jar. Or you could add some print | statements. I figured out how to set a breakpoint in gdb, but I don't know how to get at the object and inspect it. Can I get a quick hint? I know there has to be some pointer cast probably, just need to know which one. :) -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher fortune: cannot execute. Out of cookies. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, 2003-12-10 at 13:07, Sidnei da Silva wrote: > On Wed, Dec 10, 2003 at 12:50:29PM -0500, Chris McDonough wrote: > | Right. ;-) At this point I should just try it myself but if you remove > | the Formulator product, does Zope start? > > If I remove Plone and Formulator it starts yes. Probably a good next step is to set a breakpoint in ZODB/coptimizations.c where this exception is raised and find out what object is causing the problem, which jar it's already in, and why it's getting added to a different jar. Or you could add some print statements. Jeremy ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, Dec 10, 2003 at 12:50:29PM -0500, Chris McDonough wrote: | Right. ;-) At this point I should just try it myself but if you remove | the Formulator product, does Zope start? If I remove Plone and Formulator it starts yes. -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher Equal bytes for women. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
Right. ;-) At this point I should just try it myself but if you remove the Formulator product, does Zope start? On Wed, 2003-12-10 at 12:52, Sidnei da Silva wrote: > On Wed, Dec 10, 2003 at 12:36:53PM -0500, Chris McDonough wrote: > | And you see only the "main" database in Control_Panel->Databases? > > No, I can't get this far. The error happens on startup. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, Dec 10, 2003 at 12:36:53PM -0500, Chris McDonough wrote: | And you see only the "main" database in Control_Panel->Databases? No, I can't get this far. The error happens on startup. -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher %DCL-MEM-BAD, bad memory VMS-F-PDGERS, pudding between the ears ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
And you see only the "main" database in Control_Panel->Databases? On Wed, 2003-12-10 at 12:35, Sidnei da Silva wrote: > On Wed, Dec 10, 2003 at 12:19:47PM -0500, Chris McDonough wrote: > | Right. Ugh. I need to fix this. To work around if for the meantime, > | you could comment out Application.py's line 348 and other related lines > | around it. > > Ok, commented out 292-360, and now I'm back to the previous > traceback. So, it seems to be happening with only one database open. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, Dec 10, 2003 at 12:19:47PM -0500, Chris McDonough wrote: | Right. Ugh. I need to fix this. To work around if for the meantime, | you could comment out Application.py's line 348 and other related lines | around it. Ok, commented out 292-360, and now I'm back to the previous traceback. So, it seems to be happening with only one database open. -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher Linux - Where do you want to fly today? -- Unknown source ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
Right. Ugh. I need to fix this. To work around if for the meantime, you could comment out Application.py's line 348 and other related lines around it. On Wed, 2003-12-10 at 11:45, Sidnei da Silva wrote: > On Wed, Dec 10, 2003 at 11:32:27AM -0500, Chris McDonough wrote: > | The default Zope setup has two databases: the main database and the > | session database. So it's not completely nonsensical for any > | default-configured Zope to raise the error (although I have no idea how > | this error is occurring). It might be worthwhile to specify a main > | database explicitly in zope.conf. This will prevent the default > | database setup from being invoked and then you will be sure that you > | only have one database connection. > > If I don't specify the temp_folder mount database, I get this error: > > > 2003-12-10T14:37:46 ERROR(200) ZODB Failed to mount > database. DBTab.Exceptions.DBTabConfigurationError (No database > configured for mount point at /temp_folder) > Traceback (most recent call last): > File > "/var/src/zope/head/lib/python/Products/ZODBMountPoint/Mount.py", > line 86, in _getOrOpenObject > conn = self._getMountedConnection(anyjar) > File > "/var/src/zope/head/lib/python/Products/ZODBMountPoint/Mount.py", > line 63, in _getMountedConnection > db_name = self._getDBName() > File > "/var/src/zope/head/lib/python/Products/ZODBMountPoint/MountedObject.py", line > 154, in _getDBName > return getConfiguration().getDatabaseFactory(self._path).getName() > File "/var/src/zope/head/lib/python/DBTab/DBTab.py", line 107, in > getDatabaseFactory > self._mountPathError(mount_path) > File "/var/src/zope/head/lib/python/DBTab/DBTab.py", line 71, in > _mountPathError > raise DBTabConfigurationError( > DBTabConfigurationError: No database configured for mount point at > /temp_folder > Traceback (most recent call last): > File "/var/src/zope/head/lib/python/Zope/Startup/run.py", line 27, > in ? > run() > File "/var/src/zope/head/lib/python/Zope/Startup/run.py", line 24, > in run > start_zope(opts.configroot) > File "/var/src/zope/head/lib/python/Zope/Startup/__init__.py", line > 50, in start_zope > starter.startZope() > File "/var/src/zope/head/lib/python/Zope/Startup/__init__.py", line > 218, in startZope > Zope.startup() > File "/var/src/zope/head/lib/python/Zope/__init__.py", line 46, in > startup > _startup() > File "/var/src/zope/head/lib/python/Zope/App/startup.py", line 95, > in startup > OFS.Application.initialize(application) > File "/var/src/zope/head/lib/python/OFS/Application.py", line 348, > in initialize > tf._setObject('session_data', toc) > AttributeError: _setObject > ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, Dec 10, 2003 at 11:32:27AM -0500, Chris McDonough wrote: | The default Zope setup has two databases: the main database and the | session database. So it's not completely nonsensical for any | default-configured Zope to raise the error (although I have no idea how | this error is occurring). It might be worthwhile to specify a main | database explicitly in zope.conf. This will prevent the default | database setup from being invoked and then you will be sure that you | only have one database connection. If I don't specify the temp_folder mount database, I get this error: 2003-12-10T14:37:46 ERROR(200) ZODB Failed to mount database. DBTab.Exceptions.DBTabConfigurationError (No database configured for mount point at /temp_folder) Traceback (most recent call last): File "/var/src/zope/head/lib/python/Products/ZODBMountPoint/Mount.py", line 86, in _getOrOpenObject conn = self._getMountedConnection(anyjar) File "/var/src/zope/head/lib/python/Products/ZODBMountPoint/Mount.py", line 63, in _getMountedConnection db_name = self._getDBName() File "/var/src/zope/head/lib/python/Products/ZODBMountPoint/MountedObject.py", line 154, in _getDBName return getConfiguration().getDatabaseFactory(self._path).getName() File "/var/src/zope/head/lib/python/DBTab/DBTab.py", line 107, in getDatabaseFactory self._mountPathError(mount_path) File "/var/src/zope/head/lib/python/DBTab/DBTab.py", line 71, in _mountPathError raise DBTabConfigurationError( DBTabConfigurationError: No database configured for mount point at /temp_folder Traceback (most recent call last): File "/var/src/zope/head/lib/python/Zope/Startup/run.py", line 27, in ? run() File "/var/src/zope/head/lib/python/Zope/Startup/run.py", line 24, in run start_zope(opts.configroot) File "/var/src/zope/head/lib/python/Zope/Startup/__init__.py", line 50, in start_zope starter.startZope() File "/var/src/zope/head/lib/python/Zope/Startup/__init__.py", line 218, in startZope Zope.startup() File "/var/src/zope/head/lib/python/Zope/__init__.py", line 46, in startup _startup() File "/var/src/zope/head/lib/python/Zope/App/startup.py", line 95, in startup OFS.Application.initialize(application) File "/var/src/zope/head/lib/python/OFS/Application.py", line 348, in initialize tf._setObject('session_data', toc) AttributeError: _setObject -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher "Nuclear war can ruin your whole compile." -- Karl Lehenbauer ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
The default Zope setup has two databases: the main database and the session database. So it's not completely nonsensical for any default-configured Zope to raise the error (although I have no idea how this error is occurring). It might be worthwhile to specify a main database explicitly in zope.conf. This will prevent the default database setup from being invoked and then you will be sure that you only have one database connection. On Wed, 2003-12-10 at 11:19, Jeremy Hylton wrote: > On Wed, 2003-12-10 at 11:14, Sidnei da Silva wrote: > > Has anyone run into this one? > [ traceback snipped ] > > ZODB.POSException.InvalidObjectReference: Attempt to store an object > > from a foreign database connection > > Do you actually have more than one database connection? In other words, > is the error totally nonsensical or could the bug be that something is > getting stored in a foreign database connection? > > Jeremy > > > > ___ > Zope-Dev maillist - [EMAIL PROTECTED] > http://mail.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > http://mail.zope.org/mailman/listinfo/zope-announce > http://mail.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
| Do you actually have more than one database connection? In other words, | is the error totally nonsensical or could the bug be that something is | getting stored in a foreign database connection? I'm just starting Zope by './bin/runzope' from a newly-created instance. No ZEO, no nothing. -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher I came, I saw, I deleted all your files. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, 2003-12-10 at 11:14, Sidnei da Silva wrote: > Has anyone run into this one? [ traceback snipped ] > ZODB.POSException.InvalidObjectReference: Attempt to store an object > from a foreign database connection Do you actually have more than one database connection? In other words, is the error totally nonsensical or could the bug be that something is getting stored in a foreign database connection? Jeremy ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] To the brave folks trying Zope HEAD...
On Wed, Dec 10, 2003 at 02:14:22PM -0200, Sidnei da Silva wrote: | Has anyone run into this one? For the records, here's 'classmeta' and 'state' one line before the exception: (('Products.Formulator.FieldHelpTopic', 'FieldHelpTopic'), None) {'field_class': , 'id': 'LabelField', 'title': 'Formulator Field - LabelField'} -- Sidnei da Silva <[EMAIL PROTECTED]> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher Basic is a high level languish. APL is a high level anguish. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )