Bug #65236 Can't set/get data with 2-part key.
Submitted: 8 May 2012 8:15 Modified: 11 May 2012 20:59
Reporter: Peng Shu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:NDB 7.2.5, MySQL 5.5.20 OS:Linux (Ubuntu 11.10 x64)
Assigned to: CPU Architecture:Any
Tags: memcached, ndb_engine
Triage: Needs Triage: D3 (Medium)

[8 May 2012 8:15] Peng Shu
Description:
When using a 2-part key in memcached, memcached can't set/get data.
The two key-parts are primary keys of the table.

Table is created by:
create table clusterdb.test_table (
  key1 int not null,
  key2 int not null,
  val varchar(64) not null,
  cas_v bigint unsigned,
  primary key(key1, key2)
) engine=ndbcluster;

mysql> select * from clusterdb.test_table;
+------+------+------+-------+
| key1 | key2 | val  | cas_v |
+------+------+------+-------+
|    1 |    2 | orz  |  NULL |
+------+------+------+-------+

mysql> select * from containers where db_table='test_table';
+--------------+-----------+------------+-------------+---------------+-------+------------------+------------+--------------------+--------------------+
| name         | db_schema | db_table   | key_columns | value_columns | flags | increment_column | cas_column | expire_time_column | large_values_table |
+--------------+-----------+------------+-------------+---------------+-------+------------------+------------+--------------------+--------------------+
| test_mul_key | clusterdb | test_table | key1,key2   | val           | 0     | NULL             | cas_v      | NULL               | NULL               |
+--------------+-----------+------------+-------------+---------------+-------+------------------+------------+--------------------+--------------------+

mysql> select * from key_prefixes where container='test_mul_key';
+----------------+------------+------------+---------+--------------+
| server_role_id | key_prefix | cluster_id | policy  | container    |
+----------------+------------+------------+---------+--------------+
|              3 | mk:        |          0 | caching | test_mul_key |
+----------------+------------+------------+---------+--------------+

run get in telnet:
get mk:1	2    <----- 1 and 2 seperated by a tab
END

<47 get mk:1	2
worker.0 ndb_get(): cache miss
worker.0 ndb_get():creating workitem 0.1
worker.0 schedule():SchedulerWorker / config gen. 1
worker.0 worker_set_ext_flag(): 0.1: F
worker.0 --> do_read()
worker.0 --> setKeyForReading()
worker.0 workitem_allocate_rowbuffer_1(): 148 [cls 8]
worker.0 schedule():0.1 placed on send queue.
cl0.conn0.send run_ndb_send_thread():Sent 0.1
cl0.conn0.poll run_ndb_poll_thread(): ** adding 0.1 to wait group ** 
cl0.conn0.poll run_ndb_poll_thread():Polling 0.1
cl0.conn0.poll callback_main():NoDataFound [626].
cl0.conn0.poll worker_close():0.1
Got notify from 47, status 0
<47 get mk:1	2
worker.0 ndb_get():Got read callback on workitem 0.1: Item Not Found
worker.0 release_and_free():Releasing workitem 0.1.
worker.0 --> release()
worker.0 release():Returned NdbInstance to freelist.
>47 END

run set in telnet:
set mk:1	2 0 0 1
a
SERVER_ERROR failure

<47 set mk:1	2 0 0 1
worker.0 --> ndb_allocate()
worker.0 ndb_get_item_info(): cache-only
47: going from conn_parse_cmd to conn_nread
47 - Running task: (conn_nread)
47 - Running task: (conn_nread)
47 - Running task: (conn_nread)
worker.0 ndb_get_item_info(): cache-only
worker.0 ndb_store():[set] prefix 3; CAS 0; use mc/db: 1/1
worker.0 ndb_store():creating workitem 0.2
worker.0 schedule():SchedulerWorker / config gen. 1
worker.0 worker_set_ext_flag(): 0.2: F
worker.0 do_write():set
worker.0 worker_set_cas():hi:813ef3 lo:e0000000 cas:813ef3e0000000 (36379489151746048)
worker.0 workitem_allocate_rowbuffer_1(): 154 [cls 8]
worker.0 do_write(): [SET]     "mk:1	2"
worker.0 schedule():0.2 placed on send queue.
cl0.conn0.send run_ndb_send_thread():Sent 0.2
cl0.conn0.poll run_ndb_poll_thread(): ** adding 0.2 to wait group ** 
cl0.conn0.poll run_ndb_poll_thread():Polling 0.2
NDB Error 839: Illegal null attribute 
cl0.conn0.poll worker_close():0.2
Got notify from 47, status 0
worker.0 ndb_get_item_info(): new hash_item
worker.0 ndb_store():Got callback: Transaction failed
>47 SERVER_ERROR failure
47: going from conn_nread to conn_write
worker.0 release_and_free():Releasing workitem 0.2.
worker.0 --> release()
worker.0 release():Returned NdbInstance to freelist.
worker.0 ndb_release():Releasing a hash item.

p.s. also tried:
get mk:1:2
get mk:1 2
get mk:1,2
...
all didn't work.

How to repeat:
1. create a table with two primary key and configure it in memcached
   (see description)
2. run set/get in telnet
[11 May 2012 20:59] Sveta Smirnova
Thank you for the report.

Verified as described.