ENH: Replace the selected-import transaction in DataStructure with a smaller design

Aperta
#1,950 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
backend

Direzione di ricerca

Read the design review of #1934, especially decisions D1, D3, D4, D7 and D8, then inspect DataStructure, BaseGroup and ImportH5ObjectPathsAction used by ReadDREAM3DFilter. Compare the current publish and rollback failure behavior with a smaller insertion and cleanup mechanism, preserving the listed checks and import behavior. Done means simplifying the transaction, removing unnecessary states, errors and hooks, and updating tests for values, IDs, aliases and geometry references.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement Out-of-Core

Summary

Replace the import-specific publish and rollback transaction that #1934 adds to DataStructure with a smaller design. This is a follow-up to the out-of-core review PR tree. #1934 ("Plan selected imports against the complete destination") merges with the current design. During review it was decided to merge it now and to simplify it here.

How it works after #1934

ImportH5ObjectPathsAction, used by ReadDREAM3DFilter, builds the whole selected import in a copy of the destination (the prepared structure) and then publishes it. Publishing and rollback are in DataStructure:

  • DataStructure::ImportPublicationCheckpoint, a public value class that records the destination and its next ID when the action starts. Publishing rejects a checkpoint from another destination (-6217) or with a changed next ID (-6218).
  • DataStructure::publishImportedObjects(...), which inserts all prepared objects and rolls them back on failure.
  • Partial-cleanup states (Conflict, Children, Refused), errors -6215 and -6216 and retained-object records for a rollback that cannot finish.
  • Test-only fault injection in the public DataStructure.hpp and in the action (setPublicationFaultForTesting, cleanupFailedImportForTesting and related functions).

This is about 840 lines in DataStructure and BaseGroup, and one action uses all of it.

Why it is needed

Review found no normal input that makes publishing fail after the checks that run before it. Only std::bad_alloc and injected test faults reach the cleanup states: Refused is reached only by a test hook, and no normal trigger was shown for Conflict or Children. No in-tree caller can trigger the checkpoint errors, because the resolver and the finalizer run on the prepared structure, not on the destination.

Requested change

  • Keep the checks that run before publishing. Report a failure and stop the pipeline. Do not treat a failed import as complete.
  • Publish with a smaller mechanism, for example the normal insert path plus a list of inserted IDs that are removed in reverse order on an exception. The mechanism is still open.
  • Remove the partial-cleanup states, errors -6215 and -6216 and the retained records, unless a real case is found that needs them.
  • Remove the public checkpoint class and errors -6217 and -6218, unless a current caller needs them. Keep the normal path, parent and ID checks.
  • Send no DataRemovedMessage for objects that were inserted and then rolled back before their addition was announced. Today rollback sends removal messages, but publishing sends no addition messages.
  • Remove the test hooks that the smaller design no longer needs.

Do not describe the result as an all-or-nothing guarantee. An insertion can fail after it changes part of the hierarchy but before its ID is registered, and cleanup can itself allocate or fail. The existing IDataAction contract allows an inconsistent destination after an error. Before replacing the current code, check that the smaller design does not make failure behavior worse than it is now. If it does, keep the needed protection.

Keep unchanged

  • Aliases (two selected paths to one source object) still import as separate copies with their own IDs and remapped geometry references.
  • The prepared structure is not swapped into the destination, because a swap would replace existing objects and invalidate pointers to them.
  • Both modes of the metadata cache, and the public fetch() behavior.

Tests

Keep the existing tests of values, IDs, aliases and geometry references. Where a failure must still be tested, use a real failure when one reliably reaches the step on Linux, Windows and macOS. Keep a focused hook only for a case that cannot be reached otherwise, for example an allocation failure partway through an insertion.

The design review of #1934 lists these options as decisions D1, D3, D4, D7 and D8.

Lingua principale
C++
Stelle
18
Fork
15
Merge medio
4g 23h
PR unite (30g)
42

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di BlueQuartzSoftware/simplnx

Tutte le issue di BlueQuartzSoftware/simplnx

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.