# HG changeset patch # User Sylvain Thénault # Date 1274344896 -7200 # Node ID e41cd3bf5080900ea00685a5b570c5a0b95cabee # Parent b143444dc08a11dec1ca12385267d110c75ab739 [migration] fix storage_change migraction to avoid exhausting the server's memory diff -r b143444dc08a -r e41cd3bf5080 server/migractions.py --- a/server/migractions.py Thu May 20 10:40:57 2010 +0200 +++ b/server/migractions.py Thu May 20 10:41:36 2010 +0200 @@ -1200,11 +1200,15 @@ source = self.repo.system_source storage = source.storage(etype, attribute) source.unset_storage(etype, attribute) - rset = self.rqlexec('Any X,A WHERE X is %s, X %s A' - % (etype, attribute), ask_confirm=False) + rset = self.rqlexec('Any X WHERE X is %s' etype, ask_confirm=False) pb = ProgressBar(len(rset)) for entity in rset.entities(): + # fill cache. Do not fetch that attribute using the global rql query + # since we may exhaust memory doing that.... + getattr(entity, attribute) storage.migrate_entity(entity, attribute) + # remove from entity cache to avoid memory exhaustion + del entity[attribute] pb.update() print source.set_storage(etype, attribute, storage)