MCPcopy Create free account
hub / github.com/dolthub/doltgresql / handlePseudoQuery

Function handlePseudoQuery

testing/go/replication_test.go:701–726  ·  view source on GitHub ↗

handlePseudoQuery handles special pseudo-queries that are used to orchestrate replication tests and returns whether one was handled.

(t *testing.T, query string, r *logrepl.LogicalReplicator)

Source from the content-addressed store, hash-verified

699// handlePseudoQuery handles special pseudo-queries that are used to orchestrate replication tests and returns whether
700// one was handled.
701func handlePseudoQuery(t *testing.T, query string, r *logrepl.LogicalReplicator) bool {
702 switch query {
703 case createReplicationSlot:
704 require.NoError(t, r.CreateReplicationSlotIfNecessary(slotName))
705 return true
706 case dropReplicationSlot:
707 require.NoError(t, r.DropReplicationSlot(slotName))
708 return true
709 case startReplication:
710 go func() {
711 require.NoError(t, r.StartReplication(slotName))
712 }()
713 require.NoError(t, waitForRunning(r))
714 return true
715 case stopReplication:
716 r.Stop()
717 return true
718 case waitForCatchup:
719 require.NoError(t, waitForCaughtUp(r))
720 return true
721 case sleep:
722 time.Sleep(200 * time.Millisecond)
723 return true
724 }
725 return false
726}
727
728// clientSpecFromQueryComment returns "replica" if the query is meant to be run on the replica, and "primary" if it's meant
729// to be run on the primary, based on the comment in the query. If not comment, the query runs on the primary

Callers 1

runReplicationScriptFunction · 0.85

Calls 6

waitForRunningFunction · 0.85
waitForCaughtUpFunction · 0.85
DropReplicationSlotMethod · 0.80
StartReplicationMethod · 0.80
StopMethod · 0.45

Tested by

no test coverage detected