- 01 Apr, 2021 2 commits
-
-
Kirill Smelkov authored
The tests verify that there is no concurrency bugs around load, Connection.open and invalidations. See e.g. https://github.com/zopefoundation/ZODB/issues/290 https://github.com/zopefoundation/ZEO/issues/155 By including the tests into wendelin.core, we will have CI coverage for all supported storages (FileStorage, ZEO, NEO), and for all supported ZODB (currently ZODB4, ZODB4-wc2 and ZODB5). ZEO5 is know to currently fail zloadrace. However, even though ZODB#290 was fixed, ZEO5 turned out to also fail on zopenrace: def test_zodb_zopenrace(): # exercises ZODB.Connection + particular storage implementation > zopenrace.main() lib/tests/test_zodb.py:382: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ <decorator-gen-1>:2: in main ??? ../../tools/go/pygolang/golang/__init__.py:103: in _ return f(*argv, **kw) lib/tests/testprog/zopenrace.py:115: in main test(zstor) <decorator-gen-2>:2: in test ??? ../../tools/go/pygolang/golang/__init__.py:103: in _ return f(*argv, **kw) lib/tests/testprog/zopenrace.py:201: in test wg.wait() golang/_sync.pyx:246: in golang._sync.PyWorkGroup.wait ??? golang/_sync.pyx:226: in golang._sync.PyWorkGroup.go.pyrunf ??? lib/tests/testprog/zopenrace.py:165: in T1 t1() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def t1(): transaction.begin() zconn = db.open() root = zconn.root() obj1 = root['obj1'] obj2 = root['obj2'] # obj1 - reload it from zstor # obj2 - get it from zconn cache obj1._p_invalidate() # both objects must have the same values i1 = obj1.i i2 = obj2.i if i1 != i2: > raise AssertionError("T1: obj1.i (%d) != obj2.i (%d)" % (i1, i2)) E AssertionError: T1: obj1.i (3) != obj2.i (2) lib/tests/testprog/zopenrace.py:156: AssertionError
-
Kirill Smelkov authored
Previously if an assert or something failed in spawned thread, the main thread was usually spinning indefinitely = tests hang. -> Switch all threading places to use sync.WorkGroup and this way if a thread fails, all other threads are canceled and the exception is reported back to wg.wait in main thread. Since we start to go this route, NotifyChannel is reworked to fully use channels instead of busy-waiting.
-
- 26 Mar, 2021 1 commit
-
-
Kirill Smelkov authored
setuptools_dso 2 started to emit those autogenerated files. See https://github.com/mdavidsaver/setuptools_dso/pull/15 for details.
-
- 08 Mar, 2021 3 commits
-
-
Kirill Smelkov authored
NEO 1.9 was released in 2018 and is outdated by now. NEO 1.12 is currently the latest NEO release.
-
Kirill Smelkov authored
After switching to ZODB >= 4 in the previous commit, we can safely require zodbtools, because there is now no conflict in between ZODB3/ZODB eggs.
-
Kirill Smelkov authored
It's been a while since last ZODB3 3.10.7 release in 2016 and the last commit in upstream ZODB3 repository (3.10 branch) is from 2017. The world switched since then to ZODB4 and to ZODB5 after that. We were still requiring ZODB3, because ZODB3 3.11 egg was just a dependency on newer ZODB, ZEO, BTrees and persistent; and this way we could be supporting all ZODB3.10.x and ZODB4 and ZODB5 via ZODB3.11. However upcoming Wendelin.core 2, for its proper working, needs MVCC semantic as implemented in ZODB5. This forces us, even for ZODB4, to backport non-trivial bits from ZODB5 (see [1]). Maintaining ZODB3 support at this point becomes non-practical, because, to our knowledge, there is no wendelin.core user that plans to continue using ZODB3 without switching to at least ZODB4 in the near future. So goodbye ZODB3. Even though ZODB still stays with us, it gives a feeling similar to [2], because in 2014, when I was myself learning ZODB, it was through ZODB3 - still at the time when all ZODB bits were living together in one place. [1] nexedi/ZODB!1 [2] https://lists.osuosl.org/pipermail/darcs-users/2008-September/014095.html
-
- 11 Dec, 2020 1 commit
-
-
Kirill Smelkov authored
DB.close() does `del self.storage`. https://github.com/zopefoundation/ZODB/blob/5.6.0-14-g0eae10cd0/src/ZODB/DB.py#L646 This way if DB was closed, but some conn(s) were not, it will crash in teardown as e.g. below: _____________ ERROR at teardown of test_bigfile_zblk1_zdata_reuse ______________ def teardown_module(): > testdb.teardown() bigfile/tests/test_filezodb.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <wendelin.lib.testing.TestDB_ZEO object at 0x7fb9c0216350> def teardown(self): # close connections that test code forgot to close for connref, tb in self.connv: conn = connref() if conn is None: continue if not conn.opened: continue # still alive, but closed print("W: testdb: teardown: %s left not closed by test code" "; opened by:\n%s" % (conn, tb), file=sys.stderr) db = conn.db() > stor = db.storage E AttributeError: 'DB' object has no attribute 'storage' lib/testing.py:217: AttributeError The fix is simple - don't use db.storage at all, because it is not actually used in that code.
-
- 17 Nov, 2020 2 commits
-
-
Kirill Smelkov authored
Since ZBigFile keeps references to fileh objects that are created through it it forms a file <=> fileh cycle that is not collected without cyclic GC: https://lab.nexedi.com/nexedi/wendelin.core/blob/v0.13-52-ga702d41/bigfile/file_zodb.py#L497 https://lab.nexedi.com/nexedi/wendelin.core/blob/v0.13-52-ga702d41/bigfile/file_zodb.py#L566-571 We did not noticed this leak until now because it is small, but with upcoming wendelin.core 2 it is important to release a fileh, because there is WCFS connection associated with fileh, and if fileh is not released, that connection also stays alive, keeping on-WCFS resources still being used, and preventing WCFS from being unmounted cleanly. -> Add cyclic GC support to PyBigFile / PyBigFileH NOTE: we still don't allow PyVMA <=> PyBigFileH cycles to be collected, because fileh_close called from fileh.__del__ asserts that there are no live mappings left. See added comments for details. There is no known practical need to use such cycles, so this should be ok. See also other patches on cyclic GC topic: - 450ad804 (bigarray: ArrayRef support for BigArray) // adds cyclic GC support for PyVMA - d97641d2 (bigfile/py: Properly untrack PyVMA from GC before dealloc) /proposed-for-review-on nexedi/wendelin.core!12
-
Kirill Smelkov authored
The logic in pyvma_traverse and pyvma_clear needs to be synchronized with PyVMA deallocation. In the next patche we'll be amending this logic, and it will help a reader to keep all those functions together. For the reference: PyVMA support for cyclic GC was introduced in 450ad804 (bigarray: ArrayRef support for BigArray). See also d97641d2 (bigfile/py: Properly untrack PyVMA from GC before dealloc). /proposed-for-review-on nexedi/wendelin.core!12
-
- 03 Nov, 2020 2 commits
-
-
Kirill Smelkov authored
Otherwise when /bin/sh is dash it fails with t/tfault-run: 35: test: on_pagefault: unexpected operator
-
Kirill Smelkov authored
Otherwise, if previous test.fault failed, tfault-run fails to start, e.g. >>> test.fault $ make test.fault # MAKEFLAGS=-j1 x86_64-linux-gnu-gcc -pthread -g -Wall -D_GNU_SOURCE -std=gnu99 -fplan9-extensions -Wno-declaration-after-statement -Wno-error=declaration-after-statement -Iinclude -I3rdparty/ccan -I3rdparty/include bigfile/tests/tfault.c lib/bug.c lib/utils.c 3rdparty/ccan/ccan/tap/tap.c -o bigfile/tests/tfault.t t/tfault-run bigfile/tests/tfault.t faultr on_pagefault mkdir: cannot create directory ‘t/tfault-run.faultr’: File exists Makefile:186: recipe for target 'faultr.tfault' failed make: *** [faultr.tfault] Error 1 rm bigfile/tests/tfault.t error test.fault 0.433s # 1t 1e 0f 0s
-
- 02 Nov, 2020 1 commit
-
-
Kirill Smelkov authored
Nxdtest[1] is tox-like tool to run tests under Nexedi testing infrastructure. See [2] for details. [1] https://lab.nexedi.com/nexedi/nxdtest [2] nexedi/slapos!839
-
- 11 Sep, 2020 1 commit
-
-
Kirill Smelkov authored
We need the following patch of mine: http://git.ozlabs.org/?p=ccan;a=commitdiff;h=b97c7f0841f5173a07a2571f2c99f944d8405a90
-
- 17 May, 2020 2 commits
-
-
Kirill Smelkov authored
-
Kirill Smelkov authored
It is hard for people to understand current wording, so let's expand zconn_at description to additionally explain what it is providing with second set of words, which, hopefully, lowers potential ambiguity a bit. /reported-by @jwolf083
-
- 17 Apr, 2020 1 commit
-
-
Kirill Smelkov authored
Pygolang egg provides "golang" python package, not "pygolang". Bug introduced in 5c8340d2 (*: Use defer for dbclose & friends).
-
- 15 Apr, 2020 10 commits
-
-
Kirill Smelkov authored
In PEP517 mode setup.py is sourced - not executed - and the build fails with ImportError like this: Preparing wheel metadata ... error ERROR: Command errored out with exit status 1: command: /home/kirr/src/wendelin/venv/z-dev/bin/python2 /home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp2F3aEs cwd: /home/kirr/src/wendelin/wendelin.core Complete output (53 lines): running dist_info creating /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info writing requirements to /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/requires.txt writing /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/PKG-INFO writing top-level names to /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/top_level.txt writing dependency_links to /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/dependency_links.txt writing entry points to /tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/entry_points.txt writing manifest file '/tmp/pip-modern-metadata-sPiqUt/wendelin.core.egg-info/SOURCES.txt' package init file '__init__.py' not found (or not a regular file) Traceback (most recent call last): File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module> main() File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 240, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 110, in prepare_metadata_for_build_wheel return hook(metadata_directory, config_settings) File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/build_meta.py", line 155, in prepare_metadata_for_build_wheel self.run_setup() File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/build_meta.py", line 234, in run_setup self).run_setup(setup_script=setup_script) File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/build_meta.py", line 141, in run_setup exec(compile(code, __file__, 'exec'), locals()) File "setup.py", line 374, in <module> """.splitlines()] File "/home/kirr/src/tools/go/pygolang/golang/pyx/build.py", line 118, in setup setuptools_dso.setup(**kw) File "/home/kirr/src/tools/py/pypa/setuptools_dso/src/setuptools_dso/__init__.py", line 37, in setup _setup(**kws) File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup return distutils.core.setup(**attrs) File "/usr/lib/python2.7/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/dist_info.py", line 31, in run egg_info.run() File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 296, in run self.find_sources() File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources mm.run() File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 534, in run self.add_defaults() File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 574, in add_defaults rcfiles = list(walk_revctrl()) File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/setuptools/command/sdist.py", line 20, in walk_revctrl for item in ep.load()(dirname): File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2434, in load return self.resolve() File "/home/kirr/src/wendelin/venv/z-dev/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2444, in resolve raise ImportError(str(exc)) ImportError: 'module' object has no attribute 'git_lsfiles' See comments added to register_as_entrypoint for explanation of what happens. Wendelin.core will soon switch to PEP517 mode (by adding pyproject.toml) to build-require Cython, Pygolang and friends.
-
Kirill Smelkov authored
Wendelin.core 2 will need to spawn WCFS filesystem server that accesses the same ZODB database as the program that spawns it. The database argument passed to WCFS is passed in the form of URL[1,2]. Even though zodburi provides way to convert an URL into ZODB storage instance, there is currently no way for reverse operation - to convert ZODB storage instance into URL to access it(*). So we have to build it by our own. Provide zstor_2zurl stub that currently works for FileStorage only. ZEO and NEO support is TODO. In the future we might want to move this functionality into zodbtools/py. [1] https://lab.nexedi.com/nexedi/zodbtools/blob/a2e4dd23/zodbtools/help.py#L27-53 [2] https://lab.nexedi.com/kirr/neo/blob/3d909114/go/zodb/zodbtools/help.go#L25-51 (*) contrary to ZODB/go where this functionality is provided out of the box: https://godoc.org/lab.nexedi.com/kirr/neo/go/zodb#IStorage
-
Kirill Smelkov authored
Wendelin.core 2 will need to hook into when client ZODB.Connection changes its database view and readjust WCFS-level client connection accordingly. ZODB.Connection can change its view on either connection reopen, or even without reopen on start of new transaction. This patch implements ZODB.Connection.onResyncCallback for ZODB5 only. ZODB4 and ZODB3 support is TODO.
-
Kirill Smelkov authored
For wendelin.core v2 we need a way to know at which particular database state application-level ZODB connection is viewing the database. Knowing that state, WCFS client library will interact with WCFS filesystem server and, in simple terms, request the server to provide data as of that particular database state. Contrary to ZODB/go[1] ZODB/py does not provide the functionality to obtain DB state of connection view, so we have to build it ourselves. Let us call the function that for a client ZODB connection returns database state corresponding to its database view as zconn_at. It is relatively easy to implement zconn_at for ZODB5, since ZODB5 adopted MVCC uniformly and this patch does just that. However even with ZODB5 currently all released ZODB5 versions have race in Connection.open() vs invalidations[2], and so the first ZODB5 release with which zconn_at implemented here will work reliable should be upcoming ZODB 5.5.2 It is TODO to implement zconn_at for ZODB4 and ZODB3, which organize things differently. Please note what would happen if zconn_at gives, even a bit, incorrect answer: wcfs client will ask wcfs server to provide array data as of different database state compared to current on-client ZODB connection. This will result in that data accessed via ZBigArray will _not_ correspond to all other data accessed via regular ZODB mechanism. It is, in other words, would be a data corruptions. [1] https://godoc.org/lab.nexedi.com/kirr/neo/go/zodb#Connection [2] https://github.com/zopefoundation/ZODB/issues/290
-
Kirill Smelkov authored
This will be needed in the following patches to know how to inject zconn_at or zconn resync functionality into particular ZODB version.
-
Kirill Smelkov authored
- mention in comments that _ZBigFileH not only proxies changes from virtmem -> ZODB, but also the other way: virtmem <- ZODB. - refresh comments, fix typo.
-
Kirill Smelkov authored
- Provide brief top-level overview + refresh loadblk/storeblk/release comments. - Add `typedef struct bigfile_ops bigfile_ops` that we usually add for all structs.
-
Kirill Smelkov authored
It is valid to compare a Page and a VMA only if they belong to the same fileh.
-
Kirill Smelkov authored
-> into vma_page_infilerange(). We will soon need to use this functionality from several places.
-
Kirill Smelkov authored
Start preparing vma early, not after the call to mem_valloc. This codeflow will be more convenient when we add mmap-through-wcfs codepath.
-
- 14 Apr, 2020 4 commits
-
-
Kirill Smelkov authored
-
Kirill Smelkov authored
We are soon going to use this functionality from several places. The place to perform the mmap is changed slightly because vma_mmap_page deduces prot from page->state and for that we have to finish preparing page->state first.
-
Kirill Smelkov authored
Freed Page structs must be in PAGE_EMPTY state.
-
Kirill Smelkov authored
The code sequence of list_del(&page->lru); bzero(page, sizeof(*page)); /* just in case */ free(page); was open-coded several times.
-
- 01 Apr, 2020 2 commits
-
-
Kirill Smelkov authored
-
Kirill Smelkov authored
-
- 18 Dec, 2019 8 commits
-
-
Kirill Smelkov authored
This is needed so that e.g. a Python class implemented in C or Cython (cdef class) could inherit from PyBigFile. Don't put _bigfile.h into separate include/ directory, and keep it along main .c file, similarly to how pygolang is organized.
-
Kirill Smelkov authored
Provide package-level documentation that gives brief overview of what this package does. Split internal notes into separate comment.
-
Kirill Smelkov authored
Starting from 5755a6b3 (Basic setup.py / Makefile to build/install/sdist stuff + bigfile.so skeleton) and 35eb95c2 (bigfile: Python wrapper around virtual memory subsystem) we were using Plan9 C extensions[1] for simple inheritance. Those extensions are supported by GCC with -fplan9-extensions option. However that option is supported only for C, while for C++ it does not work at all with error produced by the compiler on Plan9 syntax. Soon we'll need to add another extension - written in C++ - to wendelin.core . This extension will be providing client side of WCFS and integrating that with virtmem. In that extension we'll need to use _bigfile data structures - in particular we'll need to use PyBigFile and extend it with another `cdef class` children written in Cython/C++. This patch prepares for that: first stop using Plan9 C extensions in _bigfile py module data structures and adapt the code correspondingly. In the next patch we'll move those data structures into an .h file. We don't drop -fplan9-extensions from setup.py, because Plan9-style inheritance continues to be used internally by virtmem - e.g. in ram_shmfs.c and friends. A bit pity to drop that good stuff, but given that we'll need to use C++ for WCFS client for other good stuff provided by pygolang[2], it is a reasonable compromise. [1] http://9p.io/sys/doc/comp.html "Extensions" section [2] https://pypi.org/project/pygolang
-
Kirill Smelkov authored
It was from long-ago marked as "XXX move to common place".
-
Kirill Smelkov authored
I noticed this while working on WCFS: if file blocks topology change, the invalidation process is not working correctly. It is also not correct with respect to live cache pressure. Add FIXME in the code and test for live cache pressure. kirr/wendelin.core@5a4562fc kirr/wendelin.core@48eb692f kirr/wendelin.core@d1a579b2 kirr/wendelin.core@69c94fbc
-
Kirill Smelkov authored
For ZBlk0 this is trivial, but for ZBlk1 it may seem that we could avoid changing ZBlk object itself and mark only pointed-to ZData object as changed. However that would be not correct to do if we consider invalidations. Noticed while working on WCFS.
-
Kirill Smelkov authored
Add package-level documentation to - bigfile/file_zodb.py, - bigarray/array_zodb.py, and - lib/zodb.py The most interesting read is file_zodb.py . Slightly improve documenation for functions in a couple of places. Improving documentation was long overdue and it is improved only slightly by this commit.
-
Kirill Smelkov authored
We already keep FileStorage test database on /tmp/ and NEO itself (via neo.tests.functional.NEOCluster) also keeps test data on tmpfs. However test database for ZEO was created in current directory and was wearing out SSD unnecessarily. FIXME zeo_forker currently does not provide API to keep all server files in particular place. This way server conf and log are still emitted in current directory, but at least we move data.fs away. Since conf and log are uniquely named, e.g. server-<ΧΧΧ>.conf and tmpYYY.log, and it was only that Data.fs was named non-uniquely, by moving Data.fs into unique per-server place, this also helps with-ZEO tests to execute correctly in parallel with `tox -p`.
-