diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-21 02:47:47 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-21 02:47:47 +0000 |
commit | 2c2177c74c55af4ee009b0b9835bf824128d5091 (patch) | |
tree | a27614da9b872fa6568b0c102e4da3fad29b6e12 /lib | |
parent | 299bdc1b23bbf39e436f5e67b598d60606ca6513 (diff) | |
download | puppet-2c2177c74c55af4ee009b0b9835bf824128d5091.tar.gz puppet-2c2177c74c55af4ee009b0b9835bf824128d5091.tar.xz puppet-2c2177c74c55af4ee009b0b9835bf824128d5091.zip |
*whew* Fixing the vast majority of the graph-related performance problems. I found a simple solution to handling events produced by generated resources, and that basically fixed all of the performance problems. Transaction tests still fail, but I wanted to get the fix in now so I do not forget it.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1961 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/client/master.rb | 3 | ||||
-rw-r--r-- | lib/puppet/pgraph.rb | 14 | ||||
-rw-r--r-- | lib/puppet/transaction.rb | 13 |
3 files changed, 16 insertions, 14 deletions
diff --git a/lib/puppet/client/master.rb b/lib/puppet/client/master.rb index fb7922937..d6997f631 100644 --- a/lib/puppet/client/master.rb +++ b/lib/puppet/client/master.rb @@ -190,6 +190,9 @@ class Puppet::Client::MasterClient < Puppet::Client Puppet::Storage.init Puppet::Storage.load rescue => detail + if Puppet[:trace] + puts detail.backtrace + end Puppet.err "Corrupt state file %s: %s" % [Puppet[:statefile], detail] begin File.unlink(Puppet[:statefile]) diff --git a/lib/puppet/pgraph.rb b/lib/puppet/pgraph.rb index ce7bc52b8..7be785477 100644 --- a/lib/puppet/pgraph.rb +++ b/lib/puppet/pgraph.rb @@ -66,15 +66,13 @@ class Puppet::PGraph < GRATR::Digraph # Collect all of the edges that the passed events match. Returns # an array of edges. - def matching_edges(events) + def matching_edges(source, events) + unless vertex?(source) + Puppet.warning "Got an event from invalid vertex %s" % source.ref + return [] + end + events.collect do |event| - source = event.source - - unless vertex?(source) - Puppet.warning "Got an event from invalid vertex %s" % source.ref - next - end - # Get all of the edges that this vertex should forward events # to, which is the same thing as saying all edges directly below # This vertex in the graph. diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 7c7aaa38b..2feb3e27d 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -137,8 +137,8 @@ class Transaction # We only have to worry about dependents, because any dependencies # already missed their chance to register an event for us. - dependents = @relgraph.adjacent(resource, - :direction => :out, :type => :edges).reject { |e| ! e.callback } + #dependents = @relgraph.adjacent(resource, + # :direction => :out, :type => :edges).reject { |e| ! e.callback } #sources = @relgraph.adjacent(resource, # :direction => :in, :type => :edges).reject { |e| ! e.callback } @@ -149,9 +149,9 @@ class Transaction else @relgraph.add_edge!(resource, gen_child) end - dependents.each do |edge| - @relgraph.add_edge!(gen_child, edge.target, edge.label) - end + #dependents.each do |edge| + # @relgraph.add_edge!(gen_child, edge.target, edge.label) + #end #sources.each do |edge| # @relgraph.add_edge!(edge.source, gen_child, edge.label) #end @@ -221,7 +221,7 @@ class Transaction end # Collect the targets of any subscriptions to those events - @relgraph.matching_edges(events).each do |edge| + @relgraph.matching_edges(resource, events).each do |edge| @targets[edge.target] << edge end @@ -483,6 +483,7 @@ class Transaction # but a chmod failed? how would i handle that error? dern end + # FIXME This won't work right now. @relgraph.matching_edges(events).each do |edge| @targets[edge.target] << edge end |