Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion No locking the data down during the transaction?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Josiah Carlson  
View profile  
 More options Oct 15 2012, 5:15 pm
From: Josiah Carlson <josiah.carl...@gmail.com>
Date: Mon, 15 Oct 2012 14:15:42 -0700
Local: Mon, Oct 15 2012 5:15 pm
Subject: Re: No locking the data down during the transaction?
You may want to ping the node-redis folks about it.

Many other languages just end up using connection pools. On the Python
side of things, any time a command is executed directly, a connection
is grabbed, used, and returned. With MULTI/EXEC transactions, the
connection is only grabbed when EXEC is called (at which point all of
the commands are passed), and with WATCH/MULTI/EXEC, connections are
grabbed at WATCH. This works *very* well in practice.

Regards,
 - Josiah

On Sun, Oct 14, 2012 at 2:20 AM, Marc Gravell <marc.grav...@gmail.com> wrote:
> Indeed, transactions on a multiplexed implementation is really hard for
> checked (WATCH) exceptions. BookSleeve is also multiplexed, and for ages I
> didn't expose WATCH because it breaks horribly on a multiplexer. So I did
> the following, which could perhaps be of use for the node implementation?

> http://marcgravell.blogspot.com/2012/10/multiplexed-transactions-in-b...

> This covers most of the common scenarios without having to drop to lua.

> Of course, it would be even nicer if there was some kind of "ASSERT"
> command, but this'll do!

> Marc

> On 14 Oct 2012, at 08:02, Josiah Carlson <josiah.carl...@gmail.com> wrote:

> On Sat, Oct 13, 2012 at 1:32 AM, Felix E. Klee <felix.k...@inka.de> wrote:

> On Sat, Oct 13, 2012 at 5:14 AM, Josiah Carlson

> <josiah.carl...@gmail.com> wrote:

> Note that Node doesn't support WATCH/MULTI/EXEC transactions.

> What? As far as I understand the node_redis module, it just forwards

> commands to Redis. From the [node_redis documentation][1]:

> "`MULTI` commands are queued up until an `EXEC` is issued, and then all

> commands are run atomically by Redis."

> I had a discussion here with a fellow who swore up and down that the
> Node Redis client only used a single connection to Redis, so if you
> wanted to do a WATCH/.../MULTI/.../EXEC, while you were waiting for
> the GET result in a callback, someone else could hop in and run some
> other commands on that same connection - which would mess up what you
> were doing.

> If Node lets you create multiple connections, then I withdraw my claim.

> Also note that there is a fundamental difference between MULTI/EXEC.
> MULTI/EXEC lets you do an atomic sequence of operations as if they
> were 1. But WATCH/MULTI/EXEC lets you do this:
> WATCH foo
> x = GET foo
> if foo < 3:
>  UNWATCH
>  return
> MULTI
> INCR foo
> EXEC

> You can also do that with Lua, but AFAIK, that sequence of operations
> is not possible with the Node Redis libraries (unless you can use
> multiple connections).

> Also note that while there are many things that Lua does support,

> there are some operations that Lua doesn't support that are possible

> with WATCH/MULTI/EXEC transactions [...]

> I can list them out if you'd like.

> Just one, please. That could be enlightening.

> 1. Fetch data from Redis
> 2. Use the fetched data to fetch other data from a *different* Redis,
> local cache, a database, or some other resource
> 3. When the secondary data has been fetched, combine the two pieces of
> data and write back to Redis - failing if some other process has
> already done the same

> You can think of this as the explicit cache-update scenario. It is
> easy with WATCH/MULTI/EXEC or higher-level locks. Not possible with
> Lua, as you can't make remote requests (by design). There are a couple
> other things that I mention in my book about why something like
> WATCH/MULTI/EXEC or locks built on W/M/E or Lua are still necessary
> (but that's in chapter 11, which won't be out for another 3 weeks or
> so).

> By the way, I am using scripting for very simple and well constrained

> tasks. Example:

> I'm glad you figured out how to do this with a single command :)

> - Josiah

> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To post to this group, send email to redis-db@googlegroups.com.
> To unsubscribe from this group, send email to
> redis-db+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/redis-db?hl=en.

> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To post to this group, send email to redis-db@googlegroups.com.
> To unsubscribe from this group, send email to
> redis-db+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/redis-db?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.