Presentations on CTA Schema Upgrade Tools and Procedures

On Thursday we will have two presentations at CERN about the tools and procedures used to upgrade the CTA Catalogue DB schema. It may be of interest to external sites running CTA in production who will have to upgrade CTA. Details are in Indico.

Hi Michael,

Thanks for the presentations.

I was alluding to this:

[root@tpm102 ~]# cta-catalogue-schema-verify /etc/cta/cta-catalogue.conf
Schema version : 10.0
Checking indexes...
  SUCCESS
Checking tables, columns and constraints...
  ERROR: IN TABLE DISK_SYSTEM, CONSTRAINT DISK_SYSTEM_DIN_NN is missing in the schema but defined in the catalogue database.
  ERROR: IN TABLE DISK_SYSTEM, CONSTRAINT DISK_SYSTEM_DISN_NN is missing in the schema but defined in the catalogue database.
  ERROR: IN TABLE VIRTUAL_ORGANIZATION, CONSTRAINT VIRTUAL_ORGANIZATION_DIN_NN is missing in the schema but defined in the catalogue database.
  FAILED

So, the constraints have been dropped from schema but are still present on the upgrade scripts.

cheers,
Mwai

Thanks for reporting this.

This might be because Postgres has fixed a bug! Previously PostgreSQL could not return NOT NULL constraint names, so we implemented this workaround so that cta-catalogue-schema-verify would pass:

std::list<std::string> SchemaMetadataGetter::getConstraintNames(const std::string& tableName) {
  std::list<std::string> constraintNames = m_sqliteDatabaseMetadataGetter->getConstraintNames(tableName);
  if(m_dbType == cta::rdbms::Login::DbType::DBTYPE_POSTGRESQL){
    //If the database to compare is POSTGRESQL, we cannot compare NOT NULL CONSTRAINT names
    //indeed, POSTGRESQL can not give the NOT NULL constraint names
    removeObjectNameMatches(constraintNames,cta::utils::Regex("(^NN_)|(_NN$)"));
  }
  return constraintNames;
}

If PostgreSQL does now return NOT NULL constraints, we can remove the workaround and the test should pass!

Please can you let us know your Postgres version so we can verify and fix this bug? Thanks.

Hi Michael,

We are running PostgreSQL 14.1

cheers,
mwai

Thanks. I have created issue #1245 to fix this problem.