msql-4.2 bug with a second non uniq index and a where clause
Posted: Mon Apr 22, 2019 1:56 pm
Hello!
Please have a look at this strange behaviour using a second, non unique, index with a where clause. All required information is appended in an example.
As soon as index sgNode_Status is removed from the example table sgNode data are available again and vanish after recreating the index. Queries without a where clause are not affected.
Kind Regards
Stefan
root@q920:/tmp# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
root@q920:/tmp# date
Mo 22. Apr 15:29:43 CEST 2019
root@q920:/tmp# uname -a
Linux q920 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:40:37 UTC 2019 i686 i686 i686 GNU/Linux
root@q920:/tmp# /opt/msql4/bin/msqld &
[1] 20527
Mini SQL Version 4.2
Copyright (c) 1993-94 David J. Hughes
Copyright (c) 1995-2018 Hughes Technologies Pty Ltd.
All rights reserved.
Loading configuration from '/opt/msql4/etc/msql.conf'.
Server running as user 'daemon'.
Server mode is Read/Write.
Server process reconfigured to accept 254 connections.
Server table cache holds 16 entries.
Warning : No ACL file. Using global read/write access.
root@q920:/tmp# /opt/msql4/bin/msqladmin version
Version Details :-
msqladmin version 4.2
mSQL server version 4.2
mSQL protocol version 24
mSQL connection Localhost via UNIX socket
Target platform Linux-4.15.0-47-generic-i686
Configuration Details :-
Default config file /opt/msql4/msql.conf
TCP socket 1114
UNIX socket /opt/msql4/msql.sock
mSQL user daemon
Admin user root
Install directory /opt/msql4
PID file location /opt/msql4/msqld.pid
Memory Sync Timer 30
Hostname Lookup True
Backend Processes 3
root@q920:/tmp# /opt/msql4/bin/msqladmin stats
Server Statistics
-----------------
Mini SQL Version 4.2
Copyright (c) 1993-94 David J. Hughes
Copyright (c) 1995-2018 Hughes Technologies Pty Ltd.
All rights reserved.
Config file : /opt/msql4/etc/msql.conf
Max connections : 254
Cur connections : 1
Backend processes: 0
Running as user : daemon
Server uptime : 0 days, 0 hours, 0 mins, 3 secs
Connection count : 1
Connection table :
Sock Username Hostname Database Connect Idle Queries
+-----+------------+-----------------+------------+---------+------+--------+
| 6 | root | UNIX Sock | No DB | 432205H 2 | 0 | 0 |
+-----+------------+-----------------+------------+---------+------+--------+
root@q920:/tmp# /opt/msql4/bin/relshow
+---------------------------+
| Databases |
+---------------------------+
+---------------------------+
root@q920:/tmp# /opt/msql4/bin/msqladmin create Test
Database "Test" created.
root@q920:/tmp# /opt/msql4/bin/msql Test
Welcome to the miniSQL monitor. Type \h for help.
mSQL > CREATE TABLE sgNode (
Node CHAR(15) NOT NULL,
Status CHAR(10) NOT NULL
) \g
-> -> ->
Query OK. 1 row(s) modified or retrieved.
mSQL > CREATE UNIQUE INDEX sgNode_Node ON sgNode (
Node
) \g
-> ->
Query OK. 1 row(s) modified or retrieved.
# PROBLEMATIC SECOND INDEX
mSQL > CREATE INDEX sgNode_Status ON sgNode (Status)\g
Query OK. 1 row(s) modified or retrieved.
mSQL > INSERT INTO sgNode VALUES ('1.2.3.4','snmp')\g
Query OK. 1 row(s) modified or retrieved.
# EVERYTHING IS THERE
mSQL > SELECT * from sgNode\g
Query OK. 1 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
| 1.2.3.4 | snmp |
+-----------------+------------+
# BUT NOT IF USING WHERE
mSQL > SELECT * FROM sgNode WHERE Status='snmp'\g
Query OK. 0 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
+-----------------+------------+
# NOW REMOVE INDEX AND BOTH QUERIES ARE FINE
mSQL > DROP INDEX sgNode_Status FROM sgNode\g
Query OK. 1 row(s) modified or retrieved.
mSQL > SELECT * from sgNode\g
Query OK. 1 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
| 1.2.3.4 | snmp |
+-----------------+------------+
mSQL > SELECT * FROM sgNode WHERE Status='snmp'\g
Query OK. 1 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
| 1.2.3.4 | snmp |
+-----------------+------------+
#NOW RECREATE THE PROBLEM
mSQL > CREATE INDEX sgNode_Status ON sgNode (Status)\g
Query OK. 1 row(s) modified or retrieved.
mSQL > SELECT * from sgNode\g
Query OK. 1 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
| 1.2.3.4 | snmp |
+-----------------+------------+
# AND THE DATA VANISHES AGAIN
mSQL > SELECT * FROM sgNode WHERE Status='snmp'\g
Query OK. 0 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
+-----------------+------------+
mSQL > \q
Bye!
root@q920:/tmp#
Please have a look at this strange behaviour using a second, non unique, index with a where clause. All required information is appended in an example.
As soon as index sgNode_Status is removed from the example table sgNode data are available again and vanish after recreating the index. Queries without a where clause are not affected.
Kind Regards
Stefan
root@q920:/tmp# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
root@q920:/tmp# date
Mo 22. Apr 15:29:43 CEST 2019
root@q920:/tmp# uname -a
Linux q920 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:40:37 UTC 2019 i686 i686 i686 GNU/Linux
root@q920:/tmp# /opt/msql4/bin/msqld &
[1] 20527
Mini SQL Version 4.2
Copyright (c) 1993-94 David J. Hughes
Copyright (c) 1995-2018 Hughes Technologies Pty Ltd.
All rights reserved.
Loading configuration from '/opt/msql4/etc/msql.conf'.
Server running as user 'daemon'.
Server mode is Read/Write.
Server process reconfigured to accept 254 connections.
Server table cache holds 16 entries.
Warning : No ACL file. Using global read/write access.
root@q920:/tmp# /opt/msql4/bin/msqladmin version
Version Details :-
msqladmin version 4.2
mSQL server version 4.2
mSQL protocol version 24
mSQL connection Localhost via UNIX socket
Target platform Linux-4.15.0-47-generic-i686
Configuration Details :-
Default config file /opt/msql4/msql.conf
TCP socket 1114
UNIX socket /opt/msql4/msql.sock
mSQL user daemon
Admin user root
Install directory /opt/msql4
PID file location /opt/msql4/msqld.pid
Memory Sync Timer 30
Hostname Lookup True
Backend Processes 3
root@q920:/tmp# /opt/msql4/bin/msqladmin stats
Server Statistics
-----------------
Mini SQL Version 4.2
Copyright (c) 1993-94 David J. Hughes
Copyright (c) 1995-2018 Hughes Technologies Pty Ltd.
All rights reserved.
Config file : /opt/msql4/etc/msql.conf
Max connections : 254
Cur connections : 1
Backend processes: 0
Running as user : daemon
Server uptime : 0 days, 0 hours, 0 mins, 3 secs
Connection count : 1
Connection table :
Sock Username Hostname Database Connect Idle Queries
+-----+------------+-----------------+------------+---------+------+--------+
| 6 | root | UNIX Sock | No DB | 432205H 2 | 0 | 0 |
+-----+------------+-----------------+------------+---------+------+--------+
root@q920:/tmp# /opt/msql4/bin/relshow
+---------------------------+
| Databases |
+---------------------------+
+---------------------------+
root@q920:/tmp# /opt/msql4/bin/msqladmin create Test
Database "Test" created.
root@q920:/tmp# /opt/msql4/bin/msql Test
Welcome to the miniSQL monitor. Type \h for help.
mSQL > CREATE TABLE sgNode (
Node CHAR(15) NOT NULL,
Status CHAR(10) NOT NULL
) \g
-> -> ->
Query OK. 1 row(s) modified or retrieved.
mSQL > CREATE UNIQUE INDEX sgNode_Node ON sgNode (
Node
) \g
-> ->
Query OK. 1 row(s) modified or retrieved.
# PROBLEMATIC SECOND INDEX
mSQL > CREATE INDEX sgNode_Status ON sgNode (Status)\g
Query OK. 1 row(s) modified or retrieved.
mSQL > INSERT INTO sgNode VALUES ('1.2.3.4','snmp')\g
Query OK. 1 row(s) modified or retrieved.
# EVERYTHING IS THERE
mSQL > SELECT * from sgNode\g
Query OK. 1 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
| 1.2.3.4 | snmp |
+-----------------+------------+
# BUT NOT IF USING WHERE
mSQL > SELECT * FROM sgNode WHERE Status='snmp'\g
Query OK. 0 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
+-----------------+------------+
# NOW REMOVE INDEX AND BOTH QUERIES ARE FINE
mSQL > DROP INDEX sgNode_Status FROM sgNode\g
Query OK. 1 row(s) modified or retrieved.
mSQL > SELECT * from sgNode\g
Query OK. 1 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
| 1.2.3.4 | snmp |
+-----------------+------------+
mSQL > SELECT * FROM sgNode WHERE Status='snmp'\g
Query OK. 1 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
| 1.2.3.4 | snmp |
+-----------------+------------+
#NOW RECREATE THE PROBLEM
mSQL > CREATE INDEX sgNode_Status ON sgNode (Status)\g
Query OK. 1 row(s) modified or retrieved.
mSQL > SELECT * from sgNode\g
Query OK. 1 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
| 1.2.3.4 | snmp |
+-----------------+------------+
# AND THE DATA VANISHES AGAIN
mSQL > SELECT * FROM sgNode WHERE Status='snmp'\g
Query OK. 0 row(s) modified or retrieved.
+-----------------+------------+
| Node | Status |
+-----------------+------------+
+-----------------+------------+
mSQL > \q
Bye!
root@q920:/tmp#