From 3a349eee1d56a0db475afabad940d70ce03e5712 Mon Sep 17 00:00:00 2001
From: Giuseppe Lo Presti <giuseppe.lopresti@cern.ch>
Date: Wed, 30 Oct 2019 17:50:32 +0100
Subject: [PATCH] [migration] Completed #644:

- Added tool to drop from the CTA catalogue all CASTOR tapes from a given tapepool.
  This tool makes use of a temporary table and an additional PL/SQL procedure
  in order to perform efficient bulk operations in the CTA catalogue.
- Made tapepool insertion idempotent.
- Updated documentation.
---
 catalogue/DropSchemaCmd.cpp                  | 1 +
 catalogue/oracle_catalogue_schema_header.sql | 4 ++++
 cta.spec.in                                  | 3 ++-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/catalogue/DropSchemaCmd.cpp b/catalogue/DropSchemaCmd.cpp
index bb691b6584..465bd502a3 100644
--- a/catalogue/DropSchemaCmd.cpp
+++ b/catalogue/DropSchemaCmd.cpp
@@ -242,6 +242,7 @@ void DropSchemaCmd::dropOracleCatalogueSchema(rdbms::Conn &conn) {
       "TAPE",
       "TEMP_TAPE_FILE_BATCH",
       "TEMP_TAPE_FILE_INSERTION_BATCH",
+      "TEMP_REMOVE_CASTOR_METADATA",
       "REQUESTER_MOUNT_RULE",
       "REQUESTER_GROUP_MOUNT_RULE",
       "ADMIN_USER",
diff --git a/catalogue/oracle_catalogue_schema_header.sql b/catalogue/oracle_catalogue_schema_header.sql
index f3345ec826..c3814a76e1 100644
--- a/catalogue/oracle_catalogue_schema_header.sql
+++ b/catalogue/oracle_catalogue_schema_header.sql
@@ -33,3 +33,7 @@ CREATE GLOBAL TEMPORARY TABLE TEMP_TAPE_FILE_INSERTION_BATCH(
 )
 ON COMMIT DELETE ROWS;
 CREATE INDEX TEMP_T_F_I_B_ARCHIVE_FILE_ID_I ON TEMP_TAPE_FILE_INSERTION_BATCH(ARCHIVE_FILE_ID);
+CREATE GLOBAL TEMPORARY TABLE TEMP_REMOVE_CASTOR_METADATA(
+  ARCHIVE_FILE_ID       UINT64TYPE
+)
+ON COMMIT DELETE ROWS;
diff --git a/cta.spec.in b/cta.spec.in
index 744021896e..f829d2fd22 100644
--- a/cta.spec.in
+++ b/cta.spec.in
@@ -318,9 +318,10 @@ directory metadata into the EOS namespace.
 %attr(0755,root,root) %{_bindir}/json-pretty-print.sh
 %attr(0644,root,root) %{_bindir}/begin_vo_export_to_cta.sh
 %attr(0644,root,root) %{_bindir}/export_production_tapepool_to_cta.sh
-%attr(0644,root,root) %{_bindir}/vmgr_reenable_tapepool.sh
 %attr(0755,root,root) %{_bindir}/tapepool_castor_to_cta.py
 %attr(0755,root,root) %{_bindir}/complete_tapepool_export.py
+%attr(0644,root,root) %{_bindir}/vmgr_reenable_tapepool.sh
+%attr(0644,root,root) %{_bindir}/cta-catalogue-remove-castor-tapes.py
 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cta/castor-migration.conf.example
 
 %package -n cta-rmcd
-- 
GitLab