Skip to content

Commit 38afd01

Browse files
craig[bot]yuzefovich
andcommitted
Merge #147388
147388: import: remove miscellaneous usages of deprecated PGDUMP and MYSQLDUMP r=yuzefovich a=yuzefovich This PR contains several commits that remove usages of deprecated as of 23.2 PGDUMP and MYSQLDUMP options. It removes a CLI command as well as updates a few tests that seem worth keeping. Epic: None Release note: None Co-authored-by: Yahor Yuzefovich <[email protected]>
2 parents 0ae584a + 3a15a0e commit 38afd01

27 files changed

+184
-833
lines changed

pkg/cli/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ go_library(
3838
"gen.go",
3939
"gen_encryption.go",
4040
"haproxy.go",
41-
"import.go",
4241
"init.go",
4342
"log_flags.go",
4443
"mt.go",
@@ -356,7 +355,6 @@ go_test(
356355
"gen_encryption_test.go",
357356
"gen_test.go",
358357
"haproxy_test.go",
359-
"import_test.go",
360358
"log_flags_test.go",
361359
"main_test.go",
362360
"node_test.go",

pkg/cli/cli.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ func init() {
256256
nodeCmd,
257257
nodeLocalCmd,
258258
userFileCmd,
259-
importCmd,
260259

261260
// Miscellaneous commands.
262261
// TODO(pmattis): stats

pkg/cli/cliflags/flags.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,47 +1813,6 @@ whether the generated zip file is valid and not corrupted.
18131813
Description: `Cancel all outstanding requests.`,
18141814
}
18151815

1816-
ImportSkipForeignKeys = FlagInfo{
1817-
Name: "skip-foreign-keys",
1818-
Description: `
1819-
Speed up data import by ignoring foreign key constraints in the dump file's DDL.
1820-
Also enables importing individual tables that would otherwise fail due to
1821-
dependencies on other tables.
1822-
`,
1823-
}
1824-
1825-
ImportMaxRowSize = FlagInfo{
1826-
Name: "max-row-size",
1827-
Description: `
1828-
Override limits on line size when importing Postgres dump files. This setting
1829-
may need to be tweaked if the Postgres dump file has extremely long lines.
1830-
`,
1831-
}
1832-
1833-
ImportIgnoreUnsupportedStatements = FlagInfo{
1834-
Name: "ignore-unsupported-statements",
1835-
Description: `
1836-
Ignore statements that are unsupported during an import from a PGDUMP file.
1837-
`,
1838-
}
1839-
1840-
ImportLogIgnoredStatements = FlagInfo{
1841-
Name: "log-ignored-statements",
1842-
Description: `
1843-
Log unsupported statements that are ignored during an import from a PGDUMP file to the specified
1844-
destination. This flag should be used in conjunction with the ignore-unsupported-statements flag
1845-
that ignores the unsupported statements during an import.
1846-
`,
1847-
}
1848-
1849-
ImportRowLimit = FlagInfo{
1850-
Name: "row-limit",
1851-
Description: `
1852-
Specify the number of rows that will be imported for each table during a PGDUMP or MYSQLDUMP import.
1853-
This can be used to check schema and data correctness without running the entire import.
1854-
`,
1855-
}
1856-
18571816
Log = FlagInfo{
18581817
Name: "log",
18591818
Description: `Logging configuration, expressed using YAML syntax.

pkg/cli/context.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ func initCLIDefaults() {
5959
setDemoContextDefaults()
6060
setStmtDiagContextDefaults()
6161
setAuthContextDefaults()
62-
setImportContextDefaults()
6362
setUserfileContextDefaults()
6463
setCertContextDefaults()
6564
setDebugRecoverContextDefaults()
@@ -706,23 +705,6 @@ func setStmtDiagContextDefaults() {
706705
stmtDiagCtx.all = false
707706
}
708707

709-
// importCtx captures the command-line parameters of the 'import' command.
710-
var importCtx struct {
711-
maxRowSize int
712-
skipForeignKeys bool
713-
ignoreUnsupported bool
714-
ignoreUnsupportedLog string
715-
rowLimit int
716-
}
717-
718-
func setImportContextDefaults() {
719-
importCtx.maxRowSize = 512 * (1 << 10) // 512 KiB
720-
importCtx.skipForeignKeys = false
721-
importCtx.ignoreUnsupported = false
722-
importCtx.ignoreUnsupportedLog = ""
723-
importCtx.rowLimit = 0
724-
}
725-
726708
// userfileCtx captures the command-line parameters of the
727709
// `userfile` command.
728710
// See below for defaults.

pkg/cli/flags.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,6 @@ func init() {
697697
clientCmds = append(clientCmds, authCmds...)
698698
clientCmds = append(clientCmds, nodeCmds...)
699699
clientCmds = append(clientCmds, nodeLocalCmds...)
700-
clientCmds = append(clientCmds, importCmds...)
701700
clientCmds = append(clientCmds, userFileCmds...)
702701
clientCmds = append(clientCmds, stmtDiagCmds...)
703702
clientCmds = append(clientCmds, debugResetQuorumCmd)
@@ -815,7 +814,6 @@ func init() {
815814
sqlCmds = append(sqlCmds, demoCmd.Commands()...)
816815
sqlCmds = append(sqlCmds, stmtDiagCmds...)
817816
sqlCmds = append(sqlCmds, nodeLocalCmds...)
818-
sqlCmds = append(sqlCmds, importCmds...)
819817
sqlCmds = append(sqlCmds, userFileCmds...)
820818
for _, cmd := range sqlCmds {
821819
clientflags.AddSQLFlags(cmd, &cliCtx.clientOpts, sqlCtx,
@@ -933,25 +931,6 @@ func init() {
933931
cliflagcfg.BoolFlag(stmtDiagCancelCmd.Flags(), &stmtDiagCtx.all, cliflags.StmtDiagCancelAll)
934932
}
935933

936-
// import dump command.
937-
{
938-
d := importDumpFileCmd.Flags()
939-
cliflagcfg.BoolFlag(d, &importCtx.skipForeignKeys, cliflags.ImportSkipForeignKeys)
940-
cliflagcfg.IntFlag(d, &importCtx.maxRowSize, cliflags.ImportMaxRowSize)
941-
cliflagcfg.IntFlag(d, &importCtx.rowLimit, cliflags.ImportRowLimit)
942-
cliflagcfg.BoolFlag(d, &importCtx.ignoreUnsupported, cliflags.ImportIgnoreUnsupportedStatements)
943-
cliflagcfg.StringFlag(d, &importCtx.ignoreUnsupportedLog, cliflags.ImportLogIgnoredStatements)
944-
cliflagcfg.StringFlag(d, &cliCtx.clientOpts.Database, cliflags.Database)
945-
946-
t := importDumpTableCmd.Flags()
947-
cliflagcfg.BoolFlag(t, &importCtx.skipForeignKeys, cliflags.ImportSkipForeignKeys)
948-
cliflagcfg.IntFlag(t, &importCtx.maxRowSize, cliflags.ImportMaxRowSize)
949-
cliflagcfg.IntFlag(t, &importCtx.rowLimit, cliflags.ImportRowLimit)
950-
cliflagcfg.BoolFlag(t, &importCtx.ignoreUnsupported, cliflags.ImportIgnoreUnsupportedStatements)
951-
cliflagcfg.StringFlag(t, &importCtx.ignoreUnsupportedLog, cliflags.ImportLogIgnoredStatements)
952-
cliflagcfg.StringFlag(t, &cliCtx.clientOpts.Database, cliflags.Database)
953-
}
954-
955934
// sqlfmt command.
956935
{
957936
f := sqlfmtCmd.Flags()

pkg/cli/flags_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ func TestClientURLFlagEquivalence(t *testing.T) {
294294
anySQL := []string{"sql"}
295295
sqlShell := []string{"sql"}
296296
anyNonSQLShell := []string{"node drain"}
297-
anyImportCmd := []string{"import db pgdump", "import table pgdump"}
298297

299298
testData := []struct {
300299
cmds []string
@@ -312,7 +311,6 @@ func TestClientURLFlagEquivalence(t *testing.T) {
312311
{anyCmd, []string{"--url=postgresql://:12345"}, []string{"--port=12345"}, "", ""},
313312

314313
{sqlShell, []string{"--url=postgresql:///foo"}, []string{"--database=foo"}, "", ""},
315-
{anyImportCmd, []string{"--url=postgresql:///foo"}, []string{"--database=foo"}, "", ""},
316314
{anyNonSQLShell, []string{"--url=postgresql://foo/bar"}, []string{"--host=foo" /*db ignored*/}, "", ""},
317315

318316
{anySQL, []string{"--url=postgresql://foo@"}, []string{"--user=foo"}, "", ""},
@@ -341,7 +339,6 @@ func TestClientURLFlagEquivalence(t *testing.T) {
341339
{anyCmd, []string{"--port=12345", "--url=postgresql://foo"}, []string{"--host=foo", "--port=12345"}, "", ""},
342340
{anyCmd, []string{"--port=baz", "--url=postgresql://foo"}, []string{"--host=foo", "--port=baz"}, "", `invalid port ":baz" after host`},
343341
{sqlShell, []string{"--database=baz", "--url=postgresql://foo"}, []string{"--host=foo", "--database=baz"}, "", ""},
344-
{anyImportCmd, []string{"--database=baz", "--url=postgresql://"}, []string{"--database=baz"}, "", ""},
345342
{anySQL, []string{"--user=baz", "--url=postgresql://foo"}, []string{"--host=foo", "--user=baz"}, "", ""},
346343

347344
{anyCmd, []string{"--insecure=false", "--url=postgresql://foo"}, []string{"--host=foo", "--insecure=false"}, "", ""},
@@ -353,7 +350,6 @@ func TestClientURLFlagEquivalence(t *testing.T) {
353350
{anyCmd, []string{"--port=baz", "--url=postgresql://foo:12345"}, []string{"--host=foo", "--port=12345"}, "", ""},
354351
{anyCmd, []string{"--port=baz", "--url=postgresql://foo:bar"}, nil, `invalid port ":bar" after host`, ""},
355352
{sqlShell, []string{"--database=baz", "--url=postgresql://foo/bar"}, []string{"--host=foo", "--database=bar"}, "", ""},
356-
{anyImportCmd, []string{"--database=baz", "--url=postgresql:///bar"}, []string{"--database=bar"}, "", ""},
357353
{anySQL, []string{"--user=baz", "--url=postgresql://bar@foo"}, []string{"--host=foo", "--user=bar"}, "", ""},
358354

359355
{anyNonSQL, []string{"--insecure=false", "--url=postgresql://foo?sslmode=disable"}, []string{"--host=foo", "--insecure"}, "", ""},
@@ -1325,7 +1321,6 @@ Available Commands:
13251321
13261322
nodelocal upload and delete nodelocal files
13271323
userfile upload, list and delete user scoped files
1328-
import import a db or table from a local PGDUMP or MYSQLDUMP file
13291324
demo open a demo sql shell
13301325
convert-url convert a SQL connection string for use with various client drivers
13311326
gen generate auxiliary files

0 commit comments

Comments
 (0)