MySQL Forums
Forum List  »  memcached

Problem using incr in multi-column table
Posted by: PJ Fan
Date: September 03, 2013 10:55AM

Hello,

I'm trying to use the memcached plugin to update a column that stores a counter value every time an event happens in my application. If the table only has a key column and the counter column, incr works fine. If the table has a 3rd column, eg. key | counter | someval, calling incr on the counter column does not work correctly and returns unexpected values. Using the following example table, calling incr on "good" returns 1 as expected, but calling incr on "bad" returns 22:

delimiter $$

CREATE TABLE `counter_test` (
`counter_id` varchar(45) NOT NULL,
`counter_value` varchar(45) DEFAULT NULL,
`counter_value2` varchar(45) DEFAULT NULL,
`c3` int(11) DEFAULT NULL,
`c4` bigint(20) DEFAULT NULL,
`c5` int(11) DEFAULT NULL,
PRIMARY KEY (`counter_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1$$

INSERT INTO `innodb_memcache`.`containers`
(`name`,
`db_schema`,
`db_table`,
`key_columns`,
`value_columns`,
`flags`,
`cas_column`,
`expire_time_column`,
`unique_idx_name_on_key`)
VALUES
(
'counter_test',
'test',
'counter_test',
'counter_id',
'counter_value',
'c3',
'c4',
'c5',
'PRIMARY'
);

insert into counter_test (counter_id, counter_value) values ('good', '0');
insert into counter_test (counter_id, counter_value, counter_value2) values ('bad', '0', '1');

Results:
incr good 1
1
incr bad 1
22

Has anyone else had this experience and is there a way to fix it?

Thanks!

Options: ReplyQuote


Subject
Views
Written By
Posted
Problem using incr in multi-column table
2649
September 03, 2013 10:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.