func (b *PopulatedMessageStream) populateBigTransaction(txn *message.Transaction, entries []*wal.Entry) { txn.MessageCount = len(entries) seen := make(map[string]bool) tables := []message.Table{} for _, entry := range entries { if entry.Type == wal.Insert || entry.Type == wal.Update || entry.Type == wal.Delete { //TODO: key off of something less expensive key := fmt.Sprintf("%v.%v.%v", entry.DatabaseID, entry.TablespaceID, entry.RelationID) _, found := seen[key] if !found { seen[key] = true table := &message.Table{} table.DatabaseName = b.SchemaReader.GetDatabaseName(entry.DatabaseID) table.Namespace, table.Relation = b.SchemaReader.GetNamespaceAndTable(entry.DatabaseID, entry.RelationID) tables = append(tables, *table) } } } txn.Tables = tables }
func (b *PopulatedMessageStream) populateTransaction(txn *message.Transaction, entries []*wal.Entry) { var messages []message.Message for _, entry := range entries { if entry.Type == wal.Insert || entry.Type == wal.Update || entry.Type == wal.Delete { msg := createMessage(entry) msg.PopulateTime = time.Now().UTC() b.populate(msg) msg.PopulateDuration = time.Now().UTC().Sub(msg.PopulateTime) messages = append(messages, *msg) } } txn.Messages = messages }