Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

set_multi fails when single array reference passed. #4

Closed
rrb3942 opened this Issue Feb 16, 2013 · 1 comment

Comments

Projects
None yet
2 participants

rrb3942 commented Feb 16, 2013

If you call set_multi with just a single array reference as the value it fails with the following errors:

'Using second stack item for AV '
'Expected array reference'

Example of how to reproduce:
my $ con = $con = Couchbase::Client->new({ server => '127.0.0.1', bucket => 'default' });
my $opret = $con->set_multi([ 'somekey', 'somevalue' ])

This may seem odd, but in my use case I am calling set_multi to bulk insert, I then check all of the returns and append any failed to a list to try again, and call set_multi with that list. Rinse, repeat in a loop until all items have been inserted successfully.

Since set_multi can't handle a single item list I was occasionally getting a crash when only a single item remained to be retried.

I am now checking to see if only a single insert remains, but it would be more convenient if set_multi worked with a single item list.

@mnunberg mnunberg added a commit that referenced this issue Mar 21, 2013

@mnunberg mnunberg GH-4: Fix set_multi with single arrayref
Previously set_multi would crash when a single arrayref was used as part
of the list. This fixes that issue
69d3c35
Owner

mnunberg commented Mar 21, 2013

Fixed in 1.0.1

@mnunberg mnunberg closed this Mar 21, 2013

@mnunberg mnunberg added a commit that referenced this issue Apr 16, 2013

@mnunberg mnunberg GH-4: set_multi with single array ref
This is a forward-port from the master branch
1b18eb9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment