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

Timeout when running migration on a large table #168

Open
preciz opened this issue Feb 1, 2017 · 2 comments
Open

Timeout when running migration on a large table #168

preciz opened this issue Feb 1, 2017 · 2 comments

Comments

@preciz
Copy link

preciz commented Feb 1, 2017

I have a simple migration that I would like to run, just adding a boolean column.
The table is around 16M rows, I already upped the timeout value to 12_000_000.
The error is:

alter table my_table

20:16:13.072 [error] Mariaex.Protocol (#PID<0.178.0>) disconnected: ** (Mariaex.Error) [tcp] `recv` failed with: :timeout
** (Mariaex.Error) [tcp] `recv` failed with: :timeout
    (ecto) lib/ecto/adapters/sql.ex:195: Ecto.Adapters.SQL.query!/5
    (ecto) lib/ecto/adapters/mysql.ex:101: anonymous fn/4 in Ecto.Adapters.MySQL.execute_ddl/3
    (elixir) lib/enum.ex:1623: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ecto) lib/ecto/adapters/mysql.ex:101: Ecto.Adapters.MySQL.execute_ddl/3
    (ecto) lib/ecto/migration/runner.ex:98: anonymous fn/2 in Ecto.Migration.Runner.flush/0
    (elixir) lib/enum.ex:1623: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ecto) lib/ecto/migration/runner.ex:96: Ecto.Migration.Runner.flush/0
    (stdlib) timer.erl:181: :timer.tc/2

How should one deal with this situation?

@dbhobbs
Copy link

dbhobbs commented Jun 20, 2017

I'm seeing this as well.

May be related to #162.

@preciz
Copy link
Author

preciz commented Jun 22, 2017

I used this workaround, you might find it temporarily useful:

db_timeout = case System.get_env("DB_TIMEOUT") do
               nil -> 30_000
               "infinity" -> :infinity
             end

config :silo, Silo.Repo,
  ...
  timeout: db_timeout

To run it for example:
MIX_ENV=prod DB_TIMEOUT=infinity mix ecto.migrate --env=prod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants