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
831da38e
Commit
831da38e
authored
8 years ago
by
Danny Auble
Browse files
Options
Downloads
Patches
Plain Diff
Make it so MySQL can deal with potential duplicate entries in the job table
which will be changing it's unique index in a following commit.
parent
e12b03bd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/database/mysql_common.c
+12
-7
12 additions, 7 deletions
src/database/mysql_common.c
with
12 additions
and
7 deletions
src/database/mysql_common.c
+
12
−
7
View file @
831da38e
...
@@ -272,12 +272,11 @@ static int _mysql_make_table_current(mysql_conn_t *mysql_conn, char *table_name,
...
@@ -272,12 +272,11 @@ static int _mysql_make_table_current(mysql_conn_t *mysql_conn, char *table_name,
itr
=
list_iterator_create
(
columns
);
itr
=
list_iterator_create
(
columns
);
/* In MySQL 5.7.4 we lost the ability to run 'alter ignore'. This was
/* In MySQL 5.7.4 we lost the ability to run 'alter ignore'. This was
* needed when converting old tables to new schemas. If people convert
* needed when converting old tables to new schemas. We found a back
* in the future from an older version of Slurm that needed the ignore
* door for this with set session old_alter_table=1 which we use below.
* to work they will have to downgrade mysql to <= 5.7.3 to make things
* This seems to work just fine and we get what we are looking for.
* work correctly or manually edit the database to get things to work.
*/
*/
query
=
xstrdup_printf
(
"alter table %s"
,
table_name
);
query
=
xstrdup_printf
(
"alter
IGNORE
table %s"
,
table_name
);
correct_query
=
xstrdup
(
query
);
correct_query
=
xstrdup
(
query
);
START_TIMER
;
START_TIMER
;
while
(
fields
[
i
].
name
)
{
while
(
fields
[
i
].
name
)
{
...
@@ -459,6 +458,7 @@ static int _mysql_make_table_current(mysql_conn_t *mysql_conn, char *table_name,
...
@@ -459,6 +458,7 @@ static int _mysql_make_table_current(mysql_conn_t *mysql_conn, char *table_name,
query
[
strlen
(
query
)
-
1
]
=
';'
;
query
[
strlen
(
query
)
-
1
]
=
';'
;
correct_query
[
strlen
(
correct_query
)
-
1
]
=
';'
;
correct_query
[
strlen
(
correct_query
)
-
1
]
=
';'
;
//info("%d query\n%s", __LINE__, query);
//info("%d query\n%s", __LINE__, query);
/* see if we have already done this definition */
/* see if we have already done this definition */
...
@@ -503,10 +503,15 @@ static int _mysql_make_table_current(mysql_conn_t *mysql_conn, char *table_name,
...
@@ -503,10 +503,15 @@ static int _mysql_make_table_current(mysql_conn_t *mysql_conn, char *table_name,
debug4
(
"Table %s doesn't exist, adding"
,
table_name
);
debug4
(
"Table %s doesn't exist, adding"
,
table_name
);
else
else
debug
(
"Table %s has changed. Updating..."
,
table_name
);
debug
(
"Table %s has changed. Updating..."
,
table_name
);
if
(
mysql_db_query
(
mysql_conn
,
query
))
{
query2
=
xstrdup_printf
(
"set session old_alter_table=1;"
xfree
(
query
);
"%s set session old_alter_table=0;"
,
query
);
xfree
(
query
);
if
(
mysql_db_query
(
mysql_conn
,
query2
))
{
xfree
(
query2
);
return
SLURM_ERROR
;
return
SLURM_ERROR
;
}
}
xfree
(
query2
);
quoted
=
slurm_add_slash_to_quotes
(
correct_query
);
quoted
=
slurm_add_slash_to_quotes
(
correct_query
);
query2
=
xstrdup_printf
(
"insert into %s (creation_time, "
query2
=
xstrdup_printf
(
"insert into %s (creation_time, "
"mod_time, table_name, definition) "
"mod_time, table_name, definition) "
...
...
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