Opened 14 years ago

Closed 12 years ago

#14315 closed Bug (fixed)

memcached doesn't support negative deltas for incr() and decr()

Reported by: Michael Manfre Owned by: Michael Manfre
Component: Core (Cache system) Version: 1.2
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

cache.incr() and cache.decr() fail for memcached when delta < 0.

Attachments (1)

django-memcached-negative-delta.diff (1.6 KB ) - added by Michael Manfre 13 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by Michael Manfre, 14 years ago

milestone: 1.3
Owner: changed from nobody to Michael Manfre
Triage Stage: UnreviewedReady for checkin

comment:2 by Alex Gaynor, 14 years ago

Triage Stage: Ready for checkinAccepted

Please don't mark your own tickets as RFC. In this case I'm not sure what's with the change to add smart_str calls, it's certainly untested.

comment:3 by Michael Manfre, 14 years ago

The smart_str calls were added to make the incr() and decr() functions consistent with the rest of the cache class, which enforces that keys are utf-8 strings.

comment:4 by otherjacob, 14 years ago

milestone: 1.31.4
Owner: changed from Michael Manfre to otherjacob

smart_str shouldn't be necessary on integer operations. I'll clean it up and get it in for 1.4

comment:5 by patchhammer, 14 years ago

Easy pickings: unset
Patch needs improvement: set
Severity: Normal
Type: Uncategorized

django-memcached-negative-delta.diff fails to apply cleanly on to trunk

comment:6 by Julien Phalip, 13 years ago

Type: UncategorizedBug

comment:7 by Jacob, 13 years ago

milestone: 1.4

Milestone 1.4 deleted

by Michael Manfre, 13 years ago

comment:8 by Michael Manfre, 13 years ago

Owner: changed from otherjacob to Michael Manfre
UI/UX: unset

Updated patch to trunk and removed smart_str calls.

comment:9 by Michael Manfre, 13 years ago

Patch needs improvement: unset

comment:10 by Tobias McNulty, 13 years ago

The test applies and the tests all pass (with the memcache tests enabled). I removed excess white space, added a second comment, and opened a pull request with the updated diff here:

https://github.com/django/django/pull/82

comment:11 by Claude Paroz <claude@…>, 12 years ago

Resolution: fixed
Status: newclosed

In e645c89bbbcf62479441e50b5e5fdf48a80d424f:

[1.5.x] Fixed #14315 -- Made memcached backend handle negative incr/decr values

Thanks Michael Manfre for the report and initial patch and
Tobias McNulty for the review.

Backport of 79dd751b0b from master.

Note: See TracTickets for help on using tickets.
Back to Top