Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
51b5e908
Commit
51b5e908
authored
4 years ago
by
Cedric Caffy
Browse files
Options
Downloads
Patches
Plain Diff
[cta-statistics-update] Tape statistics are updated on one tape at a time
parent
21bedbf2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
statistics/DatabaseStatisticsService.cpp
+16
-5
16 additions, 5 deletions
statistics/DatabaseStatisticsService.cpp
with
16 additions
and
5 deletions
statistics/DatabaseStatisticsService.cpp
+
16
−
5
View file @
51b5e908
...
...
@@ -28,7 +28,11 @@ DatabaseStatisticsService::~DatabaseStatisticsService() {
}
void
DatabaseStatisticsService
::
updateStatisticsPerTape
(){
const
char
*
const
sql
=
//to update the statistics, we will first select the DIRTY tapes ordered by VID and we will run an update for each row.
const
char
*
const
selectVids
=
"SELECT TAPE.VID AS VID FROM TAPE WHERE TAPE.DIRTY='1' ORDER BY TAPE.VID"
;
const
char
*
const
updateSql
=
"UPDATE TAPE TAPE_TO_UPDATE SET"
"("
"DIRTY,"
...
...
@@ -81,11 +85,18 @@ void DatabaseStatisticsService::updateStatisticsPerTape(){
"WHERE T.VID = TAPE_TO_UPDATE.VID "
"GROUP BY T.VID"
") "
"WHERE TAPE_TO_UPDATE.DIRTY='1'"
;
"WHERE TAPE_TO_UPDATE.VID = :VID"
;
try
{
auto
stmt
=
m_conn
.
createStmt
(
sql
);
stmt
.
executeNonQuery
();
m_nbUpdatedTapes
=
stmt
.
getNbAffectedRows
();
auto
selectStmt
=
m_conn
.
createStmt
(
selectVids
);
auto
rset
=
selectStmt
.
executeQuery
();
while
(
rset
.
next
()){
//For all DIRTY tapes, update its statistics
auto
updateStmt
=
m_conn
.
createStmt
(
updateSql
);
updateStmt
.
bindString
(
":VID"
,
rset
.
columnString
(
"VID"
));
updateStmt
.
executeNonQuery
();
m_nbUpdatedTapes
+=
updateStmt
.
getNbAffectedRows
();
}
}
catch
(
cta
::
exception
::
Exception
&
ex
)
{
ex
.
getMessage
().
str
(
std
::
string
(
__PRETTY_FUNCTION__
)
+
": "
+
ex
.
getMessage
().
str
());
throw
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment