--
ChristopheHaen - 2020-07-28
LHCb wants to reorder its namespace. The desired transformation is as follows (example at GridKa):
/pnfs/gridka.de/lhcb/dirA/dirB/file --> /pnfs/gridka.de/lhcb/SPACETOKEN/lhcb/dir-A/dir-B/file
To achieve that, Tigran has developed a script, which performs changes on the dCache chimera and spacemanager DBs.
This script is available under this link:
https://sas.desy.de/index.php/s/HjKc9dEzTgTe4S9
As requisite it is necessary to install java11 (part of EL7 distribution).
PREREQUISITE. Ensure that all the files present in Chimera belong to a space token.
During the tests performed before going into production, files present in Chimera without having space token information were found. If that is the case, the following rules should apply depending on the following location of the files within the Chimera namespace:
/lhcb/failover/ -> LHCb-Disk
/lhcb/buffer/ -> LHCb_Disk
/lhcb/archive/ -> LHCb-Tape
/lhcb/data/-> LHCb-Tape
lhcb/LHCb/Collision[0-9]+/FULL.DST/ -> LHCb-Tape
/lhcb/MC/ -> LHCb-Disk
/lhcb/user -> LHCb_USER
Steps
- Before running Tigran's script, you need to update the chimera DB with an additional procedure:
CREATE OR REPLACE FUNCTION inumber2path(bigint, bigint) RETURNS varchar AS $$
DECLARE
inumber bigint := $1;
iroot bigint := $2;
path varchar := '';
entry record;
BEGIN
IF iroot = inumber
THEN
return '/';
END IF;
LOOP
IF iroot = inumber
THEN
EXIT;
END IF;
SELECT * INTO entry FROM t_dirs WHERE ichild = inumber;
IF FOUND AND entry.iparent != inumber
THEN
path := '/' || entry.iname || path;
inumber := entry.iparent;
ELSE
EXIT;
END IF;
END LOOP;
RETURN path;
END;
$$
LANGUAGE 'plpgsql';
- Second, in migration.properties you will need to point to corresponding databases and adapt the values of
path.src
and path.dest
. Such values at GridKa:
# /src/dir-1/file -> /dest/TOKEN/dir-1/file
path.src = /pnfs/gridka.de/
path.dest = /pnfs/gridka.de/lhcb
- Third (optional if you want to get rid of some space token), something similar to the following executed at GridKa will be necessary, adapting the values of the corresponding spacereservationid. It is also important to verify the values of vogroup, description in your instance.
Execute the three SQL commands to get rid of LHCb_RAW.
[root@f01-117-104 ~]# psql spacemanager dcache
psql (11.8)
Type "help" for help.
spacemanager=> update srmspacefile set spacereservationid = 39930230 where spacereservationid = 449420;
UPDATE 29079
spacemanager=> delete from srmspace where id = 449420;
DELETE 1
spacemanager=> update srmspace set vogroup = '/lhcb', description = 'LHCb-Tape' where id = 39930230;
UPDATE 1
$ java -jar lhcb-migration.jar [property-file]
If property file is not defined, then `migration.properties` from the local directory will be used.
Brave people can look at the code:
https://github.com/kofemann/lhcb-migration/blob/master/src/main/java/org/dcache/migraion/lhcb/Migration.java