Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iml-backup
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
Container Registry
Model registry
Operate
Environments
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
IML Open Source
iml-backup
Commits
6f045807
Commit
6f045807
authored
4 months ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
Detect mariadb sandbox mode
parent
ec2ef8fa
No related branches found
No related tags found
1 merge request
!146
OP#7599 mysql restore: Error in first line https://projects.iml.unibe.ch/work_packages/7599
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/localdump/mysql.sh
+13
-1
13 additions, 1 deletion
plugins/localdump/mysql.sh
with
13 additions
and
1 deletion
plugins/localdump/mysql.sh
+
13
−
1
View file @
6f045807
...
...
@@ -18,6 +18,8 @@
# 2022-03-24 v2.4 On empty dumps: detect if source db is empty too
# 2023-10-06 v2.5 mysqldump params can be customized in jobs/env
# 2023-10-02 v2.6 Detect a connect error before backup; remove unneeded code
# 2024-10-02 v2.6 Detect a connect error before backup; remove unneeded code
# 2024-11-18 v2.7 Detect mariadb sandbox mode
# ================================================================================
if
[
-z
"
$LOCALDUMP_LOADED
"
]
;
then
...
...
@@ -95,7 +97,17 @@ function mysql.db.dump(){
function
mysql.db.import
(){
local
_dumpfile
=
$1
local
_dbname
=
$2
zcat
"
$_dumpfile
"
| mysql
$BACKUP_PARAMS
"
${
_dbname
}
"
# https://mariadb.org/mariadb-dump-file-compatibility-change/
# if sandbox mode is detected then skip the first line
local
sSandbox
;
sSandbox
=
'/*!999999\- enable the sandbox mode */'
if
zcat
"
$_dumpfile
"
|
head
-1
|
grep
-Fq
"
$sSandbox
"
then
zcat
"
$_dumpfile
"
|
tail
+2 | mysql
$BACKUP_PARAMS
"
${
_dbname
}
"
else
zcat
"
$_dumpfile
"
| mysql
$BACKUP_PARAMS
"
${
_dbname
}
"
fi
fetchrc
>
/dev/null
test
$myrc
-eq
0
&&
mysql_COUNT_IMPORT+
=
1
test
$myrc
-eq
0
||
mysql_COUNT_ERRORS+
=
1
...
...
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