Is it possible to get partial data set for HMSET?

321 views
Skip to first unread message

Yaxing Chen

unread,
Jul 15, 2015, 6:53:13 PM7/15/15
to redi...@googlegroups.com
Hi, I'm trying to see if we need to handle the case that Redis stores partial data:

E.g.

HMSET KEY F1 V1 F2 V2

Is it possible that, due to some failure cases (e.g. packet loss), Redis only writes KEY F1 V1 and lost F2 V2?

I assume it won't for packet loss since Redis parses the whole command and arguments from the input buffer, and if any packet loss here command won't be completed and therefore won't be executed. After parsing the whole command Redis does a hashType set for each key-value pairs passed in, any chance partial results got introduced here due to some failure cases?

Any insight on this would be appreciated!

Thanks!

Josiah Carlson

unread,
Jul 15, 2015, 8:33:39 PM7/15/15
to redi...@googlegroups.com
*All* individual commands in Redis are guaranteed to be atomic, and commands between MULTI/EXEC are also (effectively) guaranteed to be atomic.

As such, there is no scenario with Redis where you would get a partial write with HMSET. You either get all or no keys/values set.

 - Josiah



--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Yaxing Chen

unread,
Jul 17, 2015, 6:58:53 PM7/17/15
to redi...@googlegroups.com
Thanks!
Reply all
Reply to author
Forward
0 new messages