redis-rdb-tools
redis-rdb-tools copied to clipboard
ValueError: year is out of range (memory report)
Attempting a memory report on our redis dump files fails as per below
$ sudo rdb -c memory dump.rdb.pre-purge > rdb_memory.csv
Traceback (most recent call last):
File "/usr/local/bin/rdb", line 9, in <module>
load_entry_point('rdbtools==0.1.6', 'console_scripts', 'rdb')()
File "/usr/local/lib/python2.7/dist-packages/rdbtools/cli/rdb.py", line 82, in main
parser.parse(dump_file)
File "/usr/local/lib/python2.7/dist-packages/rdbtools/parser.py", line 284, in parse
self._expiry = to_datetime(read_unsigned_long(f) * 1000)
File "/usr/local/lib/python2.7/dist-packages/rdbtools/parser.py", line 705, in to_datetime
dt = datetime.datetime.utcfromtimestamp(seconds_since_epoch)
ValueError: year is out of range
@oranagra can you look into this or merge these changes ?
The above referenced commit has lots of noise in it, as far as I could understand, it only comment out the content of to_datetime() and directly return the argument value . While this can solve problems with the commented code, it doesn't serve the original purpose.
utcfromtimestamp() raise this ValueError when the timestamp is of a year out of the platform supported range. 3470263b725ce651894f1331bed8133f261a42fc fix some integer issues, also in the relevant code. It might worth a try to use the master branch code. Anyway, I think the right approach will be to catch this exception and truncate the value while printing a warning.
@optimisticanshul i understand you can reproduce this problem, can you please try the code of the latest master to see if it solves it, and if not either try to implement what @amotzg suggested (catching the exception and logging the problem silently), or tell us how to reproduce. thanks.