diff options
author | Matt Stancliff <matt@genges.com> | 2015-01-18 15:54:30 -0500 |
---|---|---|
committer | Matt Stancliff <matt@genges.com> | 2015-01-19 14:10:12 -0500 |
commit | f704360462640a88975eeb68fd80617921d7c97d (patch) | |
tree | 92b049233346966325d420b515e70b65e4dc02f6 /src/rdb.h | |
parent | cf76af6b9fb7f808ac6f0ab79393d390a14f9cd9 (diff) | |
download | redis-f704360462640a88975eeb68fd80617921d7c97d.tar.gz |
Improve RDB type correctness
It's possible large objects could be larger than 'int', so let's
upgrade all size counters to ssize_t.
This also fixes rdbSaveObject serialized bytes calculation.
Since entire serializations of data structures can be large,
so we don't want to limit their calculated size to a 32 bit signed max.
This commit increases object size calculation and
cascades the change back up to serializedlength printing.
Before:
127.0.0.1:6379> debug object hihihi
... encoding:quicklist serializedlength:-2147483559 ...
After:
127.0.0.1:6379> debug object hihihi
... encoding:quicklist serializedlength:2147483737 ...
Diffstat (limited to 'src/rdb.h')
-rw-r--r-- | src/rdb.h | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -109,9 +109,8 @@ int rdbSaveBackground(char *filename); int rdbSaveToSlavesSockets(void); void rdbRemoveTempFile(pid_t childpid); int rdbSave(char *filename); -int rdbSaveObject(rio *rdb, robj *o); -off_t rdbSavedObjectLen(robj *o); -off_t rdbSavedObjectPages(robj *o); +ssize_t rdbSaveObject(rio *rdb, robj *o); +size_t rdbSavedObjectLen(robj *o); robj *rdbLoadObject(int type, rio *rdb); void backgroundSaveDoneHandler(int exitcode, int bysignal); int rdbSaveKeyValuePair(rio *rdb, robj *key, robj *val, long long expiretime, long long now); |