[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:20:48 UTC 2009


The following commit has been merged in the master branch:
commit 2ec4e298c3274abc8eaad4230bca8d39a48d2e35
Author: Brice Figureau <brice at daysofwonder.com>
Date:   Mon Aug 11 10:52:50 2008 +0200

    Fix #1502 - abysmal storeconfig performance - part2
    
    Resource parameters whose values are a resource reference (ie require,
    notify...) where always DELETEd/INSERTed because the code comparing
    resource reference compared object instances instead of their values
    (since Puppet::Parser::Resource::Reference doesn't override == ), leading
    to storeconfig performance issues.
    The correct fix would have been to define == in Puppet::Parser::Resource::Reference
    but that might introduce some side effects I don't know.
    Hence, the fix introduces a local compare() method that knows how to
    compare Puppet::Parser::Resource::Reference.
    
    Signed-off-by: Brice Figureau <brice-puppet at daysofwonder.com>

diff --git a/CHANGELOG b/CHANGELOG
index b76d33e..b6f8223 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 0.24.x
+    Fixed #1502 - Fixed poor stored configuration performance
+
     Fixed #1510 - Storeconfiguration fixed for Rails 2.1
 
     Add the -P/--ping option to puppetrun, fixes #1501
diff --git a/lib/puppet/parser/resource/param.rb b/lib/puppet/parser/resource/param.rb
index 9dd3f26..c8dd78a 100644
--- a/lib/puppet/parser/resource/param.rb
+++ b/lib/puppet/parser/resource/param.rb
@@ -66,6 +66,14 @@ class Puppet::Parser::Resource::Param
     def to_s
         "%s => %s" % [self.name, self.value]
     end
+
+    def compare(v,db_value)
+      if (v.is_a?(Puppet::Parser::Resource::Reference))
+        return v.to_s == db_value.to_s
+      else
+        return v == db_value
+      end
+    end
     
     def values_to_remove(db_values)
         values = munge_for_rails(value)
@@ -73,7 +81,7 @@ class Puppet::Parser::Resource::Param
         db_values.collect do |db|
             db unless (db.line == line_number && 
                        values.find { |v| 
-                         v == db.value 
+                         compare(v,db.value)
                        } )
         end.compact
     end
@@ -82,7 +90,7 @@ class Puppet::Parser::Resource::Param
         values = munge_for_rails(value)
         line_number = line_to_i()
         values.collect do |v|
-            v unless db_values.find { |db| (v == db.value && 
+            v unless db_values.find { |db| (compare(v,db.value) && 
                                          line_number == db.line) }
         end.compact
     end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list