← Back to team overview

maria-developers team mailing list archive

prefix matching for command-line options - how to disable?

 

Hi,

We've got a bit of a problem with command-line option prefixes in the
test suite. As you know, in MariaDB a command line option (the same
applies to my.cnf too) doesn't need to be specified completely, it's
sufficient to use an unambigous prefix of it.

For example, 'net-retry-count=5' in my.cnf can be abbreviated as
'net-ret=5'. But not as 'net-re=5', the latter will fail with an error

  mysqld: ambiguous option '--net-re' (net_read_timeout, net_retry_count)

This is the historical behavior of MySQL since about 2002.

But it creates problems for plugins. InnoDB is particularly badly
affected - it has lots of I_S plugins that are prefixes of other I_S
plugins. For example:

        INNODB_BUFFER_PAGE
        INNODB_BUFFER_PAGE_LRU
        ...
        INNODB_CMP
        INNODB_CMPMEM
        INNODB_CMPMEM_RESET
        INNODB_CMP_PER_INDEX
        INNODB_CMP_PER_INDEX_RESET
        INNODB_CMP_RESET
        ...
        INNODB_SYS_FOREIGN
        INNODB_SYS_FOREIGN_COLS
        ...
        INNODB_SYS_TABLES
        INNODB_SYS_TABLESPACES
        INNODB_SYS_TABLESTATS

also, it has plugins that match other plugin variables, like
INNODB_LOCKS and innodb_locks_unsafe_for_binlog.

As a result one cannot see or predict what these options will do.
For example --enable-innodb-buffer-page might enable INNODB_BUFFER_PAGE
plugin. Or it might enable INNODB_BUFFER_PAGE_LRU plugin - depending on
which plugin will loaded (and will see and consume the option) first.
And one cannot possibly disable INNODB_BUFFER_PAGE plugin, if the server
will try to load INNODB_BUFFER_PAGE_LRU first.

I see few solutions for this issue:

1. support a special suffix to option names that will disable prefix
   matching, for example:

    mysqld --enable-innodb-buffer-page!

   this will not match innodb-buffer-page-lru, so it's unambiguous. Of
   course, any dedicated character can be used, --enable-innodb-buffer-page$,
   or even a prefix --enable-exact-innodb-buffer-page,
   --enable-strict-innodb-buffer-page

2. add a special command-line option to disable prefix matching:

    mysqld --disable-getopt-prefix-matching --enable-innodb-buffer-page

3. do like mysql-5.7 is doing and completely remove support for prefix
   matching. In 5.7 one has to specified option names in full. I suspect
   that this is likely to break many exising setups.

Opinions? Anybody cares about this obscure issue at all?

Regards,
Sergei



Follow ups