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

Abierto
#1,950 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 6 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
cpp
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C++
Estrellas
18
Forks
15
Merge medio
4 d 23 h
PR fusionados (30 d)
42

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de BlueQuartzSoftware/simplnx

Todos los issues de BlueQuartzSoftware/simplnx

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.