Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error message 'Error converting to int' on ddev import-db #5856

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 0 additions & 27 deletions pkg/ddevapp/ddevapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,33 +709,6 @@ func (app *DdevApp) ImportDB(dumpFile string, extractPath string, progress bool,
return fmt.Errorf("failed to import database: %v\nstdout: %s\nstderr: %s", err, stdout, stderr)
}

// Wait for import to really complete
if app.Database.Type != nodeps.Postgres {
rowsImported := 0
for i := 0; i < 10; i++ {

stdout, _, err := app.Exec(&ExecOpts{
Cmd: `mysqladmin -uroot -proot extended -r 2>/dev/null | awk -F'|' '/Innodb_rows_inserted/ {print $3}'`,
Service: "db",
})
if err != nil {
util.Warning("mysqladmin command failed: %v", err)
}
stdout = strings.Trim(stdout, "\r\n\t ")
newRowsImported, err := strconv.Atoi(stdout)
if err != nil {
util.Warning("Error converting '%s' to int", stdout)
break
}
// See if mysqld is still importing. If it is, sleep and try again
if newRowsImported == rowsImported {
break
}
rowsImported = newRowsImported
time.Sleep(time.Millisecond * 500)
}
}

_, err = app.CreateSettingsFile()
if err != nil {
util.Warning("A custom settings file exists for your application, so DDEV did not generate one.")
Expand Down