Repository navigation
Docs: Durability settings and The async executor pages, with tests that pin each statement first (refs #267) - #285
Merged
Merged
Conversation
…at pin each statement first (refs #267) Rows 10 and 11 of the #267 audit. Every sentence about Python behavior on the two pages comes from a test: tests/test_durability_behavior.py and tests/test_async_executor_behavior.py pin it, and tests/test_docs_durability_page.py and tests/test_docs_async_page.py run every Python block of each page in order and compare the printed output, on both builds, with no Java object. What a crash loses at each txWalFlush level cannot be tested (a test cannot cut the power), so the page states it only as what the engine documents, naming the 26.11.1 source (GlobalConfiguration.java, WALFile.java). The page gives no timing and recommends no default: the durability-wal study has not run and the maintainers decide defaults. Read from the engine source and pinned: set_wal_flush is a field of the open Database (not stored), arcadedb.fileSync has JVM scope (absent from schema:database, refused by ALTER DATABASE), the async executor defaults to a WAL write with no flush whatever txWalFlush says, and GraphBatch builds with use_wal=False and wal_flush=no, applies them to the shared executor and puts the earlier settings back on close. Deliberately not claimed: what ALTER DATABASE txWalFlush does to the calling thread, because TransactionContext reads the configured level once, when a thread gets its context. The JVM-only tests that read a thread's flush type are listed in conftest.NATIVE_NA_JVM_TESTS. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #267 (rows 10 and 11). Two pages in one PR, because the executor page and the durability page point at each other:
how-to/durability.adoc(Durability settings) andhow-to/async-executor.adoc(The async executor). Nav gets two lines, and one-sentence links go intoconcurrency.adoc,transactions.adocandbulk-loads.adoc.quickstart.adocis not touched.Tests came first.
tests/test_durability_behavior.pyandtests/test_async_executor_behavior.pypin each sentence about Python behavior, andtests/test_docs_durability_page.pyandtests/test_docs_async_page.pyrun every Python block of each page in order and compare the printed output, with the same helper pattern as the transactions and values pages. They use SQL and the executor getters, no Java object, so they run on both builds. Four tests read a thread's flush type from the Java database and are listed inconftest.NATIVE_NA_JVM_TESTS. Nothing was run locally (no pytest, java or docker for this slice): every block and test file was compiled, pyflakes, black, isort and bandit are clean, and CI is the first real run. Expect that a sentence I derived from the source can fail on one build.The durability page states what a crash loses only as what the engine documents, because no test can lose power. Sources, all engine 26.11.1:
GlobalConfiguration.java(TX_WAL_FLUSH,TX_WAL_GROUP_COMMIT,FILE_SYNCdescriptions: process crash safe at level 0, power loss not; the group commit window; fileSync false skips every flush),WALFile.javalines 798 to 801 (force(false)at level 1,force(true)at level 2),ArcadeDBServer.javalines 650 to 665 (production mode sets level 1),TransactionContext.javaandLocalDatabase.java(walFlushSettingis a field of the open database),GraphBatch.java(builder defaultsuseWAL=false,walFlush=NO; save and restore of the thread and async executor settings),DatabaseAsyncExecutorImpl.javalines 123 and 124 (executor defaults: WAL on, flushNO). The page gives no timing and recommends no default: the durability-wal timed study has not run and the maintainers decide defaults. It does not repeat the one-machine commit times thatconcurrency.adocalready has.What the tests pin:
set_wal_flushaccepts the three lower-case names and refuses anything else with the list; it is not a stored setting; a closed database raisesArcadeDBError;schema:databasereportsarcadedb.txWalFlush(default 0) andarcadedb.txWalGroupCommit(default true);arcadedb.fileSynchas JVM scope, is not in that list, andALTER DATABASErefuses it;ALTER DATABASEstores the flush level and it survives a reopen; the executor's own flush staysnowhateverset_wal_flushorALTER DATABASEsay; aGraphBatchrelaxes the shared executor touse_wal=Falseandno(or to what you pass), puts the earlier settings back on close, also when the block raises, and leaves the flush of your own transactions alone (JVM). Executor: everydb.async_executor()call wraps the one engine executor (settings are shared);close()shuts it down for every wrapper (a submit through a sibling raises with "shut down" in the text, and the sibling'sis_closed()staysFalse); callbacks run on an engine thread; a failed statement without an error callback raises nowhere, stores nothing, and does not stop later statements; positional and named parameters together raiseValueError; four threads can submit to one executor.Surprises and open questions, for the maintainers (nothing filed):
ALTER DATABASEonarcadedb.txWalFlushand the calling thread.TransactionContext.configuredWALFlushis a final field read in the constructor, so it is the value when the thread got its transaction context. The test pins only that a thread that starts after the statement commits with the stored level (JVM). Whether the thread that ran the statement follows it is not pinned and the page says so. The existing durability section ofconcurrency.adocshows the statement with a read of the stored value only, which is also all the page claims. Worth one JVM probe: a secondgetTransaction().getWALFlush()on the same thread afterALTER DATABASE.close()raises the engine's Java exception unwrapped on the JVM build (the async wrapper methods have notry), and a binding error on the native build. The page does not name the class and the test catchesException. Probably wants oneArcadeDBErroron both.db.async_executor()keep separate state over one executor:is_closed()of a sibling staysFalseafter another wrapper closed the engine executor.Database.async_executor()after the engine executor was closed returns a wrapper over the same closed executor (LocalDatabase.async()keeps the field). Not tested and not claimed, becausesetParallelLevelrecreates the worker threads and I could not run it.CI so far: the JVM test workflow on the current head passes (24 of 24 jobs, including both docs-page tests). The native parity legs run now that the PR is ready, and they are the first run of the native-side expectations.
What remains of #267 after this: rows 1 (
ResultSet), 4 (import and export), 5 (DataFrame, Arrow, columns), 6 (server mode), 7 (Cypher 26.11.1 vector features), 8 (functions and events, another agent), 12 (one line on theSchemaAPI) and 13 (find_nearest_by_key), plus the wrong-or-stale list as far as #264 did not take it. Not covered on the pages I added: what a Python callback that raises does inside the executor, and theappend_samples,scan_type,new_edgeandnew_edge_by_keyssubmits (docstrings only).🤖 Generated with Claude Code