Bug#1089157: bookworm-pu: package tango/9.3.4+dfsg1-2+deb12u1

Santiago Ruano Rincón santiago at freexian.com
Fri Dec 6 11:52:04 GMT 2024


Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian.org at packages.debian.org
Usertags: pu
X-Debbugs-Cc: tango at packages.debian.org, Thomas Braun <thomas.braun at byte-physics.de>, Picca Frédéric-Emmanuel <picca at debian.org>
Control: affects -1 + src:tango

Dear Release Team,

Please consider this tango update for bookworm. It mainly fixes
https://bugs.debian.org/1062979, which breaks using the tango DB, due to
incompatibilities with MariaDB 10.11, the version packaged in bookworm.
This has been broken since the bookworm release.

As a minor side change, it changes the Salsa CI configuration to run the
pipeline on the correct release: bookworm instead of experimental.

[ Impact ]
As #1062979 describes, tango features, functions or tools (such as
tango-starter or tango-admin) relying on the mariadb database will
continue to be unable to start or use the database.

[ Tests ]
I reproduced the issue and verified the fix just installing tango-db,
tango-accesscontrol and tango-starter along with mariadb-server in
bookworm. I have also tried using tango_admin to add a device property
in the database. The proposed changes include an autopkgtest that helps to
confirm the issue is fixed.

Without the fix: https://salsa.debian.org/science-team/tango/-/jobs/6707942
With the fix: https://salsa.debian.org/science-team/tango/-/jobs/6707881

[ Risks ]
Any non-identified risk of regression may be outweighed by being able to
start tango-starter and/or using the tango database.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

A preliminary fix was included in unstable with 9.4.2+dfsg1-1:
https://tracker.debian.org/news/1451906/accepted-tango-942dfsg1-1-source-into-unstable/
and the complete upstream patch in experimental with 10.0.0+dfsg1-1~exp2
(now in unstable, since 10.0.0+dfsg1-1):
https://tracker.debian.org/news/1583619/accepted-tango-1000dfsg1-1exp2-source-into-experimental/

[ Changes ]
The proposed update is made of the following changes:

* debian/patches/0001-Fix-timestamp-columns-in-Mariadb-10.11-and-newer.patch
As tagged in the patch, this is based on the upstream fix (merged) to
address the issue. It is a backport of
https://gitlab.com/tango-controls/TangoDatabase/-/merge_requests/95,
removing the parts that cannot be applied in tango 9.3.4. The git commit
message is self-explaining:

    Subject: [PATCH] Fix timestamp columns in Mariadb 10.11 and newer
    ...

    This problem appears in MariaDb 10.11 since default value of
    explicit_defaults_for_timestamp changed from OFF to ON, setting it to
    OFF (set global explicit_defaults_for_timestamp=OFF;) make the
    create_db_tables.sql.in work properly.

* debian/dbconfig-common/data/tango-db/upgrade/mysql/9.3.4
Applies similar changes in the existing tango database than those from
the patch above, at upgrade time. 

* debian/tests/starter-basic
autopkgtest that helps to verify that tango-starter can effectively
start. tango-starter needs to register the Starter device in the tango
database, which is done in bookworm by the tango-starter's init.d,
using tango_admin:

    do_start()
            ...
            # register the tango-starter if necessary
            tango_admin --check-device tango/admin/`hostname` || tango_admin --add-server Starter/`hostname` Starter tango/admin/`hostname` || return 2
            ...

Moreover, the autopkgtest also verifies it the database can be used,
adding a device property:

    # test https://bugs.debian.org/1062979:
    #
    tango_admin --add-property sys/tg_test/1 key value
    ...

as suggested by Thomas in https://bugs.debian.org/1062979#39

* debian/gitlab-ci.yml	
This changes the configured RELEASE from experimental to bookworm.
I (also) relied on Salsa CI for testing the update, and without this
change, for any future proposal, the Salsa CI user would need to
manually override the RELEASE variable, as I had to do.

[ Other info ]
None.

Thank in advance,

 -- Santiago
-------------- next part --------------
diff -Nru tango-9.3.4+dfsg1/debian/changelog tango-9.3.4+dfsg1/debian/changelog
--- tango-9.3.4+dfsg1/debian/changelog	2022-11-11 14:59:16.000000000 -0300
+++ tango-9.3.4+dfsg1/debian/changelog	2024-12-04 23:30:01.000000000 -0300
@@ -1,3 +1,16 @@
+tango (9.3.4+dfsg1-2+deb12u1) bookworm; urgency=medium
+
+  * Team upload
+  * Make the property_* tables compatible with MariaDB 10.11 at install time.
+    Thanks to Thomas Braun. Also update table modifications accordingly in
+    dbconfig-common when upgrading from 9.3.4 (Closes: #1062979).
+  * Add d/tests/starter-basic, including a test for #1062979.
+  * Switch Salsa CI RELEASE variable from experimental to bookworm. Otherwise,
+    Salsa CI runs the pipeline on experimental, and it has to be manually
+    overriden.
+
+ -- Santiago Ruano Rincón <santiago at freexian.com>  Wed, 04 Dec 2024 23:30:01 -0300
+
 tango (9.3.4+dfsg1-2) unstable; urgency=medium
 
   [ Picca Frédéric-Emmanuel ]
diff -Nru tango-9.3.4+dfsg1/debian/dbconfig-common/data/tango-db/upgrade/mysql/9.3.4 tango-9.3.4+dfsg1/debian/dbconfig-common/data/tango-db/upgrade/mysql/9.3.4
--- tango-9.3.4+dfsg1/debian/dbconfig-common/data/tango-db/upgrade/mysql/9.3.4	2022-11-10 09:09:20.000000000 -0300
+++ tango-9.3.4+dfsg1/debian/dbconfig-common/data/tango-db/upgrade/mysql/9.3.4	2024-12-04 23:30:01.000000000 -0300
@@ -15,3 +15,15 @@
 
 DELETE FROM property_class WHERE class='DServer' AND count >= 11;
 INSERT INTO property_class VALUES('DServer','AllowedAccessCmd',11,'EventConfirmSubscription',NOW(),NOW(),NULL);
+
+#
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1062979
+#
+
+ALTER TABLE property_hist MODIFY date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
+ALTER TABLE property_device_hist MODIFY date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
+ALTER TABLE property_class_hist MODIFY date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
+ALTER TABLE property_attribute_class_hist MODIFY date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
+ALTER TABLE property_attribute_device_hist MODIFY date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
+ALTER TABLE property_pipe_class_hist MODIFY date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
+ALTER TABLE property_pipe_device_hist MODIFY date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
diff -Nru tango-9.3.4+dfsg1/debian/gitlab-ci.yml tango-9.3.4+dfsg1/debian/gitlab-ci.yml
--- tango-9.3.4+dfsg1/debian/gitlab-ci.yml	2022-11-10 09:09:20.000000000 -0300
+++ tango-9.3.4+dfsg1/debian/gitlab-ci.yml	2024-12-04 23:30:01.000000000 -0300
@@ -3,4 +3,4 @@
   - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
 
 variables:
-  RELEASE: 'experimental'
+  RELEASE: 'bookworm'
diff -Nru tango-9.3.4+dfsg1/debian/patches/0001-Fix-timestamp-columns-in-Mariadb-10.11-and-newer.patch tango-9.3.4+dfsg1/debian/patches/0001-Fix-timestamp-columns-in-Mariadb-10.11-and-newer.patch
--- tango-9.3.4+dfsg1/debian/patches/0001-Fix-timestamp-columns-in-Mariadb-10.11-and-newer.patch	1969-12-31 21:00:00.000000000 -0300
+++ tango-9.3.4+dfsg1/debian/patches/0001-Fix-timestamp-columns-in-Mariadb-10.11-and-newer.patch	2024-12-04 23:30:01.000000000 -0300
@@ -0,0 +1,94 @@
+From 8e1f9ec9b0b3346d65d20e791391bb3a9594a256 Mon Sep 17 00:00:00 2001
+From: Thomas Braun <thomas.braun at byte-physics.de>
+Date: Sun, 27 Oct 2024 11:29:44 +0100
+Subject: [PATCH] Fix timestamp columns in Mariadb 10.11 and newer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This problem appears in MariaDb 10.11 since default value of
+explicit_defaults_for_timestamp changed from OFF to ON, setting it to
+OFF (set global explicit_defaults_for_timestamp=OFF;) make the
+create_db_tables.sql.in work properly.
+
+Initial patch by Santiago Ruano Rincón with refinements by Graziano
+Scalamera.
+
+Upgrade script and tests by the author.
+
+Origin: backport, https://gitlab.com/tango-controls/TangoDatabase/-/merge_requests/95
+---
+ configure/CMakeLists.txt           |  1 +
+ create_db_tables.sql.in            | 14 +++++++-------
+ test/test.cpp                      | 27 +++++++++++++++++++++++++++
+ update_db_from_5.23_to_5.24.sql.in | 11 +++++++++++
+ 4 files changed, 46 insertions(+), 7 deletions(-)
+ create mode 100644 update_db_from_5.23_to_5.24.sql.in
+
+Index: tango/cppserver/database/create_db_tables.sql.in
+===================================================================
+--- tango.orig/cppserver/database/create_db_tables.sql.in
++++ tango/cppserver/database/create_db_tables.sql.in
+@@ -256,7 +256,7 @@ CREATE TABLE IF NOT EXISTS object_histor
+ 
+ CREATE TABLE IF NOT EXISTS property_hist (
+   id bigint unsigned NOT NULL default '0',
+-  date timestamp NOT NULL,
++  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+   object varchar(255) NOT NULL default '',
+   name varchar(255) NOT NULL default '',
+   count int(11) NOT NULL default '0',
+@@ -268,7 +268,7 @@ CREATE TABLE IF NOT EXISTS property_hist
+ 
+ CREATE TABLE IF NOT EXISTS property_device_hist (
+   id bigint unsigned NOT NULL default '0',
+-  date timestamp NOT NULL,
++  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+   device varchar(255) NOT NULL default '',
+   name varchar(255) NOT NULL default '',
+   count int(11) NOT NULL default '0',
+@@ -280,7 +280,7 @@ CREATE TABLE IF NOT EXISTS property_devi
+ 
+ CREATE TABLE IF NOT EXISTS property_class_hist (
+   id bigint unsigned NOT NULL default '0',
+-  date timestamp NOT NULL,
++  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+   class varchar(255) NOT NULL default '',
+   name varchar(255) NOT NULL default '',
+   count int(11) NOT NULL default '0',
+@@ -292,7 +292,7 @@ CREATE TABLE IF NOT EXISTS property_clas
+ 
+ CREATE TABLE IF NOT EXISTS property_attribute_class_hist (
+   id bigint unsigned NOT NULL default '0',
+-  date timestamp NOT NULL,
++  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+   class varchar(255) NOT NULL default '',
+   attribute varchar(255) NOT NULL default '',
+   name varchar(255) NOT NULL default '',
+@@ -306,7 +306,7 @@ CREATE TABLE IF NOT EXISTS property_attr
+ 
+ CREATE TABLE IF NOT EXISTS property_attribute_device_hist (
+   id bigint unsigned NOT NULL default '0',
+-  date timestamp NOT NULL,
++  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+   device varchar(255) NOT NULL default '',
+   attribute varchar(255) NOT NULL default '',
+   name varchar(255) NOT NULL default '',
+@@ -320,7 +320,7 @@ CREATE TABLE IF NOT EXISTS property_attr
+ 
+ CREATE TABLE IF NOT EXISTS property_pipe_class_hist (
+   id bigint unsigned NOT NULL default '0',
+-  date timestamp NOT NULL,
++  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+   class varchar(255) NOT NULL default '',
+   pipe varchar(255) NOT NULL default '',
+   name varchar(255) NOT NULL default '',
+@@ -334,7 +334,7 @@ CREATE TABLE IF NOT EXISTS property_pipe
+ 
+ CREATE TABLE IF NOT EXISTS property_pipe_device_hist (
+   id bigint unsigned NOT NULL default '0',
+-  date timestamp NOT NULL,
++  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+   device varchar(255) NOT NULL default '',
+   pipe varchar(255) NOT NULL default '',
+   name varchar(255) NOT NULL default '',
diff -Nru tango-9.3.4+dfsg1/debian/patches/series tango-9.3.4+dfsg1/debian/patches/series
--- tango-9.3.4+dfsg1/debian/patches/series	2022-11-10 09:09:20.000000000 -0300
+++ tango-9.3.4+dfsg1/debian/patches/series	2024-12-04 23:30:01.000000000 -0300
@@ -1,3 +1,4 @@
 0001-debian-fix_database_scripts.patch
 0002-debian-my.cnf.in.patch
 0003-doc-not-install-doc-with-make-install.patch
+0001-Fix-timestamp-columns-in-Mariadb-10.11-and-newer.patch
diff -Nru tango-9.3.4+dfsg1/debian/tests/control tango-9.3.4+dfsg1/debian/tests/control
--- tango-9.3.4+dfsg1/debian/tests/control	1969-12-31 21:00:00.000000000 -0300
+++ tango-9.3.4+dfsg1/debian/tests/control	2024-12-03 15:03:01.000000000 -0300
@@ -0,0 +1,7 @@
+Tests:
+ starter-basic,
+Depends:
+ mariadb-server,
+ @,
+Restrictions:
+ needs-root,
diff -Nru tango-9.3.4+dfsg1/debian/tests/starter-basic tango-9.3.4+dfsg1/debian/tests/starter-basic
--- tango-9.3.4+dfsg1/debian/tests/starter-basic	1969-12-31 21:00:00.000000000 -0300
+++ tango-9.3.4+dfsg1/debian/tests/starter-basic	2024-12-04 23:30:01.000000000 -0300
@@ -0,0 +1,50 @@
+#!/usr/bin/sh
+
+set -e
+
+. /etc/tangorc
+
+HOST=$(echo $TANGO_HOST | sed -e "s/:[[:digit:]]*//")
+
+pstree
+
+# These stops and starts seem to be needed, as a work around.
+# The first time tango-starter starts, there is an ENOENT, even if the service
+# seems active.
+#
+# See https://gitlab.com/tango-controls/starter/-/issues/25#note_1499130131
+
+systemctl stop tango-starter
+systemctl stop tango-accesscontrol
+systemctl stop tango-db
+
+sleep 3
+
+systemctl start tango-db
+
+sleep 5
+
+systemctl start tango-accesscontrol
+
+sleep 5
+
+systemctl restart tango-starter
+
+# Give *enough* time to Starter for being able to be ping'ed
+sleep 10
+
+pstree
+
+tango_admin --ping-device dserver/Starter/${HOST}
+
+# test https://bugs.debian.org/1062979:
+#
+tango_admin --add-property sys/tg_test/1 key value
+
+# check if the property was actually inserted in the related table:
+#
+mysql -u root -D tango --disable-column-names --silent \
+    --execute "SELECT IFNULL( (SELECT device FROM property_device_hist \
+      WHERE device = 'sys/tg_test/1' AND name = 'key' AND value = 'value' \
+      LIMIT 1) ,'not found');" \
+    | grep -v "not found"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20241206/14201a43/attachment-0001.sig>


More information about the debian-science-maintainers mailing list