[Zope] zope subtransactions with atomic commits

kapil thangavelu k_vertigo@yahoo.com
Fri, 18 Jan 2002 05:11:46 -0800


hi joseph,

wow, that email, was a blast from the past. the best thing would be to ad=
d to=20
a conflict resisistant container type like a btree and manually call comm=
it=20
at set intervals through the processing, deactivating objects via=20
_p_deactivate as they get added to the container (to lessen mem requireme=
nts=20
and assuming their persistent derived objects). keep in mind that there w=
ill=20
be extra size growth for the storage if you're using a non packless varia=
nt.=20
quick example (untested)

count =3D 0
thresh =3D 1000
for x in really_big_data_set:
=A0 =A0 if count%thresh =3D=3D 0:
=A0=A0=A0=A0=A0=A0=A0=A0get_transaction().commit()
=A0 =A0 container.add_object(count, x)
=A0 =A0 x._p_deactivate()

this runs minor interference with the zope semantics, which will try to=20
commit the txn at the end of the request, but that shouldn't cause any=20
operational difficulties.

hth, feel free to elaborate if that you need more info.=20

cheers

kapil
On Wednesday 16 January 2002 09:40 pm, Joseph Wayne Norton wrote:
> Kapil -
>
> I have been doing some searching through some of the zope mail
> archives and the zope.org site.  I ran across the following e-mail
> (quite old) from you ...
>
> =20
> http://zope.nipltd.com/public/lists/zope-archive.nsf/242bb7cc2b2c343d80=
2568
>ab003585d4/6a900d1f029e6ef38025693600744914?OpenDocument
>
> I'm wondering if you have any further updates on the above subject.  I
> have a similar requirement.
>
> I would like to be able to perform 1 or more "checkpoints" within a
> single zope request.  If the request transaction is aborted, then only
> changes since the most recent "checkpoint" should be rolledback.
>
> Any ideas or suggestions?
>
> - j
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )