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

duplicate "!ttl!x!timestamp|foo" entries causing unwanted deletes #48

Closed
jfromaniello opened this issue Mar 31, 2016 · 2 comments · Fixed by #49
Closed

duplicate "!ttl!x!timestamp|foo" entries causing unwanted deletes #48

jfromaniello opened this issue Mar 31, 2016 · 2 comments · Fixed by #49

Comments

@jfromaniello
Copy link
Contributor

My application does something like:

db.put("foo", "xx", {ttl: ms('1h') });

After sometime running (12hs), I eventually end up with duplicated entries with the key format !ttl!x!timestamp|foo which causes an unwanted delete before the time that is expected to be deleted

I took an snapshot of my db and I ran the following command:

 ./leveldb_keys ~/db-snapshot/ | grep '!ttl!x!' | cut -c 23- | sort | uniq -c | grep -v '^ *1 '
   2 foo
   2 bar
   2 baz

I was having this issue with v2 yesterday (warning it has a different format for the key of these entries). I upgraded to v3 and I continue to have the same problem. If I leave the application running more time I eventually end up having more than 2 of these things. The application didn't crash at any time, etc.

Can you think on any kind of race condition between ttlon/off? Why ttloff might not be working on some circustance?

If someone is using this module in production with traffic, can ran the above command on test if it has duped entries will be awesome.

Thanks

@jfromaniello
Copy link
Contributor Author

BTW I can't reproduce this issue yet on my tests but I will continue to look into it.

@jfromaniello
Copy link
Contributor Author

Some more info here:

» ./util/leveldb_keys ~/db-snapshot/ | grep 'foo'
!ttl!x!1459493778475!ÿfoo
!ttl!x!1459516001078!ÿfoo
!ttl!ÿfoo
ÿfoo

» ./util/leveldb_get ~/db-snapshot/ '!ttl!ÿfoo'
'1459516001078'

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

Successfully merging a pull request may close this issue.

1 participant