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

Function printFile

binlogreplication/binlog_replication_test.go:904–925  ·  view source on GitHub ↗

printFile opens the specified filepath |path| and outputs the contents of that file to stdout.

(path string)

Source from the content-addressed store, hash-verified

902 require.NoError(t, rows.Close())
903
904 rows, err = replicaDatabase.Queryx("select * from db01.t1;")
905 require.NoError(t, err)
906 row = convertMapScanResultToStrings(readNextRow(t, rows))
907 require.Equal(t, "one", row["c1"])
908 require.Equal(t, "\x00o\x00n\x00e", row["c2"])
909 require.NoError(t, rows.Close())
910}
911
912// TestTruncateTable tests that TRUNCATE TABLE is correctly replicated.
913func TestTruncateTable(t *testing.T) {
914 defer teardown(t)
915 startSqlServersWithSystemVars(t, duckReplicaSystemVars)
916 startReplicationAndCreateTestDb(t, mySqlPort)
917
918 // Create a table and insert some data
919 primaryDatabase.MustExec("create table t (pk int primary key);")
920 primaryDatabase.MustExec("insert into t values (1), (2), (3);")
921
922 // Verify the data on the replica
923 waitForReplicaToCatchUp(t)
924 requireReplicaResults(t, "select * from db01.t order by pk;", [][]any{{"1"}, {"2"}, {"3"}})
925
926 // TRUNCATE TABLE and verify the replica
927 primaryDatabase.MustExec("truncate table t;")
928 waitForReplicaToCatchUp(t)

Callers 1

teardownFunction · 0.85

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected