[augeas-devel] Avoiding unnecessary loads

lutter at redhat.com lutter at redhat.com
Wed Jun 30 00:52:13 UTC 2010


As it turns out, the current implementation of aug_load is a little too
naive for real life usage. Since parsing a file is a fairly expensive
operation, aug_load should avoid that as much as possible. See Red Hat's BZ
609228 for the gory details.

Instead of throwing away the entire tree and reparsing every file when
aug_load is called, the implementation now first tries to determine whether
a file really needs to be parsed again. That is the case when

  (a) the file has changed on disk (determined by a different mtime)
  (b) some entry for that file has been changed in the tree, but not been saved
  (c) a file that used to be read is not covered by any transform anymore

This patch series implements the above; most of the complications are in
patch 9/9. The whole implementation heavily relies on using the dirty flag
of nodes to signal which nodes need to be cleaned up/replaced during a
load.

As a side-effect, variables now seemingly survive a reload. This
is accomplished by reevaluating their definitions from /augeas/variables
against the new tree.

David

[1] https://bugzilla.redhat.com/show_bug.cgi?id=609228




More information about the augeas-devel mailing list