Opened 8 years ago

Closed 6 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


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 7 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 8 years ago by Michael Manfre

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

comment:2 Changed 8 years ago by Alex Gaynor

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 Changed 8 years ago by Michael Manfre

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 Changed 8 years ago by otherjacob

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 Changed 7 years ago by patchhammer

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 Changed 7 years ago by Julien Phalip

Type: UncategorizedBug

comment:7 Changed 7 years ago by Jacob

milestone: 1.4

Milestone 1.4 deleted

Changed 7 years ago by Michael Manfre

comment:8 Changed 7 years ago by Michael Manfre

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

Updated patch to trunk and removed smart_str calls.

comment:9 Changed 7 years ago by Michael Manfre

Patch needs improvement: unset

comment:10 Changed 7 years ago by Tobias McNulty

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:

comment:11 Changed 6 years ago by Claude Paroz <claude@…>

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