Bug #34331 Setting falcon_consistent_read does not work properly
Submitted: 5 Feb 2008 20:23 Modified: 5 May 2008 17:04
Reporter: Hakan Küçükyılmaz Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Kevin Lewis CPU Architecture:Any

[5 Feb 2008 20:23] Hakan Küçükyılmaz
Description:
Setting falcon_consistent_read does not work properly. Setting falcon_consistent read set's it to -1.

How to repeat:
[21:21] root@(none)>select @@global.falcon_consistent_read;
+---------------------------------+
| @@global.falcon_consistent_read |
+---------------------------------+
|                               1 |
+---------------------------------+
1 row in set (0.00 sec)

[21:21] root@(none)>set global falcon_consistent_read = 1;
Query OK, 0 rows affected (0.00 sec)

[21:21] root@(none)>select @@global.falcon_consistent_read;
+---------------------------------+
| @@global.falcon_consistent_read |
+---------------------------------+
|                              -1 |
+---------------------------------+
1 row in set (0.00 sec)

[21:21] root@(none)>set global falcon_consistent_read = ON;
Query OK, 0 rows affected (0.00 sec)

[21:22] root@(none)>select @@global.falcon_consistent_read;
+---------------------------------+
| @@global.falcon_consistent_read |
+---------------------------------+
|                              -1 |
+---------------------------------+
1 row in set (0.00 sec)
[5 Feb 2008 20:36] MySQL Verification Team
Thank you for the bug report.

c:\dbs>6.0\bin\mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 6.0.5-alpha-nt Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select @@global.falcon_consistent_read;
+---------------------------------+
| @@global.falcon_consistent_read |
+---------------------------------+
|                               1 |
+---------------------------------+
1 row in set (0.00 sec)

mysql> set global falcon_consistent_read = 1;
Query OK, 0 rows affected (0.05 sec)

mysql> select @@global.falcon_consistent_read;
+---------------------------------+
| @@global.falcon_consistent_read |
+---------------------------------+
|                              -1 |
+---------------------------------+
1 row in set (0.00 sec)

mysql>
[6 Feb 2008 4:43] Kevin Lewis
The update function for falcon_consistent_read uses the value sent by the server for ON or OFF as if it were a boolean, but it is not.  The server sets the save value to -1 if ON.  The right way to save this value in Falcon is illustrated by the default update function below found in sql_plugin.cc.

static void update_func_bool(THD *thd, struct st_mysql_sys_var *var,
                             void *tgt, void *save)
{
  *(my_bool *) tgt= *(int *) save ? 1 : 0;
}

So we should change;

void StorageInterface::updateConsistentRead(MYSQL_THD thd, struct st_mysql_sys_var* variable, void *var_ptr, void *save)
{
-	falcon_consistent_read = *(my_bool *) save;
+	falcon_consistent_read = (my_bool) (*(int *) save ? 1 : 0);
. . .
[6 Feb 2008 16:21] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/41793

ChangeSet@1.2807, 2008-02-06 10:20:32-06:00, klewis@klewis-mysql. +1 -0
  Bug#34331 - Convert -1 to 1 for boolean values sent by the server
  for a setting, specifically falcon_consistent_read.
[6 Feb 2008 22:28] Kevin Lewis
Pushed a changeset to mysql-6.0-falcon-team with the previously mentioned fix.
[11 Feb 2008 20:55] Kevin Lewis
Patch is in mysql-6.0-falcon-team and mysql-6.0-release version 6.0.4
[5 May 2008 17:04] Paul DuBois
Noted in 6.0.4 changelog.

Setting falcon_consistent_read to a value of 1 or ON resulted in a 
value of −1 being assigned.