Skip to content
Snippets Groups Projects
Commit 491c5916 authored by David Smith's avatar David Smith
Browse files

Resolve "cta-statistics-update can fail for catalogues in postgres"

parent e9ad586e
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@
- cta/CTA#251 - Increase free drive STALE threshold to 4 hours
- cta/CTA#218 - Do not retry during repack requests
### Bug Fixes
- cta/CTA#181 - cta-statistics-update can fail for catalogues in postgres
- cta/CTA#234 - Replace stoi with toUint64 in standalone cli tool
- cta/CTA#238 - Compilation fails when using cta::common::Configuration::getConfEntInt(...)
### Continuous Integration
......
......@@ -16,6 +16,7 @@
*/
#include <string>
#include <vector>
#include "DatabaseStatisticsService.hpp"
......@@ -92,10 +93,16 @@ void DatabaseStatisticsService::updateStatisticsPerTape() {
try {
auto selectStmt = m_conn.createStmt(selectVids);
auto rset = selectStmt.executeQuery();
// Make a list of all dirty vids. The memory required for the list is
// expected to be acceptable.
std::vector<std::string> dirtyVids;
while (rset.next()) {
dirtyVids.push_back(rset.columnString("VID"));
}
for (const auto & vid : dirtyVids) {
// For all DIRTY tapes, update its statistics
auto updateStmt = m_conn.createStmt(updateSql);
updateStmt.bindString(":VID", rset.columnString("VID"));
updateStmt.bindString(":VID", vid);
updateStmt.executeNonQuery();
m_nbUpdatedTapes += updateStmt.getNbAffectedRows();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment