purpleidea / mgmt

Next generation distributed, event-driven, parallel config management!
https://purpleidea.com/tags/mgmtconfig/
GNU General Public License v3.0
3.58k stars 311 forks source link

optimize the graph shape to not create sub-graphs when possible #724

Open gelisam opened 8 months ago

gelisam commented 8 months ago

Working on #717

gelisam commented 6 months ago

Printing the graphs extracted from each Txn, I see some unexpected results. I expected the first Txn to contain 0, 1, +, and _operator1, the second Txn to contain _operator1, 2, *, and _operator2, and the third Txn to contain "%d%d%d", 0, _operator1, _operator2, and printf. Instead, each Txn contains what I expect plus part of three previous Txn. The third Txn's graph is the one shown in GraphViz.

There are thus two bugs and one source of non-determinism. The first bug is that each Txn contains the dependencies of the inputs, when they should only contain one node per input. The source of non-determinism is that only a subset of the spurious dependencies are added. Finally, the second bug is that the last Txn's graph seems to be the final graph, when instead the final graph should be the union of the graphs from all the Txn's.