Bug #67056 memcached segfault with Cluster NoSQL with data mapping to a non-NDB table
Submitted: 2 Oct 2012 14:54 Modified: 14 Aug 2019 19:25
Reporter: Ligaya Turmelle Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Memcached Severity:S2 (Serious)
Version:memcached with 7.2 Cluster OS:Linux (Linux lig-ubuntu-vm 2.6.32-40-generic #87-Unbuntu SMP Tue Mar 6 00:56:56 UTC 2012 x86_64 GNU/Linux)
Assigned to: MySQL Verification Team CPU Architecture:Any

[2 Oct 2012 14:54] Ligaya Turmelle
Description:
When trying to map to a non-NDB table with the NoSQL interface (Cluster) - the memcached segfaults.

Log:
lig@lig-ubuntu-vm:~$ ./mysql/mysqlc/bin/memcached -E /home/lig/mysql/mysqlc/lib/ndb_engine.so -e "connectstring=localhost:1186; role=db-only" -vvv -c 20 -p 11212 -U 11212
26-Sep-2012 08:57:01 EDT NDB Memcache 5.5.19-ndb-7.2.4 started [NDB 7.2.4; MySQL 5.5.19]
Contacting primary management server (localhost:1186) ... 
Connected to "localhost:1186" as node id 51.
Retrieved 5 key prefixes for server role "db-only".
The default behavior is that: 
    GET uses NDB only
    SET uses NDB only
    DELETE uses NDB only.
The 4 explicitly defined key prefixes are "b:" (demo_table_large), "cust_pr" (rental), "film_pr" (rental) and "t:" (demo_table_tabs)
Server started with 4 threads.
Priming the pump ... 
Invalid table "sakila.rental"
Error: unable to create a query plan for key prefix "cust_pr"
Segmentation fault

How to repeat:
(Originally found trying to do Andrew Morgan's Tutorial - Scalable, persistent, HA NoSQL Memcache storage using MySQL Cluster - and playing around with things.)

using the sakila DB
trying to interact with the rental table using data mapping.
did not alter rental to a NDB table

Queries for the mapping:
INSERT INTO ndbmemcache.containers VALUES ('rnt_film', 'sakila', 'rental', 'rental_id', 'inventory_id', 0, NULL, NULL, NULL, NULL);

INSERT INTO ndbmemcache.containers VALUES ('rnt_cust', 'sakila', 'rental', 'rental_id', 'customer_id', 0, NULL, NULL, NULL, NULL);

INSERT INTO ndbmemcache.key_prefixes VALUES (1, 'film_pr', 0, 'ndb-only', 'rnt_film');

INSERT INTO ndbmemcache.key_prefixes VALUES (1, 'cust_pr', 0, 'ndb-only', 'rnt_cust');

Start up the second memcached to get the new settings loaded.
See the memcached logs.

Suggested fix:
An error of some sort hinting what the problem may be.
[25 Oct 2013 20:10] John Duncan
Starting in 7.2.11 you see this:

Invalid table "sakila.rental"
Invalid table "sakila.rental"
Invalid table "sakila.rental"
Invalid table "sakila.rental"
Invalid table "sakila.rental"
Invalid table "sakila.rental"
Invalid table "sakila.rental"
Invalid table "sakila.rental"
Scheduler: starting for 1 cluster; c0,f0,g1,t1
done [0.669 sec].

Pipeline 0 attached to S scheduler.

And then, 

% memclient
memcache > get cust_pr1                                                                              
NOT_FOUND

So I believe the segfault is gone.
[14 Aug 2019 19:25] MySQL Verification Team
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at

  http://www.mysql.com/downloads/