Description:
The ndb_select_all utility has an option, -o/--order, that causes the utility to sort a table based on a given index. This option seems to behave in unexpected ways depending on where it's located in the command string and how it is used.
The documentation (and man page) for ndb_select_all claims that the long format of the option should be used with '=':
--order=index_name, -o index_name
Meanwhile, the --help output for the tool itself does not show '=' being used, though it does show '=' for other long-format options that take arguments:
-d, --database=name Name of database table is in
-o, --order Sort resultset according to index
-D, --delimiter=name
It appears that the --help output is "right" in the sense that a '=' between the option and its argument produces an error message, although the --help output does not of course give any indication that this option is positional.
How to repeat:
CREATE TABLE test.table1 (id int unsigned not null primary key) ENGINE=ndb;
INSERT INTO test.table1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
ndb_select_all -d test table1
ndb_select_all -o PRIMARY -d test table1
ndb_select_all --order PRIMARY -d test table1
ndb_select_all --order=PRIMARY -d test table1
ndb_select_all -d test table1 -o PRIMARY
ndb_select_all -d test table1 --order PRIMARY
ndb_select_all -d test table1 --order=PRIMARY
kolbe@clust01 (30.201) 7.2 $ ndb_select_all -d test table1
id
7
3
9
10
6
5
1
2
4
8
10 rows returned
NDBT_ProgramExit: 0 - OK
kolbe@clust01 (30.201) 7.2 $ ndb_select_all -o PRIMARY -d test table1
Table PRIMARY does not exist!
NDBT_ProgramExit: 2 - Wrong arguments
kolbe@clust01 (30.201) 7.2 $ ndb_select_all --order PRIMARY -d test table1
Table PRIMARY does not exist!
NDBT_ProgramExit: 2 - Wrong arguments
kolbe@clust01 (30.201) 7.2 $ ndb_select_all --order=PRIMARY -d test table1
Warning: ndb_select_all: ignoring option '--order' due to invalid value 'PRIMARY'
id
7
3
9
10
6
5
1
2
4
8
10 rows returned
NDBT_ProgramExit: 0 - OK
kolbe@clust01 (30.201) 7.2 $ ndb_select_all -d test table1 -o PRIMARY
id
1
2
3
4
5
6
7
8
9
10
10 rows returned
NDBT_ProgramExit: 0 - OK
kolbe@clust01 (30.201) 7.2 $ ndb_select_all -d test table1 --order PRIMARY
id
1
2
3
4
5
6
7
8
9
10
10 rows returned
NDBT_ProgramExit: 0 - OK
kolbe@clust01 (30.201) 7.2 $ ndb_select_all -d test table1 --order=PRIMARY
Warning: ndb_select_all: ignoring option '--order' due to invalid value 'PRIMARY'
id
7
3
9
10
6
5
1
2
4
8
10 rows returned
NDBT_ProgramExit: 0 - OK
Suggested fix:
The -o/--order option should not need to be specified at the end of an argument. It should accept (require?) a '=' like other long-format options that accept arguments.