[Zope] CoreSession + Non-undoable databases
Chris McDonough
chrism@zope.com
Tue, 09 Oct 2001 18:31:04 -0400
Excellent, I'll add these notes to the HowTo. I really appreciate it.
CJ Kucera wrote:
> On Tue Oct 9 12:43:16 2001, Chris McDonough wrote:
>
>>Ugh! This isn't as easy as it should be.
>>
>
> Excellent; thanks for your help. It appears to be working.
> Some notes:
>
> 1) BerkeleyDB installs by default into /usr/local/BerkeleyDB.3.2
> (obviously if you're installing a different version that'll be
> slightly different). This means that to compile bsddb3 you have
> to do the following:
>
> $ python setup.py build_ext --inplace --berkeley-db=/usr/local...
>
> What the bsdbb3 README files don't tell you is that you have to
> pass in the --berkeley-db= line to the "python setup.py install"
> command as well, or it won't be built properly. To find out if
> it's been built properly, cd into "bsddb3/{arch}/bsddb3" [1] and:
>
> $ nm _db.so | grep db_create
>
> If you get a line like "000242e0 T db_create" you're okay. If you
> get one like " U db_create" there's problems because it wasn't
> linked properly. The "_db.so" created inside the "build" directory
> during the initial "build_ext" step doesn't seem to actually have
> anything to do with anything; the one under "bsddb3" gets compiled
> at the "install" step.
>
> 2) The bsddb3Storage READMEs are a little obtuse. [2] When you've
> untarred the package, you'll have a "bsddb3Storage" directory with
> just .py files in it. THAT's the directory to copy into
> {ZOPE_HOME}/lib/python/Products.
>
> 3) Also, the "custom_zodb.sample" mentioned in the docs doesn't
> actually exist. It's "custom_zodb.py" in the current release
> (1.0beta4), and the syntax of the file doesn't work in Python < 2
> (so if you're using Python 2, you should be okay). The
> custom_zodb.py I ended up using is here:
>
>
>>from bsddb3Storage.Packless import Packless
>>#from bsddb3Storage.Minimal import Minimal as ConcreteStorage
>>#from bsddb3Storage.Full import Full as ConcreteStorage
>>
>>import os
>>env = os.path.join('var', 'bsddb3Storage')
>>
>>Storage = Packless(name='BerkeleyStorage', env=env)
>>
>
> Note that the "env" line is telling the BerkeleyDB that it's
> data directory will be in "var/bsddb3Storage" (your Data.fs
> is in "var").
>
> 4) When you've created the "sessionData" folder in BerkeleyDB,
> shut down your temporary Zope instance and I recommend tarring
> up the bsddb3Storage directory under var, to move it over to
> your "real" zope instance. For instance:
>
> $ cd $TEMP_ZOPE/var; tar zcvf ../berkeleydb.tgz bsddb3Storage
>
> 5) Here's the correct syntax for "Extensions/sessionDB":
>
>
>>import ZODB
>>from bsddb3Storage import Packless
>>
>>def getSessionDB():
>> return ZODB.DB(Packless.Packless('session','berkeleyStorage'))
>>
>
> Note that "berkeleyStorage" is the name of the directory where
> the BerkeleyDB is going to be located (was "var/bsddb3Storage"
> on your "temp" Zope instance earlier). So, using my tarfile from
> before, here's basically what I did:
>
> $ cd $ZOPE_HOME; tar zxf ../temp_zope/berkeleydb.tgz
> $ mv bsddb3Storage berkeleyStorage
>
> So for me, I put the BerkeleyDB Storage directory in the same
> directory as var, lib, zpasswd.py, etc . . .
>
> 6) When it's been inserted into your tree, for all intents and
> purposes it looks EXACTLY like just a regular folder, as far
> as I can tell, which threw me off. There's even an "undo"
> tab and everything. So be careful; there doesn't seem to be
> an indication that it's actually an Externally Mounted
> folder as opposed to a regular one.
>
> In any case, after all that it appears to be working. You might
> want to update your HOWTO with what I've mentioned here.
>
> Thanks very much!
>
> -CJ
>
> [1] Replace "{arch}" with the directory there. On my system, it was
> "lib.linux-i686-1.5"
>
> [2] I lie. They're astonishingly useless. The READMEs distributed
> with 1.0beta4 are actually the 1.0beta3 files, which may account
> or most if not all of the problems. Under the "docs" directory
> there's a "PacklessReadme.txt" that you're much better off not
> reading. It makes references like "Once you've untarred the
> product, you should have a subdirectory named
> 'PacklessBerkeley3Storage'" which turn out to be patently false.
> So anyway . . . [3]
>
> [3] I'm being a bit harsh; they're not really THAT bad, just overly
> confusing at times. :)
>
> WOW: Rapacious | A priest advised Voltaire on his death bed to
> apocalyptech.com/wow | renounce the devil. Replied Voltaire, "This
> pez@apocalyptech.com | is no time to make new enemies."
>
--
Chris McDonough Zope Corporation
http://www.zope.org http://www.zope.com
"Killing hundreds of birds with thousands of stones"