archiver-appliance / epicsarchiverap

This is an implementation of an archiver for EPICS control systems that aims to archive millions of PVs.
Other
38 stars 37 forks source link

PV renaming broken when the new PV name differs only in letters case #115

Closed rizzoa closed 2 years ago

rizzoa commented 3 years ago

I need to rename some PV in the archiver which should have a new name which differs only in letters case.

E.g. alfiovm02test:newtestcal7 to alfiovm02test:NEWTESTCAL7

but what I get is the following While renaming PV alfiovm02test:newtestcal7 to alfiovm02test:NEWTESTCAL7, the new name already exists

Is this a feature or a bug ?

slacmshankar commented 2 years ago

From what I can see this is an issue that needs to be fixed at the MySQL layer. By default, MySQL columns are case insensitive. See https://dev.mysql.com/doc/refman/5.6/en/case-sensitivity.html To turn on case sensitivity, use something like ALTER TABLE PVTypeInfo MODIFY pvName VARCHAR(256) NOT NULL COLLATE latin1_bin; following the instruction in the MySQL documentation and this should then work. You may want to do do this for the PVAliases table as well.

Note that renamePV does not delete the previous PV name by default; so this (deleting the older PV name to minimize confusion) needs to be done manually.

I would classify this as a feature? It's probably more confusing to have PV's that differ only in the case. So, even tho this is an accidental side-effect of MySQL behavior; I'd vote to keep this as is. It's easy enough to rename the PV to something arbitrary, clean up the old PV and then rename it back with the proper case.