Redis weekly update #2 - Real world hashes, refactoring, and fixes
Monday, 22 March 10
Hello, welcome to the weekly update #2, this time it shifted to Monday as I used the whole Friday for debugging purposes as you'll read in a minute. So this is what happened in the last week, more or less in chronological order.
Real world hashes
Hashes were just a shy start the last week, now they are much better:
- More commands, now we have HSET,HGET,HDEL,HEXISTS,HKEYS,HVALS,HGETALLL,HLEN
- Tests for all the H-commands, resulting in...
- Many bugs fixed including a memory leak and other bugs in zipmap.c
- Support for Hashes in both Virtual Memory and Append Only File
- Documentation, finally.
There are even a couple of users trying hashes in pre-production stage!
Redis-rb hashes and a few other fixes
I find some time in order to hack a bit with Redis-rb and sent a pull request to Ezra that promptly merged the changes. This is what is now fixed:
- Support for hashes, and fixed the support for multi-bulk requests
- Support for binary safe keys: Redis.new(:binary_keys => true)
- Now the .keys method will work the same against 1.2.x and 1.3.x
Refactoring and other improvements
I did a pretty big refactoring of redis.c, basically many commands started nesting with a couple of ifs in order to test if the key was actually found, reply with the right object if it was not, checking the type of the object after the lookup and so forth. Pretty lame, now there are helper functions to do this in a much more interesting way.
Also now the method to compare two Redis objects in hash table lookups is optimized in order to exploit the fact that two objects that are both REDIS_ENCODING_INT can be compared for the o->ptr field directly (as the pointer is instead a long representing the object integer value, casted to a void*). This leads to a major speedups in some Set and Sorted Set operation.
Debugging
- A problem with VM was fixed, thanks to Tom for giving me access to one of his boxes to inspect a Redis process with gdb. Not sure 100% that what I fixed was the problem I observed, but it's definitely a bug less.
- I and Twidi did some crazy debugging session in order to reproduce a memory growing bug he was experimenting. Finally he found that the problem is related to MULTI/EXEC and I just found he filed this issue, so today I'll use some time in order to check this better trying to fix it. Thanks!
Contributions
The trend continues, even this week I received interesting patches:
- Pieter Noordhuis provided an interesting patch in order to generalize the Virtual Memory check for keys that are arguments.
- Got a patch from russryba about redis-cli support for authentication, that I merged after some modification.
- Jeremy Zawodny provided a patch in order to support the include directive in redis.conf
- Alex McHale provided a patch to stop all the Redis madness about parsing integers that are not integers, and similar related issues. That is for instance, you may want Redis to raise an error when you pass an increment that does not look like an integer to the INCR command. I've still to review this patch as it's pretty sensible stuff but I bet I'll merge in a couple of days.
Thanks guys!
Linenoise
Redis-cli needed line editing support. Redis is zero-configuration and I always wondered why there wasn't a simple self-contained, BSD licensed, line editing library now that everybody is using an xterm-capable terminal. Linenoise is the result and just took 2 hours of my weekend. It will be included in Redis in a few days in order to provide out of the box line editing support. I'll try to support a few more Emacs-alike bindings in the future to make it a bit more usable, but I think it's already pretty decent.
See you the next week with the weekly update.
10 comments
home