Handlersocket off by one error in IN() requests

Bug #906978 reported by Erik Jacobson
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.1
Won't Fix
Low
Unassigned
5.5
Triaged
Low
Unassigned
5.6
Triaged
Low
Unassigned
5.7
Invalid
Undecided
Unassigned

Bug Description

Using Percona server 5.5.13-rel20.4-138.lenny with the included Handlersocket plugin and the following config:

handlersocket_verbose = 10
handlersocket_address = '192.168.0.1'
handlersocket_port = 2678
handlersocket_threads = 16 # 2xcpu... 3 x spins wildly out of control
handlersocket_threads_wr = 1
handlersocket_timeout = 30
handlersocket_backlog = 32768
# defaults, 262144 is 256k
handlersocket_sndbuf = 0
handlersocket_rcvbuf = 0
# Set to non 0 if connection pooling/persistent connections are used
handlersocket_accept_balance = 0
handlersocket_wrlock_timeout = 6

There seems to be an odd off by one error when using the IN() syntax (which otherwise seems to work):
"2 > 1 0 5 0 @ 0 4 10 20 30 40"

[Index Id 2 / PRIMARY(id) > 0 / limit 0,5 / id IN(10,20,30,40)]

As an example, the result set here would be user id and user name:

11 / usera, 21 / userb, 31 / userc, 41 / userd

So, it's actually returning the next ID for each in the set (the usernames are correct for the returned 11/21/31/41 ids) rather then the requested IDs. I've been manually fixing this by iterating over my request and decrementing each ID in the IN() section by one.

The second part of this is when using a FILTER argument. The off by one error also seems to show up in the other direction (so I iterate over and increment instead of decrement each element)

If you need any further info or debugging, please let me know. Thanks!

Stewart Smith (stewart)
Changed in percona-server:
importance: Undecided → High
Revision history for this message
Erik Jacobson (kross) wrote :

I echoed this bug on upstream here: https://github.com/DeNADev/HandlerSocket-Plugin-for-MySQL/issues/70

There was a reply regarding a pull request, which makes me believe I just may have gotten IN() support removed? Which would be unfortunate, as I do rely on it (after applying the workaround)

Stewart Smith (stewart)
tags: added: handlersocket
Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

@Erik

1. The commit revert doesn't seem to remove the IN support but its ability to match multiple rows for single IN value (atleast what I could get from https://github.com/DeNADev/HandlerSocket-Plugin-for-MySQL/issues/56 )

2. Seems #56 has been reverted in Jan 23, 2012 in https://github.com/DeNADev/HandlerSocket-Plugin-for-MySQL/commit/33fda0d039b03f9a036a1fae36a3f10f0e7de56e

3. However, the HandlerSocket plugin bundled with Percona Server seems to last updated upto commit -- https://github.com/DeNADev/HandlerSocket-Plugin-for-MySQL/commit/635b93097cf8c08594b8248d5da13237778e98b0 which is from April 11, 2011. So, it is not possible that it has the revert commit of 33fda0d.

So, have you tested with latest HandlerSocket build (built from the git here https://github.com/DeNADev/HandlerSocket-Plugin-for-MySQL) ?

We will need to file bug for #3 separately or use same bug for that.

Changed in percona-server:
status: New → Confirmed
Revision history for this message
Erik Jacobson (kross) wrote :

Oh hey, thanks for the update! I was beginning to suspect handlersocket was on its way to becoming a dead project in favor of other key/value methods. :)

I have not yet evaluated the new plugin, but will try as soon as I'm able, though that may not happen for a while due to other tasks.

Revision history for this message
Stewart Smith (stewart) wrote :

We'll happily keep Percona Server up to date with HandlerSocket releases, so it's up to the HandlerSocket guys to resolve this :)

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-2715

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.