zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henry Robinson <he...@cloudera.com>
Subject Re: How to ensure trasaction create-and-update
Date Tue, 30 Mar 2010 03:08:11 GMT
On 29 March 2010 19:10, Ted Dunning <ted.dunning@gmail.com> wrote:

> This is not a good thing.  ZK gains lots of its power and reliability by
> not
> trying to do atomic updates to multiple znodes at once.
Ted -

Could you say a bit about how you feel ZK would sacrifice power and
reliability through multi-node updates? My view is that it wouldn't: since
all operations are executed serially, there's no concurrency to be lost by
allowing multi-updates, and there doesn't need to be a 'start / end'
transactional style interface (which I do believe would be very bad).

I could see ZK implement a Sinfonia-style batch operation API which makes
all-or-none updates. The reason I can see that it doesn't already allow this
is the avowed intent of the original ZK team to keep the API as simple as it
can reasonably be, and to not introduce complexity without need.


> Can you say more about the update that you want to do?  It is common for
> updates like to be such that you can order the updates and do without a
> truly atomic transaction.  For instance if one file is a list of other
> files
> (say for a queue) and you need to create a file and add a reference in the
> list of files, you can generally be safe creating the new file first and
> then doing an atomic update on the list of files secondly.  If your process
> fails between the two operations, then you may generate a small number of
> garbage files (this number can be substantially decreased by careful use of
> try/finally) which might require a cleanup process to run occasionally to
> find unreferenced and old files.
> On Mon, Mar 29, 2010 at 6:54 PM, zd.wbh <zd.wbh@163.com> wrote:
> >   we'd like to store some metadata in zookeeper in our upcoming project,
> > here is a special but common case: we need to create a new znode, in the
> > mean while, update another znode data. These manipulation(a create and a
> > update) need to be done as atom. We don't want to see a successful
> creation
> > and a failure updating. Is there a convenient way to ensure this
> operation?
> > Can you give me some tips?
> >
> >    I've looked into the src code, there is a tedious way to do. Extend
> > zookeeper instruction, struct a "createAndUpdate" interface and a txn
> > request, let DataTree to ensure the integrity. Will this do and the only
> > way?
> >

Henry Robinson
Software Engineer

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message