handlePseudoQuery handles special pseudo-queries that are used to orchestrate replication tests and returns whether one was handled.
(t *testing.T, server *pgserver.Server, query string, r *logrepl.LogicalReplicator)
| 859 | // handlePseudoQuery handles special pseudo-queries that are used to orchestrate replication tests and returns whether |
| 860 | // one was handled. |
| 861 | func handlePseudoQuery(t *testing.T, server *pgserver.Server, query string, r *logrepl.LogicalReplicator) bool { |
| 862 | switch query { |
| 863 | case createReplicationSlot: |
| 864 | require.NoError(t, r.CreateReplicationSlotIfNotExists(slotName)) |
| 865 | return true |
| 866 | case dropReplicationSlot: |
| 867 | require.NoError(t, r.DropReplicationSlotIfExists(slotName)) |
| 868 | return true |
| 869 | case startReplication: |
| 870 | go func() { |
| 871 | require.NoError(t, r.StartReplication(server.NewInternalCtx(), slotName)) |
| 872 | }() |
| 873 | require.NoError(t, waitForRunning(r)) |
| 874 | return true |
| 875 | case stopReplication: |
| 876 | r.Stop() |
| 877 | return true |
| 878 | case waitForCatchup: |
| 879 | require.NoError(t, waitForCaughtUp(r)) |
| 880 | return true |
| 881 | case sleep: |
| 882 | time.Sleep(200 * time.Millisecond) |
| 883 | return true |
| 884 | } |
| 885 | return false |
| 886 | } |
| 887 | |
| 888 | // clientSpecFromQueryComment returns "replica" if the query is meant to be run on the replica, and "primary" if it's meant |
| 889 | // to be run on the primary, based on the comment in the query. If not comment, the query runs on the primary |
no test coverage detected