[dataimport] remove commit_at_flush parameter from MassiveObjectStore
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 09 Nov 2015 15:52:26 +0100
changeset 10876 11a9b2fb83d0
parent 10875 75d1b2d66f18
child 10877 a6a9a8fc94c3
[dataimport] remove commit_at_flush parameter from MassiveObjectStore WARNING: the default value was True, but flush() now never commits.
dataimport/massive_store.py
--- a/dataimport/massive_store.py	Mon Nov 09 15:44:06 2015 +0100
+++ b/dataimport/massive_store.py	Mon Nov 09 15:52:26 2015 +0100
@@ -89,20 +89,17 @@
     iid_maxsize = 1024
 
     def __init__(self, cnx,
-                 commit_at_flush=True,
                  on_commit_callback=None, on_rollback_callback=None,
                  slave_mode=False,
                  source=None):
         """ Create a MassiveObject store, with the following attributes:
 
         - cnx: CubicWeb cnx
-        - commit_at_flush: Boolean. Commit after each flush().
         """
         super(MassiveObjectStore, self).__init__(cnx)
         self.logger = logging.getLogger('dataio.relationmixin')
         self._cnx = cnx
         self.sql = cnx.system_sql
-        self.commit_at_flush = commit_at_flush
         self._data_uri_relations = defaultdict(list)
         self._initialized = {'init_uri_eid': set(),
                              'uri_eid_inserted': set(),
@@ -122,7 +119,6 @@
         self._now = datetime.now()
         self._default_cwuri = make_uid('_auto_generated')
         self._count_cwuri = 0
-        self.commit_at_flush = commit_at_flush
         self.on_commit_callback = on_commit_callback
         self.on_rollback_callback = on_rollback_callback
         # Initialized the meta tables of dataio for warm restart
@@ -221,9 +217,6 @@
             buf.close()
             # Clear data cache
             self._data_uri_relations[rtype] = []
-            # Commit if asked
-            if self.commit_at_flush:
-                self.commit()
 
     def fill_uri_eid_table(self, etype, uri_label):
         """ Fill the uri_eid table
@@ -519,9 +512,6 @@
                              null='NULL', columns=('eid_from', 'eid_to'))
             # Clear data cache
             self._data_relations[rtype] = []
-            # Commit if asked
-            if self.commit_at_flush:
-                self.commit()
 
     def flush_entities(self):
         """ Flush the entities data
@@ -558,9 +548,6 @@
             # Clear data cache
             self._data_entities[etype] = []
         self.flush_meta_data()
-        # Commit if asked
-        if self.commit_at_flush:
-            self.commit()
 
     def flush_meta_data(self):
         """ Flush the meta data (entities table, is_instance table, ...)