Skip to content

Commit 6a046fe

Browse files
committed
GH-5520 NativeStore ValueStore WAL
1 parent 400ef53 commit 6a046fe

File tree

103 files changed

+12076
-394
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+12076
-394
lines changed

.github/workflows/pr-verify.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Build
6363
run: mvn --quiet clean && mvn -B --quiet -T 2C install -Pquick
6464
- name: Test
65-
run: mvn -B test -DskipITs -P-formatting -Dmaven.javadoc.skip -Djapicmp.skip -Denforcer.skip -Danimal.sniffer.skip
65+
run: mvn -B install -DskipITs -P-formatting -Dmaven.javadoc.skip -Djapicmp.skip -Denforcer.skip -Danimal.sniffer.skip
6666
- name: Publish Test Report
6767
if: failure()
6868
uses: scacap/action-surefire-report@v1.9.0
@@ -84,7 +84,7 @@ jobs:
8484
- name: Build
8585
run: mvn --quiet clean && mvn -B --quiet -T 2C install -Pquick
8686
- name: Verify
87-
run: mvn -B verify -PskipUnitTests,-formatting -Dmaven.javadoc.skip -Denforcer.skip -Danimal.sniffer.skip
87+
run: mvn -B install -PskipUnitTests,-formatting -Dmaven.javadoc.skip -Denforcer.skip -Danimal.sniffer.skip
8888
- name: Publish Test Report
8989
if: failure()
9090
uses: scacap/action-surefire-report@v1.9.0
@@ -105,7 +105,7 @@ jobs:
105105
- name: Build
106106
run: mvn --quiet clean && mvn -B --quiet -T 2C install -Pquick
107107
- name: Verify
108-
run: mvn -B verify -PslowTestsOnly,-skipSlowTests,-formatting -Dmaven.javadoc.skip -Djapicmp.skip -Denforcer.skip -Danimal.sniffer.skip
108+
run: mvn -B install -PslowTestsOnly,-skipSlowTests,-formatting -Dmaven.javadoc.skip -Djapicmp.skip -Denforcer.skip -Danimal.sniffer.skip
109109
- name: Publish Test Report
110110
if: failure()
111111
uses: scacap/action-surefire-report@v1.9.0

PLANS.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,83 @@
11
# Codex Execution Plans (ExecPlans):
2-
2+
33
This document describes the requirements for an execution plan ("ExecPlan"), a design document that a coding agent can follow to deliver a working feature or system change. Treat the reader as a complete beginner to this repository: they have only the current working tree and the single ExecPlan file you provide. There is no memory of prior plans and no external context.
4-
4+
55
## How to use ExecPlans and PLANS.md
6-
6+
77
When authoring an executable specification (ExecPlan), follow PLANS.md _to the letter_. If it is not in your context, refresh your memory by reading the entire PLANS.md file. Be thorough in reading (and re-reading) source material to produce an accurate specification. When creating a spec, start from the skeleton and flesh it out as you do your research.
8-
9-
When implementing an executable specification (ExecPlan), do not prompt the user for "next steps"; simply proceed to the next milestone. Keep all sections up to date, add or split entries in the list at every stopping point to affirmatively state the progress made and next steps. Resolve ambiguities autonomously, and commit frequently.
10-
8+
9+
When implementing an executable specification (ExecPlan), do not prompt the user for "next steps"; always proceed to the next milestone. Keep all sections up to date, add or split entries in the list at every stopping point to affirmatively state the progress made and next steps. Resolve ambiguities autonomously and commit frequently.
10+
1111
When discussing an executable specification (ExecPlan), record decisions in a log in the spec for posterity; it should be unambiguously clear why any change to the specification was made. ExecPlans are living documents, and it should always be possible to restart from _only_ the ExecPlan and no other work.
12-
13-
When researching a design with challenging requirements or significant unknowns, use milestones to implement proof of concepts, "toy implementations", etc., that allow validating whether the user's proposal is feasible. Read the source code of libraries by finding or acquiring them, research deeply, and include prototypes to guide a fuller implementation.
14-
12+
13+
When researching a design with challenging requirements or significant unknowns, use milestones to implement proof of concepts, "toy implementations," etc., that allow validating whether the user's proposal is feasible. Read the source code of libraries by finding or acquiring them, research deeply, and include prototypes to guide a fuller implementation.
14+
1515
## Requirements
16-
16+
1717
NON-NEGOTIABLE REQUIREMENTS:
18-
18+
1919
* Every ExecPlan must be fully self-contained. Self-contained means that in its current form it contains all knowledge and instructions needed for a novice to succeed.
2020
* Every ExecPlan is a living document. Contributors are required to revise it as progress is made, as discoveries occur, and as design decisions are finalized. Each revision must remain fully self-contained.
2121
* Every ExecPlan must enable a complete novice to implement the feature end-to-end without prior knowledge of this repo.
22-
* Every ExecPlan must produce a demonstrably working behavior, not merely code changes to "meet a definition".
22+
* Every ExecPlan must produce a demonstrably working behavior, not merely code changes to "meet a definition."
2323
* Every ExecPlan must define every term of art in plain language or do not use it.
24-
24+
2525
Purpose and intent come first. Begin by explaining, in a few sentences, why the work matters from a user's perspective: what someone can do after this change that they could not do before, and how to see it working. Then guide the reader through the exact steps to achieve that outcome, including what to edit, what to run, and what they should observe.
26-
26+
2727
The agent executing your plan can list files, read files, search, run the project, and run tests. It does not know any prior context and cannot infer what you meant from earlier milestones. Repeat any assumption you rely on. Do not point to external blogs or docs; if knowledge is required, embed it in the plan itself in your own words. If an ExecPlan builds upon a prior ExecPlan and that file is checked in, incorporate it by reference. If it is not, you must include all relevant context from that plan.
28-
28+
2929
## Formatting
30-
31-
Format and envelope are simple and strict. Each ExecPlan must be one single fenced code block labeled as `md` that begins and ends with triple backticks. Do not nest additional triple-backtick code fences inside; when you need to show commands, transcripts, diffs, or code, present them as indented blocks within that single fence. Use indentation for clarity rather than code fences inside an ExecPlan to avoid prematurely closing the ExecPlan's code fence. Use two newlines after every heading, use # and ## and so on, and correct syntax for ordered and unordered lists.
32-
30+
31+
Format and envelope are straightforward and strict. Each ExecPlan must be one single fenced code block labeled as `md` that begins and ends with triple backticks. Do not nest additional triple-backtick code fences inside; when you need to show commands, transcripts, diffs, or code, present them as indented blocks within that single fence. Use indentation for clarity rather than code fences inside an ExecPlan to avoid prematurely closing the ExecPlan's code fence. Use two newlines after every heading, use # and ## and so on, and correct syntax for ordered and unordered lists.
32+
3333
When writing an ExecPlan to a Markdown (.md) file where the content of the file *is only* the single ExecPlan, you should omit the triple backticks.
34-
35-
Write in plain prose. Prefer sentences over lists. Avoid checklists, tables, and long enumerations unless brevity would obscure meaning. Checklists are permitted only in the `Progress` section, where they are mandatory. Narrative sections must remain prose-first.
36-
34+
35+
Write in plain prose. Prefer sentences to lists. Avoid checklists, tables, and long enumerations unless brevity would obscure meaning. Checklists are permitted only in the `Progress` section, where they are mandatory. Narrative sections must remain prose-first.
36+
3737
## Guidelines
38-
39-
Self-containment and plain language are paramount. If you introduce a phrase that is not ordinary English ("daemon", "middleware", "RPC gateway", "filter graph"), define it immediately and remind the reader how it manifests in this repository (for example, by naming the files or commands where it appears). Do not say "as defined previously" or "according to the architecture doc." Include the needed explanation here, even if you repeat yourself.
40-
38+
39+
Self-containment and plain language are paramount. If you introduce a phrase that is not ordinary English ("daemon," "middleware," "RPC gateway," "filter graph"), define it immediately and remind the reader how it manifests in this repository (for example, by naming the files or commands where it appears). Do not say "as defined previously" or "according to the architecture doc." Include the necessary explanation here, even if you repeat yourself.
40+
4141
Avoid common failure modes. Do not rely on undefined jargon. Do not describe "the letter of a feature" so narrowly that the resulting code compiles but does nothing meaningful. Do not outsource key decisions to the reader. When ambiguity exists, resolve it in the plan itself and explain why you chose that path. Err on the side of over-explaining user-visible effects and under-specifying incidental implementation details.
42-
43-
Anchor the plan with observable outcomes. State what the user can do after implementation, the commands to run, and the outputs they should see. Acceptance should be phrased as behavior a human can verify ("after starting the server, navigating to [http://localhost:8080/health](http://localhost:8080/health) returns HTTP 200 with body OK") rather than internal attributes ("added a HealthCheck struct"). If a change is internal, explain how its impact can still be demonstrated (for example, by running tests that fail before and pass after, and by showing a scenario that uses the new behavior).
44-
45-
Specify repository context explicitly. Name files with full repository-relative paths, name functions and modules precisely, and describe where new files should be created. If touching multiple areas, include a short orientation paragraph that explains how those parts fit together so a novice can navigate confidently. When running commands, show the working directory and exact command line. When outcomes depend on environment, state the assumptions and provide alternatives when reasonable.
46-
42+
43+
Anchor the plan with observable outcomes. State what the user can do after implementation, the commands to run, and the outputs they should see. Acceptance should be phrased as behavior a human can verify ("after starting the server, navigating to [http://localhost:8080/health](http://localhost:8080/health) returns HTTP 200 with body OK") rather than internal attributes ("added a health check struct"). If a change is internal, explain how its impact can still be demonstrated (for example, by running tests that fail before and pass after, and by showing a scenario that uses the new behavior).
44+
45+
Specify the repository context explicitly. Name files with full repository-relative paths, name functions, and modules precisely, and describe where new files should be created. If touching multiple areas, include a short orientation paragraph that explains how those parts fit together so a novice can navigate confidently. When running commands, show the working directory and exact command line. When outcomes depend on environment, state the assumptions and provide alternatives when reasonable.
46+
4747
Be idempotent and safe. Write the steps so they can be run multiple times without causing damage or drift. If a step can fail halfway, include how to retry or adapt. If a migration or destructive operation is necessary, spell out backups or safe fallbacks. Prefer additive, testable changes that can be validated as you go.
48-
48+
4949
Validation is not optional. Include instructions to run tests, to start the system if applicable, and to observe it doing something useful. Describe comprehensive testing for any new features or capabilities. Include expected outputs and error messages so a novice can tell success from failure. Where possible, show how to prove that the change is effective beyond compilation (for example, through a small end-to-end scenario, a CLI invocation, or an HTTP request/response transcript). State the exact test commands appropriate to the project’s toolchain and how to interpret their results.
50-
50+
5151
Capture evidence. When your steps produce terminal output, short diffs, or logs, include them inside the single fenced block as indented examples. Keep them concise and focused on what proves success. If you need to include a patch, prefer file-scoped diffs or small excerpts that a reader can recreate by following your instructions rather than pasting large blobs.
52-
52+
5353
## Milestones
54-
54+
5555
Milestones are narrative, not bureaucracy. If you break the work into milestones, introduce each with a brief paragraph that describes the scope, what will exist at the end of the milestone that did not exist before, the commands to run, and the acceptance you expect to observe. Keep it readable as a story: goal, work, result, proof. Progress and milestones are distinct: milestones tell the story, progress tracks granular work. Both must exist. Never abbreviate a milestone merely for the sake of brevity, do not leave out details that could be crucial to a future implementation.
56-
56+
5757
Each milestone must be independently verifiable and incrementally implement the overall goal of the execution plan.
58-
58+
5959
## Living plans and design decisions
60-
60+
6161
* ExecPlans are living documents. As you make key design decisions, update the plan to record both the decision and the thinking behind it. Record all decisions in the `Decision Log` section.
6262
* ExecPlans must contain and maintain a `Progress` section, a `Surprises & Discoveries` section, a `Decision Log`, and an `Outcomes & Retrospective` section. These are not optional.
6363
* When you discover optimizer behavior, performance tradeoffs, unexpected bugs, or inverse/unapply semantics that shaped your approach, capture those observations in the `Surprises & Discoveries` section with short evidence snippets (test output is ideal).
6464
* If you change course mid-implementation, document why in the `Decision Log` and reflect the implications in `Progress`. Plans are guides for the next contributor as much as checklists for you.
6565
* At completion of a major task or the full plan, write an `Outcomes & Retrospective` entry summarizing what was achieved, what remains, and lessons learned.
66-
66+
6767
# Prototyping milestones and parallel implementations
68-
68+
6969
It is acceptable—-and often encouraged—-to include explicit prototyping milestones when they de-risk a larger change. Examples: adding a low-level operator to a dependency to validate feasibility, or exploring two composition orders while measuring optimizer effects. Keep prototypes additive and testable. Clearly label the scope as “prototyping”; describe how to run and observe results; and state the criteria for promoting or discarding the prototype.
70-
70+
7171
Prefer additive code changes followed by subtractions that keep tests passing. Parallel implementations (e.g., keeping an adapter alongside an older path during migration) are fine when they reduce risk or enable tests to continue passing during a large migration. Describe how to validate both paths and how to retire one safely with tests. When working with multiple new libraries or feature areas, consider creating spikes that evaluate the feasibility of these features _independently_ of one another, proving that the external library performs as expected and implements the features we need in isolation.
72-
72+
7373
## Skeleton of a Good ExecPlan
74-
74+
7575
```md
7676
# <Short, action-oriented description>
7777

7878
This ExecPlan is a living document. The sections `Progress`, `Surprises & Discoveries`, `Decision Log`, and `Outcomes & Retrospective` must be kept up to date as work proceeds.
7979

80-
If PLANS.md file is checked into the repo, reference the path to that file here from the repository root and note that this document must be maintained in accordance with PLANS.md.
80+
If the PLANS.md file is checked into the repo, reference the path to that file here from the repository root and note that this document must be maintained in accordance with PLANS.md.
8181

8282
## Purpose / Big Picture
8383

@@ -146,7 +146,7 @@ In crates/foo/planner.rs, define:
146146
fn plan(&self, observed: &Observed) -> Vec<Action>;
147147
}
148148
```
149-
149+
150150
If you follow the guidance above, a single, stateless agent -- or a human novice -- can read your ExecPlan from top to bottom and produce a working, observable result. That is the bar: SELF-CONTAINED, SELF-SUFFICIENT, NOVICE-GUIDING, OUTCOME-FOCUSED.
151-
152-
When you revise a plan, you must ensure your changes are comprehensively reflected across all sections, including the living document sections, and you must write a note at the bottom of the plan describing the change and the reason why. ExecPlans must describe not just the what but the why for almost everything.
151+
152+
When you revise a plan, you must ensure your changes are comprehensively reflected across all sections, including the living document sections. You must write a note at the bottom of the plan describing the change and the reason why. ExecPlans must describe not just what but why for almost everything.

core/common/io/src/main/java/org/eclipse/rdf4j/common/io/NioFile.java

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,29 @@ public final class NioFile implements Closeable {
5656

5757
private volatile boolean explictlyClosed;
5858

59+
/**
60+
* Optional factory used to create FileChannel instances, primarily for testing where a delegating channel can
61+
* simulate failures. If not set, {@link FileChannel#open(Path, java.nio.file.OpenOption...)} is used directly.
62+
*/
63+
private static volatile ChannelFactory channelFactory;
64+
65+
/**
66+
* Functional interface for creating FileChannel instances. Intended for test injection.
67+
*/
68+
@FunctionalInterface
69+
public interface ChannelFactory {
70+
FileChannel open(Path path, Set<StandardOpenOption> options) throws IOException;
71+
}
72+
73+
/**
74+
* Install a factory that will be used to create FileChannel instances. Intended for tests only.
75+
*
76+
* Passing {@code null} restores the default behavior.
77+
*/
78+
public static void setChannelFactoryForTesting(ChannelFactory factory) {
79+
channelFactory = factory;
80+
}
81+
5982
/**
6083
* Constructor Opens a file in read/write mode, creating a new one if the file doesn't exist.
6184
*
@@ -110,7 +133,12 @@ private static Set<StandardOpenOption> toOpenOptions(String mode) {
110133
* @throws IOException
111134
*/
112135
private void open() throws IOException {
113-
fc = FileChannel.open(file.toPath(), openOptions);
136+
ChannelFactory factory = channelFactory;
137+
if (factory != null) {
138+
fc = factory.open(file.toPath(), openOptions);
139+
} else {
140+
fc = FileChannel.open(file.toPath(), openOptions);
141+
}
114142
}
115143

116144
/**
@@ -423,4 +451,5 @@ public int readInt(long offset) throws IOException {
423451
}
424452
return buf.getInt(0);
425453
}
454+
426455
}

core/common/iterator/src/main/java/org/eclipse/rdf4j/common/iteration/QueueIteration.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,18 @@ public E getNextElement() {
155155
@Override
156156
public void handleClose() {
157157
done.set(true);
158-
do {
159-
queue.clear(); // ensure extra room is available
160-
} while (!queue.offer(afterLast));
158+
// Drain using dequeue semantics to ensure any producers blocked in put/offer
159+
// are signalled via notFull; avoid relying on clear() which may not signal.
160+
E drained;
161+
while ((drained = queue.poll()) != null) {
162+
// no-op: draining
163+
}
164+
while (!queue.offer(afterLast)) {
165+
// If the offer failed (e.g., a race enqueued between drains), drain and retry
166+
while (queue.poll() != null) {
167+
// continue draining until empty
168+
}
169+
}
161170
checkException();
162171
}
163172

0 commit comments

Comments
 (0)