[MDEV-22243] type_test.type_test_double fails with 'NUMERIC_SCALE NULL' Created: 2020-04-14  Updated: 2023-11-19  Resolved: 2023-10-09

Status: Closed
Project: MariaDB Server
Component/s: Tests
Affects Version/s: 10.5.2, 11.0
Fix Version/s: 10.5.23, 10.6.16, 10.10.7, 10.11.6, 11.0.4, 11.1.3, 11.2.2

Type: Bug Priority: Minor
Reporter: Otto Kekäläinen Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None


 Description   

Noticed in http://buildbot.askmonty.org/buildbot/builders/kvm-deb-bionic-amd64/builds/4415/steps/mtr/logs/stdio:

type_test.type_test_double               w4 [ fail ]
        Test ended at 2020-04-14 08:20:04
 
CURRENT_TEST: type_test.type_test_double
--- /usr/share/mysql/mysql-test/plugin/type_test/type_test/type_test_double.result	2020-04-14 05:32:13.000000000 -0400
+++ /dev/shm/var/4/log/type_test_double.reject	2020-04-14 08:20:04.455194071 -0400
@@ -290,7 +290,7 @@
 CHARACTER_MAXIMUM_LENGTH	NULL
 CHARACTER_OCTET_LENGTH	NULL
 NUMERIC_PRECISION	22
-NUMERIC_SCALE	31
+NUMERIC_SCALE	NULL
 DATETIME_PRECISION	NULL
 CHARACTER_SET_NAME	NULL
 COLLATION_NAME	NULL
 
mysqltest: Result length mismatch

On current 10.5 master this test is not at all visible (e.g. http://buildbot.askmonty.org/buildbot/builders/kvm-deb-bionic-amd64/builds/4413/steps/mtr/logs/stdio) because Debian packaging was omitting usr/lib/mysql/plugin/type_test.so and this test did simply not run before.



 Comments   
Comment by Otto Kekäläinen [ 2020-04-23 ]

The PR https://github.com/MariaDB/server/pull/1506 will be pending until this is fixed.

Comment by Vicențiu Ciorbaru [ 2020-04-29 ]

Investigation so far:

This is reproducible in a docker container with ubuntu:bionic, compile with debian/autobake-dev.sh.

The value of NULL/31 comes from sql/sql_show.cc:5722

  Information_schema_numeric_attributes num=
    field->information_schema_numeric_attributes();

More specifically from Field_real::information_schema_numeric_attributes:

    information_schema_numeric_attributes() const override
  {
    return dec == NOT_FIXED_DEC ?
                  Information_schema_numeric_attributes(field_length) :
                  Information_schema_numeric_attributes(field_length, dec);
  }

If one looks at NOT_FIXED_DEC, it is defined in my_global.h as:

#define FLOATING_POINT_DECIMALS 31
 
/* Keep client compatible with earlier versions */
#ifdef MYSQL_SERVER
#define NOT_FIXED_DEC           DECIMAL_NOT_SPECIFIED
#else
#define NOT_FIXED_DEC           FLOATING_POINT_DECIMALS
#endif
#endif /* my_global_h */

Some background about this switch provided by serg:
because NOT_FIXED_DEC used to be 31, and was stored in 5 bits. And it affects both the server and clients. When Monty made it 39 in the server, he kepts the backward compatible define for clients to not change the client-server api

The difference in test results is because in one case NOT_FIXED_DEC is set to DECIMAL_NOT_SPECIFIED, while during debian compilation it's set to FLOATING_POINT_DECIMALS, which happens to equal the actual precision of 31 that the field's "dec" variable is set to.

The test failure can be resolved by doing a #define MYSQL_SERVER in plugin/type_test/plugin.cc right before my_global.h include. This can't possible be correct as we're building a plugin, not the server. However it is unclear why during a build that does not involve debian packaging, the MYSQL_SERVER flag seems to be set to true when compiling this plugin.

Comment by Otto Kekäläinen [ 2023-03-19 ]

This test is still failing..

type_test.type_test_double               w4 [ fail ]
        Test ended at 2023-03-19 06:51:56
 
CURRENT_TEST: type_test.type_test_double
--- /<<PKGBUILDDIR>>/plugin/type_test/mysql-test/type_test/type_test_double.result	2021-06-18 13:08:00.000000000 +0000
+++ /<<PKGBUILDDIR>>/plugin/type_test/mysql-test/type_test/type_test_double.reject	2023-03-19 06:51:56.632819620 +0000
@@ -290,7 +290,7 @@
 CHARACTER_MAXIMUM_LENGTH	NULL
 CHARACTER_OCTET_LENGTH	NULL
 NUMERIC_PRECISION	22
-NUMERIC_SCALE	31
+NUMERIC_SCALE	NULL
 DATETIME_PRECISION	NULL
 CHARACTER_SET_NAME	NULL
 COLLATION_NAME	NULL
 
mysqltest: Result length mismatch

Full log at https://launchpadlibrarian.net/656603148/buildlog_ubuntu-lunar-amd64.mariadb_1%3A11.0.0~ubuntu23.04.1~1679205078.756e48c615d.ok.10.5.type.test_BUILDING.txt.gz

Comment by Nicholas Othieno [ 2023-06-05 ]

Manually tested on Ubuntu 20.04, and the test passed:

    ~/github/MariaDB/build-mariadb/mysql-test$ ./mariadb-test-run.pl /.../github/MariaDB/server/plugin/type_test/mysql-test/type_test/type_test_double.test
    Logging: /.../github/MariaDB/server/mysql-test/mariadb-test-run.pl  /.../github/MariaDB/server/plugin/type_test/mysql-test/type_test/type_test_double.test
    VS config: 
    vardir: /.../github/MariaDB/build-mariadb/mysql-test/var
    Removing old var directory...
    Creating var directory '/.../github/MariaDB/build-mariadb/mysql-test/var'...
    Checking supported features...
    MariaDB Version 11.1.0-MariaDB-debug
     - SSL connections supported
     - binaries are debug compiled
     - binaries built with wsrep patch
    Collecting tests...
    Installing system database...
     
    ==============================================================================
     
    TEST                                      RESULT   TIME (ms) or COMMENT
    --------------------------------------------------------------------------
     
    worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
    type_test.type_test_double               [ pass ]    120
    --------------------------------------------------------------------------
    The servers were restarted 0 times
    Spent 0.120 of 6 seconds executing testcases
     
    Completed: All 1 tests were successful.

Comment by Nicholas Othieno [ 2023-06-05 ]

Debian CI build log shows that the test runs and that it is passing.

Source: https://buildbot.mariadb.org/#/builders/35/builds/24954/steps/7/logs/stdio

worker[10] > Restart [mysqld.1 - pid: 234377, winpid: 234377] - running with different options '--query-cache-size=1355776' != '--plugin-load-add= --plugin-user-variables=ON'                                     
innodb.create_table_insert_skip_locked 'innodb' w6 [ pass ]      8                                                                                                                                                 
type_test.type_test_double               w4 [ pass ]    119                <------ Test ran and passed!!                                                                                                                                        
main.plugin_maturity                     w1 [ pass ]     17

Comment by Otto Kekäläinen [ 2023-07-28 ]

I confirm that the test is now passing on buildbot.mariadb.org, e.g. https://buildbot.mariadb.org/#/builders/534/builds/8085/steps/7/logs/stdio

type_test.type_test_double               w7 [ pass ]    239

Comment by Sergei Golubchik [ 2023-09-17 ]

otto, so shall https://github.com/MariaDB/server/pull/1506 be merged and this MDEV closed?

Comment by Otto Kekäläinen [ 2023-10-05 ]

PR https://github.com/MariaDB/server/pull/1506 was merged yesterday, thus going into version 11.3.0.

Comment by Otto Kekäläinen [ 2023-10-07 ]

After re-enabling the test if still fails with the exact same error on all tested architectures at https://launchpad.net/~otto/+archive/ubuntu/mariadb/+builds?build_text=&build_state=all

Comment by Michael Widenius [ 2023-10-09 ]

There where several reasons why the test failed:

  • Constructors for Field_double and Field_float changed an argument
    to the constructor instead of a the correct class variable.
  • gcc 7.5.0 produced wrong code when inlining Field_double constructor
    into Field_test_double constructor.

Fixed by changing the correct class variable and make the constructors
not inline to go around the gcc bug.

Comment by Otto Kekäläinen [ 2023-10-09 ]

I confirm https://github.com/MariaDB/server/commit/9d19b6526917c94ca03ef1b4c57152882b192cfe fixed this test failure - it is no longer visible on any of my test builds on Launchpad.

Generated at Thu Feb 08 09:13:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.