database: maintain in memory consistency when removing specs#15777
database: maintain in memory consistency when removing specs#15777tgamblin merged 3 commits intospack:developfrom
Conversation
|
I'm still poking at it, but isn't something like this a better approach? This currently passes all tests along with the one you added here... |
|
@aweits I'm fine with both approaches, so no-problem changing what is in the PR. I did what is here based on the observation that each public method that needs update is wrapped in a transaction so ensuring consistency when the transaction exits would suffice (and |
fixes spack#15773 The performance improvements done in spack#14693 where leaving the DB in an inconsistent state when specs were removed from it. This PR updates the DB internal state whenever it is written to file, but does that using a dictionary that still resides in memory to maintain the performance gain of spack#14693
|
I'm still concerned that I need this bit, I think I'm still missing something. |
a369f67 to
5057adc
Compare
|
Given those constraints, what do you think of this instead? |
|
@aweits Since in the JSON database we encode only I would stick with the first one because it's the one that in my opinion is closest to what it should be once the bug is fixed. In that case I think we should remove specs from dependents by hash without any condition to protect them. Something logically equivalent to: for dep in rec.spec.dependencies(_tracked_deps):
del dep._dependents[spec.dag_hash()]Does that sound reasonable? If so I'll just add a verbose FIXME comment on top of that change to explain the situation in details. |
|
Concur. |
This is to highlight that the current implementation is a workaround to overcome issues that are due to a known bug in dependents computation
The performance improvements done in #14693 where leaving the DB in an inconsistent state when specs were removed from it. This PR updates the DB internal state whenever the DB is written to a file. Note that we still cannot properly enumerate installed dependents, so there is a TODO in this code. Fixing that will require the dependents dictionaries in specs to be re-keyed (either by hash, or not keyed at all -- a list would do). See #11983 for details.
fixes #15773
The performance improvements done in #14693 where leaving the DB in an inconsistent state when specs were removed from it. This PR updates the DB internal state whenever it is written to file, but does that using a dictionary that still resides in memory to maintain the performance gain of #14693.