• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

Resolved Plesk repair DB - Bug

Tozz

Regular Pleskian
Plesk Onyx - Latest version with all updates installed; Debian 8 or Debian 9.

SYMPTOM:

If "plesk repair db" finds clients with a Pool ID 0 it returns a message that there is no IP Pool with ID 0. It asks the admin if it should create that IP Pool with ID 0.

EXPECTED RESULT:

plesk repair db should change the pool_id in the clients table, not create the pool as ID value of zero is invalid

ACTUAL RESULT:

New IP pool with an invalid value is created.

The 'ip_pool' table has the following layout:

Code:
MariaDB [psa]> describe ip_pool;     
+---------------+----------------------------+------+-----+---------+----------------+
| Field         | Type                       | Null | Key | Default | Extra          |
+---------------+----------------------------+------+-----+---------+----------------+
| id            | int(10) unsigned           | NO   | PRI | NULL    | auto_increment |
| ip_address_id | int(10) unsigned           | NO   | PRI | NULL    |                |
| type          | enum('shared','exclusive') | NO   |     | shared  |                |
+---------------+----------------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

A column with an auto_increment value CAN NOT have a value of 0, unless MySQL is explicitly configured to allow the value zero in an auto_increment column. Plesk doensn't set this parameter in MySQL.

Thus, as a result nothing happens:

Code:
MariaDB [psa]> insert into ip_pool values(0, 1, 'shared');
Query OK, 1 row affected (0.00 sec)

MariaDB [psa]> delete from ip_pool where id = 0;
Query OK, 0 rows affected (0.00 sec)

MariaDB [psa]> insert into ip_pool values(0, 999, 'exclusive');   
Query OK, 1 row affected (0.00 sec)

MariaDB [psa]> select * from ip_pool where ip_address_id = 999;
+------+---------------+-----------+
| id   | ip_address_id | type      |
+------+---------------+-----------+
| 1046 |           999 | exclusive |
+------+---------------+-----------+
1 row in set (0.00 sec)

As one can see, MySQL sees the value '0' as NULL, which means instead of saving the value 0 it just uses the next auto increment counter as value.
 
Back
Top