Commit 94155bea authored by Steven Murray's avatar Steven Murray
Browse files

Revert "[catalogue] cta/CTA#951 Fixed"

This reverts commit 7c6609d2.

The orginal commit is being reverted because it intentionally
forced the "list contents of a tape" query to use indicies by
replacing table joins with sub-queries.  These sub-queuries
unfortunately turned out to be slower than the original query
when it was executed in a "clean" environment and the database
live memory cache was cold.  By "clean" environment I mean one
without PARALLEL enabled on the following two tables:

ARCHIVE_FILE
TAPE_FILE

PARALLEL is enabled on these two tables when a CASTOR to CTA
migration takes place.  It was left in place with the hope that
it would not interferre with the day to day running of CTA.  This
has now been proven to not be the case.
parent e67f1d65
......@@ -83,128 +83,42 @@ RdbmsCatalogueTapeContentsItor::RdbmsCatalogueTapeContentsItor(
if (vid.empty()) throw exception::Exception("vid is an empty string");
std::string sql =
"SELECT" "\n"
"TAPE_FILE.ARCHIVE_FILE_ID AS ARCHIVE_FILE_ID," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.DISK_INSTANCE_NAME" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS DISK_INSTANCE_NAME," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.DISK_FILE_ID" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS DISK_FILE_ID," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.DISK_FILE_UID" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS DISK_FILE_UID," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.DISK_FILE_GID" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS DISK_FILE_GID," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.SIZE_IN_BYTES" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS SIZE_IN_BYTES," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.CHECKSUM_BLOB" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS CHECKSUM_BLOB," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.CHECKSUM_ADLER32" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS CHECKSUM_ADLER32," "\n"
"(" "\n"
"SELECT" "\n"
"STORAGE_CLASS.STORAGE_CLASS_NAME" "\n"
"FROM" "\n"
"STORAGE_CLASS" "\n"
"WHERE" "\n"
"STORAGE_CLASS.STORAGE_CLASS_ID =" "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.STORAGE_CLASS_ID" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
")" "\n"
") AS STORAGE_CLASS_NAME," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.CREATION_TIME" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS ARCHIVE_FILE_CREATION_TIME," "\n"
"(" "\n"
"SELECT" "\n"
"ARCHIVE_FILE.RECONCILIATION_TIME" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"WHERE" "\n"
"ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
") AS RECONCILIATION_TIME," "\n"
"TAPE_FILE.VID AS VID," "\n"
"TAPE_FILE.FSEQ AS FSEQ," "\n"
"TAPE_FILE.BLOCK_ID AS BLOCK_ID," "\n"
"TAPE_FILE.LOGICAL_SIZE_IN_BYTES AS LOGICAL_SIZE_IN_BYTES," "\n"
"TAPE_FILE.COPY_NB AS COPY_NB," "\n"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME," "\n"
"TAPE_FILE.SUPERSEDED_BY_VID AS SUPERSEDED_BY_VID," "\n"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SUPERSEDED_BY_FSEQ," "\n"
"(" "\n"
"SELECT" "\n"
"TAPE_POOL_NAME" "\n"
"FROM" "\n"
"TAPE_POOL" "\n"
"WHERE" "\n"
"TAPE_POOL.TAPE_POOL_ID =" "\n"
"(" "\n"
"SELECT" "\n"
"TAPE_POOL_ID" "\n"
"FROM" "\n"
"TAPE" "\n"
"WHERE" "\n"
"TAPE.VID = TAPE_FILE.VID" "\n"
")" "\n"
") AS TAPE_POOL_NAME" "\n"
"FROM" "\n"
"TAPE_FILE" "\n"
"WHERE" "\n"
"TAPE_FILE.VID = :VID" "\n";
"SELECT /*+ INDEX (TAPE_FILE TAPE_FILE_VID_IDX) */" "\n"
"ARCHIVE_FILE.ARCHIVE_FILE_ID AS ARCHIVE_FILE_ID," "\n"
"ARCHIVE_FILE.DISK_INSTANCE_NAME AS DISK_INSTANCE_NAME," "\n"
"ARCHIVE_FILE.DISK_FILE_ID AS DISK_FILE_ID," "\n"
"ARCHIVE_FILE.DISK_FILE_UID AS DISK_FILE_UID," "\n"
"ARCHIVE_FILE.DISK_FILE_GID AS DISK_FILE_GID," "\n"
"ARCHIVE_FILE.SIZE_IN_BYTES AS SIZE_IN_BYTES," "\n"
"ARCHIVE_FILE.CHECKSUM_BLOB AS CHECKSUM_BLOB," "\n"
"ARCHIVE_FILE.CHECKSUM_ADLER32 AS CHECKSUM_ADLER32," "\n"
"STORAGE_CLASS.STORAGE_CLASS_NAME AS STORAGE_CLASS_NAME," "\n"
"ARCHIVE_FILE.CREATION_TIME AS ARCHIVE_FILE_CREATION_TIME," "\n"
"ARCHIVE_FILE.RECONCILIATION_TIME AS RECONCILIATION_TIME," "\n"
"TAPE_FILE.VID AS VID," "\n"
"TAPE_FILE.FSEQ AS FSEQ," "\n"
"TAPE_FILE.BLOCK_ID AS BLOCK_ID," "\n"
"TAPE_FILE.LOGICAL_SIZE_IN_BYTES AS LOGICAL_SIZE_IN_BYTES," "\n"
"TAPE_FILE.COPY_NB AS COPY_NB," "\n"
"TAPE_FILE.CREATION_TIME AS TAPE_FILE_CREATION_TIME," "\n"
"TAPE_FILE.SUPERSEDED_BY_VID AS SUPERSEDED_BY_VID," "\n"
"TAPE_FILE.SUPERSEDED_BY_FSEQ AS SUPERSEDED_BY_FSEQ," "\n"
"TAPE_POOL.TAPE_POOL_NAME AS TAPE_POOL_NAME" "\n"
"FROM" "\n"
"ARCHIVE_FILE" "\n"
"INNER JOIN STORAGE_CLASS ON" "\n"
"ARCHIVE_FILE.STORAGE_CLASS_ID = STORAGE_CLASS.STORAGE_CLASS_ID" "\n"
"INNER JOIN TAPE_FILE ON" "\n"
"ARCHIVE_FILE.ARCHIVE_FILE_ID = TAPE_FILE.ARCHIVE_FILE_ID" "\n"
"INNER JOIN TAPE ON" "\n"
"TAPE_FILE.VID = TAPE.VID" "\n"
"INNER JOIN TAPE_POOL ON" "\n"
"TAPE.TAPE_POOL_ID = TAPE_POOL.TAPE_POOL_ID" "\n"
"WHERE" "\n"
"TAPE_FILE.VID = :VID" "\n";
if (!showSuperseded) {
sql +=
"AND TAPE_FILE.SUPERSEDED_BY_VID IS NULL\n";
sql += "AND TAPE_FILE.SUPERSEDED_BY_VID IS NULL" "\n";
}
sql += "ORDER BY FSEQ";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment