Beispiel #1
0
 def push():
     try:
         pack_tid = None  # TODO
         for tid in tid_list:
             if tid in peer_tid_set:
                 peer_tid_set.remove(tid)
             else:
                 t = dm.getTransaction(tid)
                 if t is None:
                     conn.send(
                         Errors.ReplicationError(
                             "partition %u dropped" % partition),
                         msg_id)
                     return
                 oid_list, user, desc, ext, packed, ttid = t
                 conn.send(
                     Packets.AddTransaction(tid, user, desc, ext,
                                            packed, ttid, oid_list),
                     msg_id)
                 yield
         conn.send(
             Packets.AnswerFetchTransactions(pack_tid, next_tid,
                                             peer_tid_set), msg_id)
         yield
     except (weakref.ReferenceError, ConnectionClosed):
         pass
Beispiel #2
0
 def push():
     try:
         pack_tid = None  # TODO
         for tid in tid_list:
             if tid in peer_tid_set:
                 peer_tid_set.remove(tid)
             else:
                 t = dm.getTransaction(tid)
                 if t is None:
                     conn.send(
                         Errors.ReplicationError(
                             "partition %u dropped" % partition),
                         msg_id)
                     return
                 oid_list, user, desc, ext, packed, ttid = t
                 # Sending such packet does not mark the connection
                 # for writing if there's too little data in the buffer.
                 conn.send(
                     Packets.AddTransaction(tid, user, desc, ext,
                                            bool(packed), ttid,
                                            oid_list), msg_id)
                 # To avoid delaying several connections simultaneously,
                 # and also prevent the backend from scanning different
                 # parts of the DB at the same time, we ask the
                 # scheduler not to switch to another background task.
                 # Ideally, we are filling a buffer while the kernel
                 # is flushing another one for a concurrent connection.
                 yield conn.buffering
         conn.send(
             Packets.AnswerFetchTransactions(pack_tid, next_tid,
                                             peer_tid_set), msg_id)
         yield
     except (weakref.ReferenceError, ConnectionClosed):
         pass