1. 24 May, 2019 1 commit
    • Jérome Perrin's avatar
      test: add a test for zodb commmad and help driver · 2d94ae9d
      Jérome Perrin authored
      kirr: factor running `zodb ...` into zodbrun + add test for `zodb -h`.
      Added test currently passes on py2, but fails on py3:
      	out = <_io.TextIOWrapper encoding='UTF-8'>
      	    def usage(out):
      	    Zodb is a tool for managing ZODB databases.
      	        zodb command [arguments]
      	    The commands are:
      	    """, file=out)
      	        cmdv = command_dict.keys()
      	>       cmdv.sort()
      	E       AttributeError: 'dict_keys' object has no attribute 'sort'
      	zodbtools/zodb.py:55: AttributeError
      It will be fixed in the next patch.
  2. 07 Mar, 2019 1 commit
  3. 30 Jan, 2019 1 commit
  4. 11 Jan, 2019 1 commit
  5. 07 Jan, 2019 1 commit
  6. 30 Dec, 2018 1 commit
  7. 13 Dec, 2018 2 commits
  8. 02 Jul, 2018 1 commit
    • Kirill Smelkov's avatar
      zodbdump: Switch to using qq from pygolang · b1163449
      Kirill Smelkov authored
      I originally added escapeqq as part of 75c03368 (zodbdump: Start to
      stabilize output format) with the task for this utility to quote string
      into valid "..." string always quoted with ".
      This utility was later copied to pygolang:
      and then further improved there to work under both Python2 and Python3
      and to not escape printable UTF-8 characters:
      So stop the duplication and simply switch to the better version.
  9. 02 Nov, 2017 1 commit
    • Kirill Smelkov's avatar
      zodbdump: Start to stabilize output format · 75c03368
      Kirill Smelkov authored
      Since zodbdump start (c0a6299f "zodbdump - Tool to dump content of a
      ZODB database   (draft)") and up till now zodbdump output format was not
      good. For example user and description transaction properties were
      output without proper quoting, which in situation when there would be
      fancy characters in there would break the output.
      So start the format stabilization:
      - user and description are output as quoted, so now they are guaranteed
        to be on one line. The quoting character is always " (instead of e.g.
        smartly quoting either by ' or " as python does) for easier
        compatibility with ZODB implementations in other languages.
      - transaction extension is now printed as raw bytes, not as dict.
        The idea here is that `zodb dump`
        * should perform dump of raw data as stored inside ZODB so that later
          `zodb restore` could restore the database identically to the same state.
        * we should dump raw data instead of unpickled ones because generally
          on-disk extension's format can be any raw bytes and this information
          should be preserved.
      - transaction status is now also output as quoted to preserve line
        breakage on fancy status codes.
      - it is documented that sha1 is not the only allowed hash function that
        might be used.
      - in hashonly mode we add trailing " -" to obj string so that it is
        possible to distinguish outputs of `zodb dump` and `zodb dump -hashonly`
        without knowing a-priory the way it was produced.
        The reason to do so is that it would be not good to e.g. by accident
        feed hashonly output to (future) `zodb restore`, which, without having
        a way to see it should not consume object data would read following
        transaction information as raw object data with confusing later
        errors (and a small chance to restore completely different database
        without reporting error at all).
      Because ZODB iteration API gives us already unpickled extension and only
      that, for now to dump it as raw we get a long road to pickle it back
      also caring to try to pickle in stable order.
      Hopefully this will be only a fallback because of
      and next zodbtools patch.
      For testing purposes (currently only quoting function unit test) py.test
      usage is introduced.
      The code is also generally polished here and there.
  10. 05 Apr, 2017 1 commit
  11. 04 Apr, 2017 3 commits
    • Kirill Smelkov's avatar
      Allow internal clients to specify intended access mode - read-only or read-write · bfeb1690
      Kirill Smelkov authored
      Most of our tools need only read access for working. However e.g.
      FileStorage, when opened in read-write mode, automatically creates
      database file and index.
      This way if database is opened in read-write mode a simple typo in path,
      e.g. to `zodb dump path` would lead to:
      - new database at path will be created
      - the dump will print nothing (empty database)
      - exit status will be 0 (ok) and no error will be reported.
      For this reason it is better tools declare access level they need so for
      read-only access request we can catch it with an error from storage.
      This, however, requires quite recent ZODB to work:
      We don't want to force users to always specify read-only in URLs or
      zconf files because:
      - this is error prone
      - URL or zconf can be though as of file
      - when a program opens a file the program, not file, declares which type
        of access it wants.
      That's why access mode declaration has to be internal.
    • Kirill Smelkov's avatar
      Switch to opening storages by URL · 82b06413
      Kirill Smelkov authored
      Previously for specifying a storage we were requiring users to create
      zconfig file and put information about storage there. This is not always
      convenient e.g. for quickly inspecting a file storage or a NEO instance
      here and there for which address and name is already at hand.
      So thanks to zodburi we can switch to specifying storages by URL without
      loosing generality as there is still zconfig:// schema which allows to
      configure storages zconfig way.
      P.S. for convenience we allow paths without schema to be treated as
          FileStorage (i.e. file:// schema is implicitly used).
      P.P.S. zodbanalyze is not affected (for now ?) as it currently
          works with FileStorage only.
      [1] http://docs.pylonsproject.org/projects/zodburi/
    • Kirill Smelkov's avatar
      zodb - Tool to drive them all · 984cfe22
      Kirill Smelkov authored
      We already have 3 commands in zodbtools suite (zodbanalyze, zodbdump &
      zodbcmp) and this is going to grow. And it was already noted some time
      ago with TODO (in 66946b8d) that we need only one command driver to
      invoke everything.
      So do it: introduce `zodb` command which can invoke other subcommands
      and show general help or help for subcommand or a topic.
      The structure is modelled after `git` and `go` commands. Help topics
      are for now empty but we'll add one help topic in the next patch.
  12. 30 Mar, 2017 1 commit
    • Kirill Smelkov's avatar
      Clarify licensing · 9e4305b8
      Kirill Smelkov authored
      - Nexedi adheres to GPLv3+ with wide exception for Free/Open-source
        software. Use this for our original work.
      - Zodbanalyze was initially developed by Zope corp & co. See
        d86d04dc	(initial copy of ZODB3-3.9.7's ZODB/scripts/analyze.py.)
        ab17cf2d	(Hook in Nexedi's zodbanalyze)
        So follow original Zope's licensing terms for zodbanalyze.
  13. 14 Mar, 2017 1 commit
  14. 17 Nov, 2016 5 commits
  15. 16 Nov, 2016 3 commits
    • Kirill Smelkov's avatar
      zodbdump - Tool to dump content of a ZODB database (draft) · c0a6299f
      Kirill Smelkov authored
      WARNING output format is not stable yet.
    • Kirill Smelkov's avatar
      zodbcmp - Tool to compare two ZODB databases · 66946b8d
      Kirill Smelkov authored
      This is a tool to compare two ZODB databases in between tidmin..tidmax
      transaction range with default range being -∞..+∞ - (whole database).
      For comparision both databases are scanned at storage layer and every
      transaction content is compared bit-to-bit between the two. The program stops
      either at first difference found, or when whole requested transaction range is
      scanned with no difference detected.
      Database storages are specified in files with ZConfig-based storage definition, e.g.
          %import neo.client
              master_nodes    ...
              name            ...
      Please see nexedi/neoppod!4 for
      one of possible contexts.
      The tool is generic though and is not NEO-specific. It should be able to
      even check two different storages like ZEO & NEO, or FileStorage and NEO
      etc and thus can be handy.
      TODO tests
    • Kirill Smelkov's avatar