Bug #78994 Doc says ndbmemcached doesn't support expire_time_column but it works
Submitted: 28 Oct 2015 3:20 Modified: 16 Nov 2015 7:37
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Documentation Severity:S3 (Non-critical)
Version:7.4.8 OS:CentOS (6.7)
Assigned to: CPU Architecture:Any
Tags: expire, memcached

[28 Oct 2015 3:20] Tsubasa Tanaka
Description:
"MySQL Cluster API Developer Guide" describes ndbmemcached doesn't support "expire_time_column".

https://dev.mysql.com/doc/ndbapi/en/ndbmemcache-configuration.html

But actually, "expire_time_column" seems working.

How to repeat:
Setup MySQL Cluster 7.4.8.

```
$ bin/ndb_mgmd --initial -f ./config.ini
$ bin/ndbd
$ bin/mysqld_safe --no-defaults --user=mysql --ndbcluster &
```

config.ini is

```
[ndbd default]
NoOfReplicas= 1

[mysqld  default]
[ndb_mgmd default]
[tcp default]

[ndb_mgmd]
HostName= localhost

[ndbd]

[API]
NodeId  = 51
[API]
[API]
[API]
```

Setup ndbmemcached by script and add expire_time_column into demo_table.

```
$ bin/mysql
mysql> source share/memcache-api/ndb_memcache_metadata.sql
mysql> ALTER TABLE ndbmemcache.demo_table ADD expire TIMESTAMP;
mysql> SELECT * FROM ndbmemcache.containers WHERE name= 'demo_table';
mysql> UPDATE ndbmemcache.containers SET expire_time_column= 'expire' WHERE name= 'demo_table';
mysql> SELECT * FROM ndbmemcache.containers WHERE name= 'demo_table';
```

Start ndbmemcached and set key with expiration time.

```
$ bin/memcached -u mysql -E lib/ndb_engine.so -e "connectstring=localhost:1186" &
$ telnet localhost 11211
set name 0 3 7
tsubasa
STORED

$ bin/mysql -e "SELECT * FROM ndbmemcache.demo_table"
+------+------------+-------+------------------+--------------+---------------------+
| mkey | math_value | flags | cas_value        | string_value | expire              |
+------+------------+-------+------------------+--------------+---------------------+
| name |       NULL |     0 | 4503407427584002 | tsubasa      | 2015-10-28 12:15:52 |
+------+------------+-------+------------------+--------------+---------------------+
```

Try to get after expiration time, that was expired correctly.

```
$ telnet localhost 11211
get name
END

$ bin/mysql -e "SELECT * FROM ndbmemcache.demo_table"
```

Suggested fix:
Fix the doc.
[28 Oct 2015 9:53] MySQL Verification Team
Hello Tanaka-San,

Thank you for the report.

// Confirmed this with 7.4.8 build.

mysql> SELECT * FROM ndbmemcache.demo_table;
+------+------------+-------+------------------+--------------+---------------------+
| mkey | math_value | flags | cas_value        | string_value | expire              |
+------+------------+-------+------------------+--------------+---------------------+
| name |       NULL |     0 | 4503257372164096 | tsubasa      | 2015-10-28 10:49:25 |
+------+------------+-------+------------------+--------------+---------------------+
1 row in set (0.00 sec)

mysql> SELECT * FROM ndbmemcache.demo_table;
Empty set (0.00 sec)

// session 2

[umshastr@hod03]/export/umesh/cluster: telnet localhost 11211
Trying ::1...
Connected to localhost.
Escape character is '^]'.
set name 0 3 7
tsubasa
STORED
get name
END

Thanks,
Umesh
[12 Nov 2015 16:10] Jon Stephens
This looks to me like a feature request. Resetting category/etc to match.
[13 Nov 2015 3:27] Tsubasa Tanaka
Why do you think that is feature request?

Actuary, there is the difference between document's described and memcached's behavior.

It means this report should have one of these 3,

* "Document is wrong"(I think so)
  * Category: MySQL Cluster Documentation
  * Status  : Verified

* "Program has bug"
  * Category: MySQL Cluster Memcached
  * Status  : Verified

* "I'm wrong for this problem's velification"
  * Category: (not matter)
  * Status  : Not a bug
[16 Nov 2015 7:37] MySQL Verification Team
// Changing back status to verified