Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
e42b0927
Commit
e42b0927
authored
6 years ago
by
Dominik Bartkiewicz
Committed by
Danny Auble
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix race condition when trying to update reservation in the database.
Bug 5166
parent
220c8c48
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NEWS
+1
-0
1 addition, 0 deletions
NEWS
src/plugins/accounting_storage/mysql/as_mysql_resv.c
+21
-25
21 additions, 25 deletions
src/plugins/accounting_storage/mysql/as_mysql_resv.c
with
22 additions
and
25 deletions
NEWS
+
1
−
0
View file @
e42b0927
...
...
@@ -24,6 +24,7 @@ documents those changes that are of interest to users and administrators.
plugin.
-- Remove drain on node when reboot nextstate used.
-- Speed up pack of job's qos.
-- Fix race condition when trying to update reservation in the database.
* Changes in Slurm 18.08.0pre2
==============================
...
...
This diff is collapsed.
Click to expand it.
src/plugins/accounting_storage/mysql/as_mysql_resv.c
+
21
−
25
View file @
e42b0927
...
...
@@ -315,17 +315,13 @@ extern int as_mysql_modify_resv(mysql_conn_t *mysql_conn,
xstrfmtcat
(
cols
,
", %s"
,
resv_req_inx
[
i
]);
}
/* check for both the last start and the start because most
likely the start time hasn't changed, but something else
may have since the last time we did an update to the
reservation. */
/* Get the last record of this reservation */
query
=
xstrdup_printf
(
"select %s from
\"
%s_%s
\"
where id_resv=%u "
"and
(
time_start
=%ld || time_start=
%ld
)
"
"and time_start
>=
%ld "
"and deleted=0 order by time_start desc "
"limit 1 FOR UPDATE;"
,
cols
,
resv
->
cluster
,
resv_table
,
resv
->
id
,
resv
->
time_start
,
resv
->
time_start_prev
);
try_again:
resv
->
time_start_prev
);
debug4
(
"%d(%s:%d) query
\n
%s"
,
mysql_conn
->
conn
,
THIS_FILE
,
__LINE__
,
query
);
if
(
!
(
result
=
mysql_db_query_ret
(
...
...
@@ -339,23 +335,6 @@ try_again:
error
(
"There is no reservation by id %u, "
"time_start %ld, and cluster '%s'"
,
resv
->
id
,
resv
->
time_start_prev
,
resv
->
cluster
);
if
(
!
set
&&
resv
->
time_end
)
{
/* This should never really happen,
but just in case the controller and the
database get out of sync we check
to see if there is a reservation
not deleted that hasn't ended yet. */
xfree
(
query
);
query
=
xstrdup_printf
(
"select %s from
\"
%s_%s
\"
where id_resv=%u "
"and time_start <= %ld and deleted=0 "
"order by time_start desc "
"limit 1;"
,
cols
,
resv
->
cluster
,
resv_table
,
resv
->
id
,
resv
->
time_end
);
set
=
1
;
goto
try_again
;
}
goto
end_it
;
}
...
...
@@ -364,7 +343,24 @@ try_again:
xfree
(
query
);
xfree
(
cols
);
set
=
0
;
/*
* Check to see if the start is after the time we are looking for to
* make sure no we are the latest update. If we aren't throw this one
* away.
*/
if
(
start
>
resv
->
time_start
)
{
error
(
"There is newer record for reservation with id %u, drop modification request:"
,
resv
->
id
);
error
(
"assocs:'%s', cluster:'%s', flags:%u, id:%u, name:'%s', nodes:'%s', nodes_inx:'%s', time_end:%ld, time_start:%ld, time_start_prev:%ld, tres_str:'%s', unused_wall:%f"
,
resv
->
assocs
,
resv
->
cluster
,
resv
->
flags
,
resv
->
id
,
resv
->
name
,
resv
->
nodes
,
resv
->
node_inx
,
resv
->
time_end
,
resv
->
time_start
,
resv
->
time_start_prev
,
resv
->
tres_str
,
resv
->
unused_wall
);
mysql_free_result
(
result
);
rc
=
SLURM_SUCCESS
;
goto
end_it
;
}
/* check differences here */
...
...
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