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
a9c76056
Commit
a9c76056
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
ticket 4769 - couchdb2 - move deleted databases
parent
ecb6735d
No related branches found
No related tags found
1 merge request
!16
ticket 4769 - couchdb2 - move deleted databases
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/localdump/couchdb2.sh
+32
-4
32 additions, 4 deletions
plugins/localdump/couchdb2.sh
with
32 additions
and
4 deletions
plugins/localdump/couchdb2.sh
+
32
−
4
View file @
a9c76056
...
@@ -145,7 +145,35 @@ function _doBackupOfSingleInstance(){
...
@@ -145,7 +145,35 @@ function _doBackupOfSingleInstance(){
create_targetdir
create_targetdir
mkdir
-p
${
BACKUP_TARGETDIR
}
/
${
COUCHDB_INSTANCE
}
2>/dev/null
mkdir
-p
${
BACKUP_TARGETDIR
}
/
${
COUCHDB_INSTANCE
}
2>/dev/null
mkdir
-p
${
ARCHIVE_DIR
}
/
${
COUCHDB_INSTANCE
}
/seq 2>/dev/null
mkdir
-p
${
ARCHIVE_DIR
}
/
${
COUCHDB_INSTANCE
}
/seq 2>/dev/null
typeset
-i
iDbTotal
=
`
_getDblist |
wc
-l
`
local
ARCHIVE_DIR2
=
${
ARCHIVE_DIR
}
/
${
COUCHDB_INSTANCE
}
/deleted_databases
test
-d
"
${
ARCHIVE_DIR2
}
"
||
mkdir
-p
${
ARCHIVE_DIR2
}
2>/dev/null
echo
echo
" MOVE deleted databases into
${
ARCHIVE_DIR2
}
"
echo
# get a list of current databases
dblist
=
/tmp/couch_list_
${
COUCHDB_INSTANCE
}
.txt
_getDblist
>
$dblist
ls
-l
$dblist
# detect deleted databases:
for
dumpfile
in
$(
find
${
ARCHIVE_DIR
}
/
${
COUCHDB_INSTANCE
}
/
-maxdepth
1
-type
f
-name
"*.couchdbdump.gz"
)
do
dbname
=
$(
basename
$dumpfile
|
sed
"s#
\.
couchdbdump
\.
gz##g"
)
grep
"^
${
dbname
}
"
$dblist
>
/dev/null
if
[
$?
-ne
0
]
;
then
SEQFILE
=
${
ARCHIVE_DIR
}
/
${
COUCHDB_INSTANCE
}
/seq/__seq__
${
dbname
}
echo
"DELETED
$dbname
...
$(
ls
-l
${
dumpfile
}
|
cut
-f
5-
-d
' '
)
"
mv
${
dumpfile
}
${
ARCHIVE_DIR2
}
rm
-f
${
SEQFILE
}
fi
done
# done | tee /tmp/couch_archive_${COUCHDB_INSTANCE}.txt
echo
typeset
-i
iDbTotal
=
$(
wc
-l
$dblist
)
typeset
-i
iDb
=
0
typeset
-i
iDb
=
0
echo
echo
...
@@ -154,7 +182,7 @@ function _doBackupOfSingleInstance(){
...
@@ -154,7 +182,7 @@ function _doBackupOfSingleInstance(){
echo
" ARCHIVE
${
ARCHIVE_DIR
}
/
${
COUCHDB_INSTANCE
}
"
echo
" ARCHIVE
${
ARCHIVE_DIR
}
/
${
COUCHDB_INSTANCE
}
"
echo
echo
for
dbname
in
`
_getD
blist
`
for
dbname
in
$(
cat
$d
blist
)
do
do
iDb
=
$iDb
+1
iDb
=
$iDb
+1
echo
-n
"-----
`
date
`
${
COUCHDB_INSTANCE
}
--
$iDb
of
$iDbTotal
-
${
dbname
}
- "
echo
-n
"-----
`
date
`
${
COUCHDB_INSTANCE
}
--
$iDb
of
$iDbTotal
-
${
dbname
}
- "
...
@@ -195,7 +223,7 @@ function _doBackupOfSingleInstance(){
...
@@ -195,7 +223,7 @@ function _doBackupOfSingleInstance(){
echo
echo
fi
fi
done
done
rm
-f
$dblist
}
}
# ---------- RESTORE
# ---------- RESTORE
...
@@ -206,7 +234,7 @@ function restoreByFile(){
...
@@ -206,7 +234,7 @@ function restoreByFile(){
sMyfile
=
$1
sMyfile
=
$1
sMyDb
=
$2
sMyDb
=
$2
bFastMode
=
1
bFastMode
=
1
echo
echo
h2
"analyze dump
$sMyfile
"
h2
"analyze dump
$sMyfile
"
...
...
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