Opened 6 years ago

Closed 4 years ago

#14315 closed Bug (fixed)

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

Reported by: manfre Owned by: 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 manfre 5 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 6 years ago by manfre

  • milestone set to 1.3
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to manfre
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 6 years ago by Alex

  • Triage Stage changed from Ready for checkin to Accepted

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 6 years ago by 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 5 years ago by otherjacob

  • milestone changed from 1.3 to 1.4
  • Owner changed from 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 5 years ago by patchhammer

  • Easy pickings unset
  • Patch needs improvement set
  • Severity set to Normal
  • Type set to Uncategorized

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

comment:6 Changed 5 years ago by julien

  • Type changed from Uncategorized to Bug

comment:7 Changed 5 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

Changed 5 years ago by manfre

comment:8 Changed 5 years ago by manfre

  • Owner changed from otherjacob to manfre
  • UI/UX unset

Updated patch to trunk and removed smart_str calls.

comment:9 Changed 5 years ago by manfre

  • Patch needs improvement unset

comment:10 Changed 5 years ago by tobias

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 4 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

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