-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtxninfo.go
More file actions
43 lines (38 loc) · 795 Bytes
/
txninfo.go
File metadata and controls
43 lines (38 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"math"
"time"
"github.com/jackc/pglogrepl"
)
type txnInfo struct {
xid uint32
count uint
minID int64
maxID int64
committed bool
commitLSN pglogrepl.LSN
// only used for streamed transactions - can't use a global RelationMessage
// since we might be processing several transactions at once
relationV2 *pglogrepl.RelationMessageV2
txnReadTime time.Duration
}
func newTxnInfo(xid uint32) *txnInfo {
return &txnInfo{
xid: xid,
count: 0,
minID: math.MaxInt64,
maxID: math.MinInt64,
committed: false,
commitLSN: 0,
txnReadTime: 0,
}
}
func (t *txnInfo) updateTxnInfoWithRow(row *polorexRow) {
t.count++
if t.minID > row.id {
t.minID = row.id
}
if t.maxID < row.id {
t.maxID = row.id
}
}