cubicdaiya
unread,Oct 11, 2010, 2:24:20 AM10/11/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Q4M - a Message Queue for MySQL
Hi, Mr. Oku.
Though I verify Q4M for some reason recently, I found the following
anxious behavior.
mysql> create database queue;
Query OK, 1 row affected (0.00 sec)
mysql> use queue
Database changed
mysql> create table q(id int not null, t timestamp default
current_timestamp) engine = queue;
Query OK, 0 rows affected (0.08 sec)
mysql> insert into q(id) values(1);
Query OK, 1 row affected (0.02 sec)
mysql> select * from q;
+----+---------------------+
| id | t |
+----+---------------------+
| 1 | 0000-00-00 00:00:00 |
+----+---------------------+
1 row in set (0.00 sec)
mysql>
Q4M ignores the default value(current_timestamp) of timestamp. The
behavior I hope is following.
mysql> create database queue;
Query OK, 1 row affected (0.00 sec)
mysql> use q
Database changed
mysql> create table q(id int not null, t timestamp default
current_timestamp) engine = queue;
Query OK, 0 rows affected (0.08 sec)
mysql> insert into q(id) values(1);
Query OK, 1 row affected (0.02 sec)
mysql> select * from q;
+----+---------------------+
| id | t |
+----+---------------------+
| 1 | 2010-10-11 14:50:09 |
+----+---------------------+
1 row in set (0.00 sec)
mysql>
Therefore I wrote the folloing patch to enable above operation.
$ diff -u q4m-0.9.4.orig/src/ha_queue.cc q4m-0.9.4/src/ha_queue.cc
--- q4m-0.9.4.orig/src/ha_queue.cc 2010-06-28 17:37:19.000000000 +0900
+++ q4m-0.9.4/src/ha_queue.cc 2010-10-11 08:16:18.734132297 +0900
@@ -2387,6 +2387,10 @@
{
queue_connection_t *conn = queue_connection_t::current();
size_t sz;
+
+ if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
+ table->timestamp_field->set_time();
+
if (conn != NULL && conn->source.offset() != 0) {
sz = pack_row(buf, &conn->source);
$
Is it a specification that Q4M ignores the default value of timestamp?
Or does Q4M recommend not 'timestamp' but 'datetime'?
My environment is following.
・Ubuntu10.04.1 LTS amd64
・kernel-2.6.32-25
・GCC 4.4.3-4ubuntu5
・MySQL-5.1.51
・Q4M-0.9.4