HDB++ usage and subscriber errors

Dear all,

I write to ask your help on how to use the new HDB++ archiver (https://github.com/tango-controls-hdbpp).
First of all could you please confirm I followed the correct procedure to install and configure it.
I'm using Tango version v9.2.5a to build archiver sources.

=====================================
== INSTALL ==
=====================================
1) Download latest version of libhdb++, libhdb++-mysql, hdbpp-es & hdbpp-cm Tango devices from repositories at https://github.com/tango-controls-hdbpp.
2) Build libhdb++, libhdb++-mysql libraries from source
3) Build Tango device sources.

========================================
== CREATE ARCHIVE MYSQL DB ==
========================================
1) Create a MySQL archiver user, password and DB, say;
user=hdb_archiver
pass=hdb
DB=hdb_archive
2) Run the MySQL script create_hdb++_mysql.sql provided in libhdb++-mysql etc/ folder, e.g.
mysql> use hdb_archive;
mysql> source create_hdb++_mysql.sql;

The only modification I needed to apply was to add at the beginning of the sql script:

SET SQL_MODE='ALLOW_INVALID_DATES';

otherwise mysql complains about the timestamp default.

=====================================
== CONFIGURE SUBSCRIBER
=====================================
I'm using Jive to setup just one archived attribute (not using the Configurator device & gui for the moment)

1) Register a subscriber device in TangoDB, say it is named: dev/hdb++es/1
2) Configure the LibConfiguration property as follows:

host=localhost
user=lmc-archiver
password=hdb
dbname=hdb_archive
port=3306
libname=libhdb++mysql.so (please note that the libname is needed and not specified in the documentation)

3) Configure an Attribute to be archived in AttributeList property:

tango://riggi-tpt460:10000/mid_dish_0001/spfrx/emulator/operatingMode;strategy=ALWAYS;ttl=0

This attribute has periodic archive event set. I verified that I'm able to receive these events using a pytango script.

4) Set the device property StartArchivingAtStartup=true (or alternatively use the command AttributeStart() to start archiving)

5) Run the subscriber device (along with the device with attribute to be archived)

=======================================================================================

Hoping that I have done all the steps correctly, here are the errors I'm obtaining:


1513343354 [140485989226304] INFO dev/hdb++es/1 HdbEventSubscriber id=0
1513343354 [140485989226304] INFO dev/hdb++es/1 HdbDevice::get_hdb_signal_list: 0: tango://riggi-TPT460:10000/mid_dish_0001/spfrx/emulator/operatingmode;strategy=ALWAYS;ttl=0
Starting version: 1.0.0:2017-12-14 17:42:23
db_conf key=dbname, value=hdb_archive
db_conf key=host, value=localhost
db_conf key=libname, value=libhdb++mysql.so
db_conf key=password, value=hdb
db_conf key=port, value=3306
db_conf key=user, value=lmc-archiver
1513343354 [140485620393728] INFO dev/hdb++es/1 PollerThread id=9
add_domain: found domain -> riggi-TPT460:10000
1513343354 [140485603608320] INFO dev/hdb++es/1 CheckPeriodicThread delay_tolerance_ms=5000 id=10
1513343354 [140485612001024] INFO dev/hdb++es/1 SubscribeThread id=6
updateTTL_Attr: ERROR riggi-TPT460:10000/mid_dish_0001/spfrx/emulator/operatingmode NOT FOUND
ERROR dev/hdb++es/1 PushThread::run_undetached: An was error detected when updating the TTL on attribute: tango://riggi-TPT460:10000/mid_dish_0001/spfrx/emulator/operatingmode
Tango exception
Severity = ERROR 
Error reason = Data Error
Desc : ERROR riggi-TPT460:10000/mid_dish_0001/spfrx/emulator/operatingmode NOT FOUND
Origin : updateTTL_Attr
segmentation

The segmentation at the end I think is caused by the line

ERROR_STREAM << "PushThread::run_undetached: An was error detected when updating the TTL on attribute: " << cmd->ev_data->attr_name << endl;

in PushThread class. I verified with valgrind that there is a invalid read on that, so replaced cmd->ev_data->attr_name with cmd->attr_name in print line. Now the device becomes ready for request and runs without crashing.

Apart from this error (which affects also other logging statements of run_undetached method)
when I try to start archiving I get:


1513343520 [139814657578752] ERROR dev/hdb++es/1 push_event: Event 'tango://riggi-TPT460:10000/mid_dish_0001/spfrx/emulator/operatingmode' NOT FOUND in signal list
1513343520 [139814657578752] ERROR dev/hdb++es/1 push_event: AttrConfEvent 'tango://riggi-TPT460:10000/mid_dish_0001/spfrx/emulator/operatingmode' NOT FOUND in signal list
1513343520 [139814624007936] ERROR dev/hdb++es/1 push_event: Event 'tango://riggi-TPT460:10000/mid_dish_0001/spfrx/emulator/operatingmode' NOT FOUND in signal list
1513343521 [139814624007936] ERROR dev/hdb++es/1 push_event: Event 'tango://riggi-TPT460:10000/mid_dish_0001/spfrx/emulator/operatingmode' NOT FOUND in signal list
1513343522 [139814624007936] ERROR dev/hdb++es/1 push_event: Event 'tango://riggi-TPT460:10000/mid_dish_0001/spfrx/emulator/operatingmode' NOT FOUND in signal list
1513343523 [139814624007936] ERROR dev/hdb++es/1 push_event: Event 'tango://riggi-TPT460:10000/mid_dish_0001/spfrx/emulator/operatingmode' NOT FOUND in signal list
…
…

I do not understand what I'm missing or doing wrong.
It seems that nothing is written in the DB because the tables are empty and queries are returning that attribute does not exist in DB, e.g. HdbPPMySQL::find_attr_id() returns -1.

I'm pretty sure I'm missing something here or doing wrong.
Can you help me to understand the problem?

Many thanks,

Simone

****************************************************************
Simone Riggi
INAF, Osservatorio Astrofisico di Catania
Via S. Sofia 78
95123, Catania - Italy
phone: +39 095 7332 extension 282
e-mail: simone.riggi@gmail.com,
sriggi@oact.inaf.it
skype: simone.riggi
****************************************************************
Hi Simone,

You must use the HDB++ Configuration Manager device in order to be able to configure the attributes you want to archive properly.
Adding the attributes to the properties of the HDBEventSubscriber devices is not enough.
The HDBConfigurationManager (and ConfiguratorGUI) are there to help you on this task.
This is important because the HDB++ Configuration Manager device will actually store some configuration parameters into some special tables in HDB++ database.
If this step is skipped, the archivers (subscribers) won't be able to store the data in the database. This is why you are getting the "Event 'tango://….' NOT FOUND in signal list" errors.
So you must use the HDBConfigurationManager device (and the GUI helps a lot to simplify your life when using it).

Hoping this helps,
Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
I created the 2 following issues to remind us to fix the 2 other issues you encountered:
https://github.com/tango-controls-hdbpp/libhdbpp-mysql/issues/3
https://github.com/tango-controls-hdbpp/hdbpp-es/issues/6

Do not hesitate to create issues on Github directly when you find some bugs or even better to propose some Pull Requests smile.
If you don't know where to create the issue because you don't know what Github repository is responsible for the bug, you can create an issue on https://github.com/tango-controls/TangoTickets github repository. Someone will then take care of redirecting the issue to the proper repository(ies).

Kind regards,
Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Dear Reynald,

thanks a lot for your help. I will try to use the configurator or the GUI.
By looking at the configurator code (if I'm not wrong) the DB configuration part you mention is done in the attribute_add() command:

mdb->configure_Attr(…)

Another question was on the subscriber's property StartArchivingAtStartup. Is that used or should I call AttributeStart() to start the archiving?

Many thanks again,

Cheers,

Simone
****************************************************************
Simone Riggi
INAF, Osservatorio Astrofisico di Catania
Via S. Sofia 78
95123, Catania - Italy
phone: +39 095 7332 extension 282
e-mail: simone.riggi@gmail.com,
sriggi@oact.inaf.it
skype: simone.riggi
****************************************************************
sriggi
Dear Reynald,

By looking at the configurator code (if I'm not wrong) the DB configuration part you mention is done in the attribute_add() command:
mdb->configure_Attr(…)

Indeed!

sriggi
Another question was on the subscriber's property StartArchivingAtStartup. Is that used or should I call AttributeStart() to start the archiving?

In recent versions of the subscriber, this property has been removed.
I think it has been removed when the archiving contexts and strategies concept has been introduced.
In recent versions, the subscriber will automatically start archiving at startup all the attributes which need to be archived in the current context and only these attributes, until the context changes.
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Reynald
In recent versions of the subscriber, this property has been removed.
I think it has been removed when the archiving contexts and strategies concept has been introduced.
In recent versions, the subscriber will automatically start archiving at startup all the attributes which need to be archived in the current context and only these attributes, until the context changes.

The original purpose was to possibly tell the archivers to startup but not start archiving. It is usefun to troubleshoot some transitary behaviour during archiver startup, or just to have all the DS up and running but not hitting the back-end. The same you can configure now setting appropriately the context, but this means changing the current configuration… so not *exactly* the same.
Thanks Reynald & Lorenzo for the useful information.
I think I managed to have the first attribute archived in the mysql backend.
The only problems I have encountered are:

- In the SubscribeThread class (get_signal() –> hdb_dev->compare_without_domain()) when comparing signal attr name with those present in the backend you always get a failed comparison (e.g. signal not found). The comparison is case sensitive, so, when TANGO_HOST has capital letters inside, the comparison fails because on the backend the name is stored with capital letters (if I'm not wrong) while the event is lower-case. At the end you get an error message saying that the event is NOT found. I made a dirty and temporary fix by changing both names in lower-case inside the comparison method compare_without_domain().
- I am not able to view archived attr in the Hdd java viewer. I see attributes stored in the att_scalar_devenum_rw mysql table (my attribute is an enum). I will check better if I'm not doing trivial mistakes, but just to be sure could you in case confirm if the HdbViewer is supposed to work with the new Hdb?

Thanks again for your support,

Simone
****************************************************************
Simone Riggi
INAF, Osservatorio Astrofisico di Catania
Via S. Sofia 78
95123, Catania - Italy
phone: +39 095 7332 extension 282
e-mail: simone.riggi@gmail.com,
sriggi@oact.inaf.it
skype: simone.riggi
****************************************************************
Hi Simone,

As far as I remember, on the backend, the name is stored in lower case if you are using the Configuration Manager or libhdb++ C++ libraries to configure the attributes to be stored in HDB++.
At least it is like that with the Cassandra back-end.
Did you use the HDB++ Configuration Manager device / HDB++ Configuration GUI to add an entry in att_conf table or did you add it manually?

About your question related to the HDB++ Viewer in Java, I actually wouldn't be surprised if the enum type were not supported by the viewer.
As far as I know, this type is still not supported for the Cassandra back-end.
It is planned to add support for DevEnum of course.
When looking at your post, it looks like the HDB++ MySQL archivers are supporting the DevEnum now, since you're seeing data archived in att_scalar_devenum_rw table… But maybe the viewer is still a bit behind on this topic…

I'm sure Jean-Luc will be able to give us more details and to improve the viewer if needed.

Kind regards,
Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Hi Simone,
just one more comment. Hostnames, as per the RFC, is supposed to be case-insensitive, but is really reccommended, and good practice, to always use lower-case in hostnames and domain-names.
Lorenzo
Hello,
DevEnum is not yet supported in the Java HDB++ java Viewer neither in the java extraction API.
I'll add it ASAP.
Jean-Luc
 
Register or login to create to post a reply.