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
904a3839
Commit
904a3839
authored
Nov 10, 2007
by
Christian Theune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extended output of fstail and provided a simple test. Fixes bug #158992.
parent
1ae0ba36
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
6 deletions
+55
-6
NEWS.txt
NEWS.txt
+3
-0
src/ZODB/scripts/fstail.py
src/ZODB/scripts/fstail.py
+2
-2
src/ZODB/scripts/fstail.txt
src/ZODB/scripts/fstail.txt
+40
-0
src/ZODB/scripts/tests.py
src/ZODB/scripts/tests.py
+10
-4
No files found.
NEWS.txt
View file @
904a3839
...
...
@@ -21,6 +21,9 @@ General
- (unreleased, after 3.9.0a1) ZODB installation now requires
setuptools.
- (unreleased, after 3.9.0a1) Added `offset` information to output of `fstail`
script. Added test harness for this script.
ZEO
---
...
...
src/ZODB/scripts/fstail.py
View file @
904a3839
...
...
@@ -33,8 +33,8 @@ def main(path, ntxn):
th
.
read_meta
()
print
"%s: hash=%s"
%
(
th
.
get_timestamp
(),
binascii
.
hexlify
(
hash
))
print
(
"user=%r description=%r length=%d"
%
(
th
.
user
,
th
.
descr
,
th
.
length
))
print
(
"user=%r description=%r length=%d
offset=%d
"
%
(
th
.
user
,
th
.
descr
,
th
.
length
,
th
.
get_data_offset
()
))
print
th
=
th
.
prev_txn
()
i
-=
1
...
...
src/ZODB/scripts/fstail.txt
0 → 100644
View file @
904a3839
====================
The `fstail` utility
====================
The `fstail` utility shows information for a FileStorage about the last `n`
transactions:
We have to prepare a FileStorage first:
>>> from ZODB.FileStorage import FileStorage
>>> from ZODB.DB import DB
>>> import transaction
>>> from tempfile import mktemp
>>> storagefile = mktemp()
>>> base_storage = FileStorage(storagefile)
>>> database = DB(base_storage)
>>> connection1 = database.open()
>>> root = connection1.root()
>>> root['foo'] = 1
>>> transaction.commit()
Now lets have a look at the last transactions of this FileStorage:
>>> from ZODB.scripts.fstail import main
>>> main(storagefile, 5)
2007-11-10 15:18:48.543001: hash=b16422d09fabdb45d4e4325e4b42d7d6f021d3c3
user='' description='' length=138 offset=191
<BLANKLINE>
2007-11-10 15:18:48.543001: hash=b16422d09fabdb45d4e4325e4b42d7d6f021d3c3
user='' description='initial database creation' length=156 offset=52
<BLANKLINE>
Now clean up the storage again:
>>> import os
>>> base_storage.close()
>>> os.unlink(storagefile)
>>> os.unlink(storagefile+'.index')
>>> os.unlink(storagefile+'.lock')
>>> os.unlink(storagefile+'.tmp')
src/ZODB/scripts/tests.py
View file @
904a3839
...
...
@@ -11,15 +11,21 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
XXX short summary goes here
.
"""
Test harness for scripts
.
$Id$
"""
import
unittest
from
zope.testing
import
doctest
import
re
from
zope.testing
import
doctest
,
renormalizing
checker
=
renormalizing
.
RENormalizing
([
(
re
.
compile
(
'[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}
\
.[
0
-9]+'
),
'2007-11-10 15:18:48.543001'
),
(
re
.
compile
(
'hash=[0-9a-f]{40}'
),
'hash=b16422d09fabdb45d4e4325e4b42d7d6f021d3c3'
)])
def
test_suite
():
return
unittest
.
TestSuite
((
doctest
.
DocFileSuite
(
'referrers.txt'
),
doctest
.
DocFileSuite
(
'referrers.txt'
,
'fstail.txt'
,
checker
=
checker
),
))
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