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

Add support for one-step increments to the Redis engine. #29

Closed
alexkiro opened this Issue Oct 28, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@alexkiro
Contributor

alexkiro commented Oct 28, 2014

I.e. in the same way we added support for the MySQL engine in #23 but for the Redis engine.

In the current way the records are encoded in the Redis engine, one-step increments are not possible. We'll need to change the records from string to hashes, and also provide a way to migrate the database.

The existing migration script can be used. A simple check should be performed when starting the pyzord server looking for a "version" entry in the database and checking if it matches the current implementation. If not then a error message should be displayed with instructions on migrating the database.

@alexkiro alexkiro self-assigned this Oct 28, 2014

@alexkiro alexkiro added this to the 1.0 milestone Oct 28, 2014

alexkiro added a commit that referenced this issue Oct 29, 2014

Refs. #29. Switch to v1 of redis engine.
Deprecate the old version of string encoding record in favour of
using hashes. Check for deprecated records when the engine is
created and display warnings for the user.

Add ability to delete old records to the pyzor-migrate script, in
order to get rid of the warning.

Use hincrby when incrementing reports and whitelists counts, instead
of replacing the whole record. Make sure to set propper expiry if
necessary.

Old version will still be available under the `redis_v0` name.

alexkiro added a commit that referenced this issue Nov 5, 2014

Refs. #29. Change the way we do one-step reports in redis engine:
 - Use `hincrby` even if the key doesn't exists yet. Redis
   automatically creates it and sets it to 1.
 - Use `hsetnx` to set the entered date, this only sets it
   the key doesn't exists.
 - And use `hset` to always set the updated date.
 - Change the decode method to expect some keys to be missing
   from the hash.

@alexkiro alexkiro closed this Dec 10, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment