Bug #55636 many ndb variables don't have documented scope
Submitted: 29 Jul 2010 19:36 Modified: 23 Sep 2010 9:53
Reporter: Sven Sandberg Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:all OS:Any
Assigned to: Jon Stephens CPU Architecture:Any

[29 Jul 2010 19:36] Sven Sandberg
Description:
NDB server variables are listed at http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-option-tables.html . If I understand correctly, all rows with a Yes in the "System var" column are supposed to be server variables. There are many mistakes in this table:

 - Many rows that are documented as server variables are not accessible as
   server variables (SELECT @@[GLOBAL|SESSION].VARIABLE). 

 - The scope is wrong for some variables (e.g., NDB_USE_COPYING_ALTER_TABLE
   is documented as session-only variable but it exists as both global and
   session variable).

 - For some variables, the scope is undocumented.

The table at http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html has similar problems for the ndb variables. In addition, identifiers listed there are marked as system variables even if they only exist as status variables.

How to repeat:
The following test case investigates all server variables listed at http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-option-tables.html . For each variable, it first prints the scope and dynamicity according to the manual. Then it tries to read and write the session and global variable. In a majority of the cases the documented behavior doesn't match the actual behavior.

--source include/have_ndb.inc
--disable_abort_on_error
--echo # Scope=Global Dynamic=No
SELECT @@GLOBAL.HAVE_NDBCLUSTER;
SET @@GLOBAL.HAVE_NDBCLUSTER = @@GLOBAL.HAVE_NDBCLUSTER;
SELECT @@SESSION.HAVE_NDBCLUSTER;
SET @@SESSION.HAVE_NDBCLUSTER = @@SESSION.HAVE_NDBCLUSTER;
--echo # Scope=Both, Dynamic=Yes
SELECT @@GLOBAL.NDB_AUTOINCREMENT_PREFETCH_SZ;
SET @@GLOBAL.NDB_AUTOINCREMENT_PREFETCH_SZ = @@GLOBAL.NDB_AUTOINCREMENT_PREFETCH_SZ;
SELECT @@SESSION.NDB_AUTOINCREMENT_PREFETCH_SZ;
SET @@SESSION.NDB_AUTOINCREMENT_PREFETCH_SZ = @@SESSION.NDB_AUTOINCREMENT_PREFETCH_SZ;
--echo # Scope=Global, Dynamic=No
SELECT @@GLOBAL.NDB_BATCH_SIZE;
SET @@GLOBAL.NDB_BATCH_SIZE = @@GLOBAL.NDB_BATCH_SIZE;
SELECT @@SESSION.NDB_BATCH_SIZE;
SET @@SESSION.NDB_BATCH_SIZE = @@SESSION.NDB_BATCH_SIZE;
--echo # Scope=Global, Dynamic=Yes
SELECT @@GLOBAL.NDB_CACHE_CHECK_TIME;
SET @@GLOBAL.NDB_CACHE_CHECK_TIME = @@GLOBAL.NDB_CACHE_CHECK_TIME;
SELECT @@SESSION.NDB_CACHE_CHECK_TIME;
SET @@SESSION.NDB_CACHE_CHECK_TIME = @@SESSION.NDB_CACHE_CHECK_TIME;
--echo # Scope=Global, Dynamic=Yes
SELECT @@GLOBAL.NDB_EXTRA_LOGGING;
SET @@GLOBAL.NDB_EXTRA_LOGGING = @@GLOBAL.NDB_EXTRA_LOGGING;
SELECT @@SESSION.NDB_EXTRA_LOGGING;
SET @@SESSION.NDB_EXTRA_LOGGING = @@SESSION.NDB_EXTRA_LOGGING;
--echo # Scope=Both, Dynamic=Yes
SELECT @@GLOBAL.NDB_FORCE_SEND;
SET @@GLOBAL.NDB_FORCE_SEND = @@GLOBAL.NDB_FORCE_SEND;
SELECT @@SESSION.NDB_FORCE_SEND;
SET @@SESSION.NDB_FORCE_SEND = @@SESSION.NDB_FORCE_SEND;
--echo # Scope=Both Dynamic=Yes
SELECT @@GLOBAL.NDB_LOG_BIN;
SET @@GLOBAL.NDB_LOG_BIN = @@GLOBAL.NDB_LOG_BIN;
SELECT @@SESSION.NDB_LOG_BIN;
SET @@SESSION.NDB_LOG_BIN = @@SESSION.NDB_LOG_BIN;
--echo # Scope=Both Dynamic=Yes
SELECT @@GLOBAL.NDB_LOG_BINLOG_INDEX;
SET @@GLOBAL.NDB_LOG_BINLOG_INDEX = @@GLOBAL.NDB_LOG_BINLOG_INDEX;
SELECT @@SESSION.NDB_LOG_BINLOG_INDEX;
SET @@SESSION.NDB_LOG_BINLOG_INDEX = @@SESSION.NDB_LOG_BINLOG_INDEX;
--echo # Scope=Both Dynamic=Yes
SELECT @@GLOBAL.NDB_LOG_EMPTY_EPOCHS;
SET @@GLOBAL.NDB_LOG_EMPTY_EPOCHS = @@GLOBAL.NDB_LOG_EMPTY_EPOCHS;
SELECT @@SESSION.NDB_LOG_EMPTY_EPOCHS;
SET @@SESSION.NDB_LOG_EMPTY_EPOCHS = @@SESSION.NDB_LOG_EMPTY_EPOCHS;
--echo # Scope=Both Dynamic=No
SELECT @@GLOBAL.NDB_LOG_ORIG;
SET @@GLOBAL.NDB_LOG_ORIG = @@GLOBAL.NDB_LOG_ORIG;
SELECT @@SESSION.NDB_LOG_ORIG;
SET @@SESSION.NDB_LOG_ORIG = @@SESSION.NDB_LOG_ORIG;
--echo # Scope=Global Dynamic=Yes
SELECT @@GLOBAL.NDB_LOG_UPDATE_AS_WRITE;
SET @@GLOBAL.NDB_LOG_UPDATE_AS_WRITE = @@GLOBAL.NDB_LOG_UPDATE_AS_WRITE;
SELECT @@SESSION.NDB_LOG_UPDATE_AS_WRITE;
SET @@SESSION.NDB_LOG_UPDATE_AS_WRITE = @@SESSION.NDB_LOG_UPDATE_AS_WRITE;
--echo # Scope=Global Dynamic=Yes
SELECT @@GLOBAL.NDB_LOG_UPDATED_ONLY;
SET @@GLOBAL.NDB_LOG_UPDATED_ONLY = @@GLOBAL.NDB_LOG_UPDATED_ONLY;
SELECT @@SESSION.NDB_LOG_UPDATED_ONLY;
SET @@SESSION.NDB_LOG_UPDATED_ONLY = @@SESSION.NDB_LOG_UPDATED_ONLY;
--echo # Scope=Session Dynamic=Yes
SELECT @@GLOBAL.NDB_TABLE_NO_LOGGING;
SET @@GLOBAL.NDB_TABLE_NO_LOGGING = @@GLOBAL.NDB_TABLE_NO_LOGGING;
SELECT @@SESSION.NDB_TABLE_NO_LOGGING;
SET @@SESSION.NDB_TABLE_NO_LOGGING = @@SESSION.NDB_TABLE_NO_LOGGING;
--echo # Scope=Session Dynamic=Yes
SELECT @@GLOBAL.NDB_TABLE_TEMPORARY;
SET @@GLOBAL.NDB_TABLE_TEMPORARY = @@GLOBAL.NDB_TABLE_TEMPORARY;
SELECT @@SESSION.NDB_TABLE_TEMPORARY;
SET @@SESSION.NDB_TABLE_TEMPORARY = @@SESSION.NDB_TABLE_TEMPORARY;
--echo # Scope=Session Dynamic=No
SELECT @@GLOBAL.NDB_USE_COPYING_ALTER_TABLE;
SET @@GLOBAL.NDB_USE_COPYING_ALTER_TABLE = @@GLOBAL.NDB_USE_COPYING_ALTER_TABLE;
SELECT @@SESSION.NDB_USE_COPYING_ALTER_TABLE;
SET @@SESSION.NDB_USE_COPYING_ALTER_TABLE = @@SESSION.NDB_USE_COPYING_ALTER_TABLE;
--echo # Scope=Both Dynamic=Yes
SELECT @@GLOBAL.NDB_USE_EXACT_COUNT;
SET @@GLOBAL.NDB_USE_EXACT_COUNT = @@GLOBAL.NDB_USE_EXACT_COUNT;
SELECT @@SESSION.NDB_USE_EXACT_COUNT;
SET @@SESSION.NDB_USE_EXACT_COUNT = @@SESSION.NDB_USE_EXACT_COUNT;
--echo # Scope=Both Dynamic=Yes
SELECT @@GLOBAL.NDB_USE_TRANSACTIONS;
SET @@GLOBAL.NDB_USE_TRANSACTIONS = @@GLOBAL.NDB_USE_TRANSACTIONS;
SELECT @@SESSION.NDB_USE_TRANSACTIONS;
SET @@SESSION.NDB_USE_TRANSACTIONS = @@SESSION.NDB_USE_TRANSACTIONS;
--echo # Scope=? Dynamic=No
SELECT @@GLOBAL.NDB_WAIT_CONNECTED;
SET @@GLOBAL.NDB_WAIT_CONNECTED = @@GLOBAL.NDB_WAIT_CONNECTED;
SELECT @@SESSION.NDB_WAIT_CONNECTED;
SET @@SESSION.NDB_WAIT_CONNECTED = @@SESSION.NDB_WAIT_CONNECTED;
--echo # Scope=? Dynamic=No
SELECT @@GLOBAL.NDB_WAIT_SETUP;
SET @@GLOBAL.NDB_WAIT_SETUP = @@GLOBAL.NDB_WAIT_SETUP;
SELECT @@SESSION.NDB_WAIT_SETUP;
SET @@SESSION.NDB_WAIT_SETUP = @@SESSION.NDB_WAIT_SETUP;
--echo # Scope=? Dynamic=No
SELECT @@GLOBAL.NDBINFO_DATABASE;
SET @@GLOBAL.NDBINFO_DATABASE = @@GLOBAL.NDBINFO_DATABASE;
SELECT @@SESSION.NDBINFO_DATABASE;
SET @@SESSION.NDBINFO_DATABASE = @@SESSION.NDBINFO_DATABASE;
--echo # Scope=Both Dynamic=Yes
SELECT @@GLOBAL.NDBINFO_MAX_BYTES;
SET @@GLOBAL.NDBINFO_MAX_BYTES = @@GLOBAL.NDBINFO_MAX_BYTES;
SELECT @@SESSION.NDBINFO_MAX_BYTES;
SET @@SESSION.NDBINFO_MAX_BYTES = @@SESSION.NDBINFO_MAX_BYTES;
--echo # Scope=Both Dynamic=Yes
SELECT @@GLOBAL.NDBINFO_MAX_ROWS;
SET @@GLOBAL.NDBINFO_MAX_ROWS = @@GLOBAL.NDBINFO_MAX_ROWS;
SELECT @@SESSION.NDBINFO_MAX_ROWS;
SET @@SESSION.NDBINFO_MAX_ROWS = @@SESSION.NDBINFO_MAX_ROWS;
--echo # Scope=Both Dynamic=Yes
SELECT @@GLOBAL.NDBINFO_SHOW_HIDDEN;
SET @@GLOBAL.NDBINFO_SHOW_HIDDEN = @@GLOBAL.NDBINFO_SHOW_HIDDEN;
SELECT @@SESSION.NDBINFO_SHOW_HIDDEN;
SET @@SESSION.NDBINFO_SHOW_HIDDEN = @@SESSION.NDBINFO_SHOW_HIDDEN;
--echo # Scope=Both Dynamic=Yes
SELECT @@GLOBAL.NDBINFO_TABLE_PREFIX;
SET @@GLOBAL.NDBINFO_TABLE_PREFIX = @@GLOBAL.NDBINFO_TABLE_PREFIX;
SELECT @@SESSION.NDBINFO_TABLE_PREFIX;
SET @@SESSION.NDBINFO_TABLE_PREFIX = @@SESSION.NDBINFO_TABLE_PREFIX;
--echo # Scope=Global Dynamic=No
SELECT @@GLOBAL.NDBINFO_VERSION;
SET @@GLOBAL.NDBINFO_VERSION = @@GLOBAL.NDBINFO_VERSION;
SELECT @@SESSION.NDBINFO_VERSION;
SET @@SESSION.NDBINFO_VERSION = @@SESSION.NDBINFO_VERSION;
--echo # Scope=Global Dynamic=No
SELECT @@GLOBAL.SERVER_ID_BITS;
SET @@GLOBAL.SERVER_ID_BITS = @@GLOBAL.SERVER_ID_BITS;
SELECT @@SESSION.SERVER_ID_BITS;
SET @@SESSION.SERVER_ID_BITS = @@SESSION.SERVER_ID_BITS;
--echo # Scope=Global Dynamic=Yes
SELECT @@GLOBAL.SLAVE_ALLOW_BATCHING;
SET @@GLOBAL.SLAVE_ALLOW_BATCHING = @@GLOBAL.SLAVE_ALLOW_BATCHING;
SELECT @@SESSION.SLAVE_ALLOW_BATCHING;
SET @@SESSION.SLAVE_ALLOW_BATCHING = @@SESSION.SLAVE_ALLOW_BATCHING;

Suggested fix:
I'm  guessing this is a documentation bug, but please check if all these variables work as intended.
[29 Jul 2010 20:25] Sven Sandberg
Also:

 - At http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html , the link to ndb_log_empty_epochs leads to documentation for --log-slave-updates and ndb_log_empty_tables is described at the end of --log-slave-updates. It would be better if ndb_log_empty_tables had an entry of its own.

 - At http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html , the variable ndb_log_orig has a link to a page that seems unrelated (does not contain the text "ndb_log_orig").

 - ndb_optimize_delay is not documented among the server variables (but it is briefely described at http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-limitations-resolved.html ).

 - At http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-system-variables.html , ndb_table_temporary is listed as sysvar_ndb_table_temporary (remove "sysvar_")
[30 Jul 2010 6:17] Jon Stephens
Pretty obvious that this one belongs to me.
[30 Jul 2010 14:58] Sven Sandberg
Also, there are no traces at all of --ndbinfo-show-hidden in the server. I.e., mysqld does not recognize the option, and even the following doesn't find anything (tried in mysql-trunk and mysql-5.1):

$ grep -r -i show.*hidden

Not sure how that could get into the manual in the first place. Maybe it once existed and then was removed? Which other variables have been removed without updating the manual?
[31 Jul 2010 8:10] Jon Stephens
jon@tonfisk:~/bin/mysql-5.1-telco-7.1/bin> ./mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.44-ndb-7.1.5 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like '%ndb%';
+-------------------------------------+---------+
| Variable_name                       | Value   |
+-------------------------------------+---------+
| have_ndbcluster                     | YES     |
| ndb_autoincrement_prefetch_sz       | 1       |
| ndb_batch_size                      | 32768   |
| ndb_cache_check_time                | 0       |
| ndb_connectstring                   |         |
| ndb_extra_logging                   | 1       |
| ndb_force_send                      | ON      |
| ndb_index_stat_cache_entries        | 32      |
| ndb_index_stat_enable               | OFF     |
| ndb_index_stat_update_freq          | 20      |
| ndb_log_binlog_index                | ON      |
| ndb_log_empty_epochs                | OFF     |
| ndb_log_update_as_write             | ON      |
| ndb_log_updated_only                | ON      |
| ndb_optimization_delay              | 10      |
| ndb_optimized_node_selection        | 3       |
| ndb_report_thresh_binlog_epoch_slip | 3       |
| ndb_report_thresh_binlog_mem_usage  | 10      |
| ndb_table_no_logging                | OFF     |
| ndb_table_temporary                 | OFF     |
| ndb_use_copying_alter_table         | OFF     |
| ndb_use_exact_count                 | OFF     |
| ndb_use_transactions                | ON      |
| ndbinfo_database                    | ndbinfo |
| ndbinfo_max_bytes                   | 0       |
| ndbinfo_max_rows                    | 10      |
| ndbinfo_show_hidden                 | OFF     |
| ndbinfo_table_prefix                | ndb$    |
| ndbinfo_version                     | 459013  |
+-------------------------------------+---------+
29 rows in set (0.00 sec)
[31 Jul 2010 8:12] Jon Stephens
mysql> SHOW STATUS LIKE '%ndb%';
+--------------------------------+-----------+
| Variable_name                  | Value     |
+--------------------------------+-----------+
| Ndb_cluster_node_id            | 4         |
| Ndb_config_from_host           | 127.0.0.1 |
| Ndb_config_from_port           | 1186      |
| Ndb_number_of_data_nodes       | 2         |
| Ndb_number_of_ready_data_nodes | 2         |
| Ndb_connect_count              | 0         |
| Ndb_execute_count              | 0         |
| Ndb_scan_count                 | 0         |
| Ndb_pruned_scan_count          | 0         |
| Ndb_cluster_connection_pool    | 1         |
| Ndb_conflict_fn_max            | 0         |
| Ndb_conflict_fn_old            | 0         |
+--------------------------------+-----------+
12 rows in set (0.00 sec)
[5 Aug 2010 20:46] Sven Sandberg
OK, so the confusion is that ndb variables are documented as existing in 5.1, but they actually exist only in the 5.1 *telco* trees. 5.1 is merged to the telco trees, but the telco trees are not merged to 5.1. So I guess that means that the manual is supposed to be correct for the telco trees, not the 5.1 tree. Maybe this should be clarified.

I also wrote a script that parses the xml file used to generate the manual, and generates a test case that checks if the scope and dynamic-ness of each variable matches the documentation. The script found a number of small inconsistencies: see attachment. (It is possible that the script is buggy and some of it is wrong - I didn't check all of it - but it seems that the script is right in a majority of the cases.)
[5 Aug 2010 20:48] Sven Sandberg
List of errors in the manual, generated by script.

Attachment: wrong_documentation_for_variables.txt (text/plain), 13.40 KiB.

[5 Aug 2010 20:48] Sven Sandberg
Script to generate list of errors.

Attachment: parse-option-xml (application/octet-stream, text), 10.19 KiB.

[5 Aug 2010 20:51] Sven Sandberg
To use the script:
 (1) Build a bzr source tree from scratch. (It is important that it is a
     bzr branch).
 (2) cd to the tree.
 (3) Pipe the option xml file to the script and wait for it to finish.
[23 Sep 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".