From e716e9a1f2c88f43ebdd64be7892cfd35caf8d11 Mon Sep 17 00:00:00 2001 From: Georgy Shelkovy Date: Fri, 1 Nov 2024 16:11:42 +0500 Subject: [PATCH] fix --- restore/data.go | 2 +- restore/data_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/restore/data.go b/restore/data.go index 96163d8e6..ae8965c7b 100644 --- a/restore/data.go +++ b/restore/data.go @@ -40,7 +40,7 @@ func CopyTableIn(queryContext context.Context, connectionPool *dbconn.DBConn, ta //helper.go handles compression, so we don't want to set it here customPipeThroughCommand = utils.DefaultPipeThroughProgram errorFile := fmt.Sprintf("%s_error", globalFPInfo.GetSegmentPipePathForCopyCommand()) - readFromDestinationCommand = fmt.Sprintf("(timeout 300 bash -c \"while [[ ! -p \"%s\" && ! -f \"%s\" ]]; do sleep 1; done\" || (echo \"Pipe not found %s\">&2; exit 1)) && %s", destinationToRead, errorFile, destinationToRead, readFromDestinationCommand) + readFromDestinationCommand = fmt.Sprintf("(timeout --foreground 300 bash -c \"while [[ ! -p \"%s\" && ! -f \"%s\" ]]; do sleep 1; done\" || (echo \"Pipe not found %s\">&2; exit 1)) && %s", destinationToRead, errorFile, destinationToRead, readFromDestinationCommand) } else if MustGetFlagString(options.PLUGIN_CONFIG) != "" { readFromDestinationCommand = fmt.Sprintf("%s restore_data %s", pluginConfig.ExecutablePath, pluginConfig.ConfigPath) } diff --git a/restore/data_test.go b/restore/data_test.go index 48452991b..b1667c8dc 100644 --- a/restore/data_test.go +++ b/restore/data_test.go @@ -57,7 +57,7 @@ var _ = Describe("restore/data tests", func() { Expect(err).ShouldNot(HaveOccurred()) }) It("will restore a table from a single data file", func() { - execStr := regexp.QuoteMeta(fmt.Sprintf("COPY public.foo(i,j) FROM PROGRAM '(timeout 300 bash -c \"while [[ ! -p \"/backups/20170101/20170101010101/gpbackup__20170101010101_pipe_3456\" && ! -f \"/gpbackup__20170101010101_pipe_%d_error\" ]]; do sleep 1; done\" || (echo \"Pipe not found /backups/20170101/20170101010101/gpbackup__20170101010101_pipe_3456\">&2; exit 1)) && cat /backups/20170101/20170101010101/gpbackup__20170101010101_pipe_3456' WITH CSV DELIMITER ',' ON SEGMENT", os.Getpid())) + execStr := regexp.QuoteMeta(fmt.Sprintf("COPY public.foo(i,j) FROM PROGRAM '(timeout --foreground 300 bash -c \"while [[ ! -p \"/backups/20170101/20170101010101/gpbackup__20170101010101_pipe_3456\" && ! -f \"/gpbackup__20170101010101_pipe_%d_error\" ]]; do sleep 1; done\" || (echo \"Pipe not found /backups/20170101/20170101010101/gpbackup__20170101010101_pipe_3456\">&2; exit 1)) && cat /backups/20170101/20170101010101/gpbackup__20170101010101_pipe_3456' WITH CSV DELIMITER ',' ON SEGMENT", os.Getpid())) mock.ExpectExec(execStr).WillReturnResult(sqlmock.NewResult(10, 0)) filename := "/backups/20170101/20170101010101/gpbackup__20170101010101_pipe_3456" _, err := restore.CopyTableIn(context.Background(), connectionPool, "public.foo", "(i,j)", filename, true, 0)