[VID] moving vid DB to shared mariadb db causes errors


Rajendra Prasad Mishra
 

Hi,
   I am working on a change to move VID galera DB to shared mariadb instance.  (https://jira.onap.org/browse/OOM-1226)
The change is to use the "common/mariadb-init" code to create a DB instance and then use that in VID (like it is done for other components like SO, SDNC, NBI etc.) 
Since VID creates DB tables at init time, we extended the "common/mariadb-init" code to take an extra script (through configMap) which will be run after the DB has been created.
The patch for the change is located here (https://gerrit.onap.org/r/c/oom/+/112075 )

After applying the patch, VID no longer creates its own DB and we pass the shared DB details to the VID deployment.
On installation, I can also see that all the VID tables have been created in the shared DB.

However, in the log I see failures for some DB tables not being present. VID Healthcheck is also failing. Full log is attached with the mail. Here is the relevant part.
-----
13:17:42.823 [schedulerFactoryBean_Worker-3] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - (conn:24171) Table 'vid_openecomp_epsdk.VID_JOB' doesn't exist
Query is: select * from VID_JOB where    JOB_STATUS = 'IN_PROGRESS'    and TAKEN_BY is null    and DELETED_AT is null     and BUILD = '6.0.4..315' and MODIFIED_DATE <= '2020-09-16 13:17:41.180451' order by MODIFIED_DATE ASC limit 1
----

When I look at the mysql tables I see a table  "vid_job" is present.

--------
aarna@anod-master:~/oom/kubernetes$ kubectl exec -it -n onap dev-mariadb-galera-0 -- /bin/bash
bash-4.2$ mysql -uvidadmin -pNuppBoqtJume7$
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 24643
Server version: 10.1.24-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use vid_openecomp_epsdk;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [vid_openecomp_epsdk]> select * from vid_job;
Empty set (0.00 sec)

MariaDB [vid_openecomp_epsdk]>
-----------

So my question is

1. When we use a non shared DB in VID (as is now), where do we create these tables ?
2. Are there any settings or table creations that we need to pick from "docker-entrypoint.sh" for the VID DB. Right now I picked only the "db_cmd.sh" and "vid-pre-init.sql" from "vid/resources/config"

Any pointers will be very helpful.

thanks,
-RP Mishra