MCPcopy Create free account
hub / github.com/apecloud/myduckserver / SelectSubscriptionLsn

Function SelectSubscriptionLsn

pgserver/logrepl/subscription.go:131–142  ·  view source on GitHub ↗
(ctx *sql.Context, subscription string)

Source from the content-addressed store, hash-verified

129}
130
131func SelectSubscriptionLsn(ctx *sql.Context, subscription string) (pglogrepl.LSN, error) {
132 var lsn string
133 if err := adapter.QueryRowCatalog(ctx, catalog.InternalTables.PgSubscription.SelectColumnsStmt(lsnValueColumns), subscription).Scan(&lsn); err != nil {
134 if errors.Is(err, stdsql.ErrNoRows) {
135 // if the LSN doesn't exist, consider this a cold start and return 0
136 return pglogrepl.LSN(0), nil
137 }
138 return 0, err
139 }
140
141 return pglogrepl.ParseLSN(lsn)
142}

Callers 1

StartReplicationMethod · 0.85

Calls 2

QueryRowCatalogFunction · 0.92
SelectColumnsStmtMethod · 0.80

Tested by

no test coverage detected