Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keys with expiration date equals to zero ( TTL infinite) can not be restored #3

Open
billmetangmo opened this issue Feb 15, 2019 · 2 comments

Comments

@billmetangmo
Copy link

================= How to reproduce ? ============

Prerequesite: A memcached up & running with 0 key

  1. Save a TTL infinite data in memcached
    telnet localhost 11211
    set key1 0 0 9
    memcached

  2. dump the content using memcached-util ( If you open the file generated, you will notice that this key is not present in JSON generated file)

  3. Flush data in memcached
    telnet localhost 11211
    flush_all

  4. Restore the content using memcahed-util

====================== Expected behaviour ==========
Data restored in memcached.

====================== What I got ================
Key key1 already expired, skipping

==================== Environment ==========

======= Operating system ====
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic

======= Memcached version ====
1.5.12

==================== Possible workaround ===========
To restore with TTL infinite key do:

cat /tmp/memcached-backup | jq "map ( if .expiry then . + {expiry:$(date +%s -d "+1 days")} else . + {expiry:$(date +%s -d "+1 days")} end)" | jq -c "" >> /tmp/memcached-restore | memcached-util --op restore --filename /tmp/memcached-backup2

before restoring ( restore from memcached-backup2)

@meabed
Copy link
Member

meabed commented Feb 15, 2019

Thanks for reporting it :) i guess the 0 Comparison is the causing the issue, ill fix and add test and update the issue in a bit 👍

@billmetangmo
Copy link
Author

Thanks @meabed . It will help me to not use my weird workaround :) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants