Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
e7e22d37
Commit
e7e22d37
authored
May 02, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that export/index files created by repozo share the same timestamp.
https://bugs.launchpad.net/zodb/+bug/993350
parent
2bec5579
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
src/CHANGES.txt
src/CHANGES.txt
+5
-0
src/ZODB/scripts/repozo.py
src/ZODB/scripts/repozo.py
+13
-7
No files found.
src/CHANGES.txt
View file @
e7e22d37
...
@@ -8,6 +8,11 @@
...
@@ -8,6 +8,11 @@
Bugs Fixed
Bugs Fixed
----------
----------
- Ensured that the export file and index file created by ``repozo`` share
the same timestamp.
https://bugs.launchpad.net/zodb/+bug/993350
- Pinned the ``transaction`` and ``manuel`` dependencies to Python 2.5-
- Pinned the ``transaction`` and ``manuel`` dependencies to Python 2.5-
compatible versions when installing under Python 2.5.
compatible versions when installing under Python 2.5.
...
...
src/ZODB/scripts/repozo.py
View file @
e7e22d37
...
@@ -305,7 +305,10 @@ def concat(files, ofp=None):
...
@@ -305,7 +305,10 @@ def concat(files, ofp=None):
return
bytesread
,
sum
.
hexdigest
()
return
bytesread
,
sum
.
hexdigest
()
def
gen_filename
(
options
,
ext
=
None
):
def
gen_filedate
(
options
):
return
getattr
(
options
,
'test_now'
,
time
.
gmtime
()[:
6
])
def
gen_filename
(
options
,
ext
=
None
,
now
=
None
):
if
ext
is
None
:
if
ext
is
None
:
if
options
.
full
:
if
options
.
full
:
ext
=
'.fs'
ext
=
'.fs'
...
@@ -314,7 +317,8 @@ def gen_filename(options, ext=None):
...
@@ -314,7 +317,8 @@ def gen_filename(options, ext=None):
if
options
.
gzip
:
if
options
.
gzip
:
ext
+=
'z'
ext
+=
'z'
# Hook for testing
# Hook for testing
now
=
getattr
(
options
,
'test_now'
,
time
.
gmtime
()[:
6
])
if
now
is
None
:
now
=
gen_filedate
(
options
)
t
=
now
+
(
ext
,)
t
=
now
+
(
ext
,)
return
'%04d-%02d-%02d-%02d-%02d-%02d%s'
%
t
return
'%04d-%02d-%02d-%02d-%02d-%02d%s'
%
t
...
@@ -330,7 +334,7 @@ del re
...
@@ -330,7 +334,7 @@ del re
def
find_files
(
options
):
def
find_files
(
options
):
when
=
options
.
date
when
=
options
.
date
if
not
when
:
if
not
when
:
when
=
gen_filename
(
options
,
''
)
when
=
gen_filename
(
options
,
ext
=
''
)
log
(
'looking for files between last full backup and %s...'
,
when
)
log
(
'looking for files between last full backup and %s...'
,
when
)
all
=
filter
(
is_data_file
,
os
.
listdir
(
options
.
repository
))
all
=
filter
(
is_data_file
,
os
.
listdir
(
options
.
repository
))
all
.
sort
()
all
.
sort
()
...
@@ -429,7 +433,8 @@ def delete_old_backups(options):
...
@@ -429,7 +433,8 @@ def delete_old_backups(options):
def
do_full_backup
(
options
):
def
do_full_backup
(
options
):
options
.
full
=
True
options
.
full
=
True
dest
=
os
.
path
.
join
(
options
.
repository
,
gen_filename
(
options
))
tnow
=
gen_filedate
(
options
)
dest
=
os
.
path
.
join
(
options
.
repository
,
gen_filename
(
options
,
now
=
tnow
))
if
os
.
path
.
exists
(
dest
):
if
os
.
path
.
exists
(
dest
):
raise
WouldOverwriteFiles
(
'Cannot overwrite existing file: %s'
%
dest
)
raise
WouldOverwriteFiles
(
'Cannot overwrite existing file: %s'
%
dest
)
# Find the file position of the last completed transaction.
# Find the file position of the last completed transaction.
...
@@ -442,7 +447,7 @@ def do_full_backup(options):
...
@@ -442,7 +447,7 @@ def do_full_backup(options):
pos
=
fs
.
getSize
()
pos
=
fs
.
getSize
()
# Save the storage index into the repository
# Save the storage index into the repository
index_file
=
os
.
path
.
join
(
options
.
repository
,
index_file
=
os
.
path
.
join
(
options
.
repository
,
gen_filename
(
options
,
'.index'
))
gen_filename
(
options
,
'.index'
,
tnow
))
log
(
'writing index'
)
log
(
'writing index'
)
fs
.
_index
.
save
(
pos
,
index_file
)
fs
.
_index
.
save
(
pos
,
index_file
)
fs
.
close
()
fs
.
close
()
...
@@ -461,7 +466,8 @@ def do_full_backup(options):
...
@@ -461,7 +466,8 @@ def do_full_backup(options):
def
do_incremental_backup
(
options
,
reposz
,
repofiles
):
def
do_incremental_backup
(
options
,
reposz
,
repofiles
):
options
.
full
=
False
options
.
full
=
False
dest
=
os
.
path
.
join
(
options
.
repository
,
gen_filename
(
options
))
tnow
=
gen_filedate
(
options
)
dest
=
os
.
path
.
join
(
options
.
repository
,
gen_filename
(
options
,
now
=
tnow
))
if
os
.
path
.
exists
(
dest
):
if
os
.
path
.
exists
(
dest
):
raise
WouldOverwriteFiles
(
'Cannot overwrite existing file: %s'
%
dest
)
raise
WouldOverwriteFiles
(
'Cannot overwrite existing file: %s'
%
dest
)
# Find the file position of the last completed transaction.
# Find the file position of the last completed transaction.
...
@@ -474,7 +480,7 @@ def do_incremental_backup(options, reposz, repofiles):
...
@@ -474,7 +480,7 @@ def do_incremental_backup(options, reposz, repofiles):
pos
=
fs
.
getSize
()
pos
=
fs
.
getSize
()
log
(
'writing index'
)
log
(
'writing index'
)
index_file
=
os
.
path
.
join
(
options
.
repository
,
index_file
=
os
.
path
.
join
(
options
.
repository
,
gen_filename
(
options
,
'.index'
))
gen_filename
(
options
,
'.index'
,
tnow
))
fs
.
_index
.
save
(
pos
,
index_file
)
fs
.
_index
.
save
(
pos
,
index_file
)
fs
.
close
()
fs
.
close
()
log
(
'writing incremental: %s bytes to %s'
,
pos
-
reposz
,
dest
)
log
(
'writing incremental: %s bytes to %s'
,
pos
-
reposz
,
dest
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment