Skip to content

Add new properties of the Hash form of Fbe.overwrite inside a transaction - #1329

Open
Thayorns wants to merge 1 commit into
zerocracy:masterfrom
Thayorns:1242
Open

Thayorns wants to merge 1 commit into
zerocracy:masterfrom
Thayorns:1242

Conversation

@Thayorns

Copy link
Copy Markdown
Contributor

When every key of the Hash form of Fbe.overwrite was new to the fact, the in-place branch set them one by one on the live fact. Under Fbe.fb the rules checked the fact after each single assignment, so a pair such as repository and where, which the rules accept only together, failed or passed depending on the order of the keys, and a failure left the first key behind in a fact that no longer matched the rules.

The in-place branch now finds the fact by its identifier inside fb.txn and adds the properties there, so the rules see the finished fact once and a failure rolls all of it back, the same way the recreate branch already works. A fact without an identifier is still filled directly. That only happens on a plain Factbase, where there are no rules to break, and Fbe.repeatedly depends on it for its first marker. If the identifier no longer points at any fact, Fbe::Error is raised with the same message the recreate branch uses.

Callers should read the fact again from the factbase after the call, as they already have to after a recreate, because the transaction commits a fresh copy of the fact.

Closes #1242

@Thayorns

Copy link
Copy Markdown
Contributor Author

@yegor256 take a look please, happy to clarify anything about the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Hash form of Fbe.overwrite adds new properties one by one outside a transaction, leaving a fact that breaks the rules

1 participant