You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ec894e4
Browse filesBrowse the repository at this point in the historyBrowse files
build: a stopped query or index no longer loses the main graph (#1555)
A multi-language repository could be left with no .axiomcode/out/graph.sqlite
after its first build: the other languages' graphs sat unpublished under
.axiomcode/out/<lang>, every query said "no graph yet — building one", rebuilt
every language, and lost the main graph again.
The build a query starts ran in the query's process group. A caller that stops
the query (a timeout, Ctrl-C, a host that ends the command's process group)
stopped the build with it: before the main graph was published, or while it was
being indexed, which the build took for a failure and answered by deleting the
solved graph. On a repository whose first build outlasts the caller's timeout,
every query repeated it.
- ax_contract.ensure_graph starts the build in a session of its own, as the
background refresher already is, so it finishes whatever becomes of the query
that started it; a later query finds it running and waits for it.
- axiomcode-build: a signal that arrives once the main language is solved is
held until graph.sqlite points at that graph (the indexer runs in its own
process group); the languages still unsolved are recorded in out/partial, so
the graph reads as stale and the next build builds them. A signal before the
main language is solved stops the build at once, as before.
- A query waiting on a refresh no longer stops waiting when the main graph is
published while the language that holds the edited file is still being
solved: it answered from that language's previous graph.
Tests: tests/multi_language.py gains the stopped-query and stopped-index checks
(single-language and stopped-before-solve controls); its refresh and upgrade
checks pass again. tests/refresh_races.py waits for the repair build before
holding the lock and accepts the wait message #1555 introduced.
Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
ifgraph_broken(repo): returndict(state='building'ifbuilding(repo) else'stale', changed=['.axiomcode/out/graph.sqlite (the pointer to the graph is broken)'], added=[], removed=[])
@@ -389,7 +398,8 @@ def status(repo):
389
398
ifnot (changedoraddedorremoved):
390
399
# a build that already published this tree's main graph and is still solving other languages: the graph a query
391
400
# reads is current, and waiting would be waiting for other languages' compiles
# the new database: a FILE under $OUT/$LANG_ARG. Matched as `*/$LANG_ARG/*` it was any path with the language's name
369
385
# in it, the repository's own included: a repository at .../python/app matched the graph.sqlite SYMLINK, the link was
370
386
# pointed at itself, the previous graph deleted, and every verb after it reported no graph.
@@ -374,7 +390,7 @@ publish_main(){
374
390
# A QUERY NEVER READS A HALF-BUILT GRAPH. The new database gets its symbols, refs and views BEFORE graph.sqlite points
375
391
# at it; until the pointer moves, every verb (and the hooks) keeps answering from the previous graph. Only then is the
376
392
# old one removed: a reader that opened it keeps the file it opened.
377
-
AXIOMCODE_INDEX_DB="$DB" python3 "$H/axiomcode-index""$REPO"|| { restore;echo"indexing the new graph failed — the graph that was there is untouched";exit 1; }
393
+
shielded env AXIOMCODE_INDEX_DB="$DB" python3 "$H/axiomcode-index""$REPO"|| { restore;echo"indexing the new graph failed — the graph that was there is untouched";exit 1; }
378
394
stamp_meta "$DB"
379
395
echo"$STAMP">"$OUT/stamp"
380
396
# the engine that built this graph: the next build, the background refresh above all, starts its search there (see the top)
@@ -396,7 +412,13 @@ publish_main(){
396
412
done
397
413
commit_base
398
414
rm -rf "$PREV"
399
-
MAIN_DONE=1
415
+
MAIN_DONE=1; PUBLISHING=""
416
+
# the languages still unsolved are named in $OUT/partial: the graph is not up to date while it is there, so the next
417
+
# build (a refresh the next query starts, or an index) builds them rather than calling the file table current
if [ -f"$LANGDIR/$l/out/graph.sqlite" ];thenecho"⚠️ the $l graph did not build: $l questions are answered from its PREVIOUS graph, which predates this tree; see $REPO/.axiomcode/build.log"
0 commit comments