Skip to content

Instantly share code, notes, and snippets.

@yarmand
Created September 14, 2012 11:05
Show Gist options
  • Save yarmand/3721326 to your computer and use it in GitHub Desktop.
Save yarmand/3721326 to your computer and use it in GitHub Desktop.
2012-09-14 reset_environment do not work for me
[vagrant@u64 workfeed]$ rake --trace dev:reset_environment
(in /opt/workfeed)
** Invoke dev:reset_environment (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute dev:reset_environment
** Invoke restart (first_time)
** Execute restart
memcached(1526): Operation not permitted
memcached: no process found
** Invoke dev:clear_cache (first_time)
** Invoke environment
** Execute dev:clear_cache
** Invoke db:connections:kill_all (first_time)
** Invoke environment
** Execute db:connections:kill_all
psql -U 'postgres' -c "select pg_terminate_backend(procpid) from pg_stat_activity where datname='yam_development';" -t
t
t
t
t
Killing connections to: yam_development
Killing connections to: yam_shards
t
t
t
Killing connections to: yam_development_vert
t
t
t
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Invoke db:connections:kill_all
** Execute db:drop
Dropping yam_shards
Dropping yam_development_vert
** Invoke db:drop (first_time)
** Invoke db:load_config
** Execute db:drop
Dropping yam_development
** Invoke db:create (first_time)
** Invoke db:load_config
** Execute db:create
** Invoke db:create (first_time)
** Invoke db:load_config
** Execute db:create
yam_test already exists
** Invoke db:structure:load (first_time)
** Invoke environment
** Execute db:structure:load
** Invoke db:structure:load (first_time)
** Invoke environment
** Execute db:structure:load
RUNNING: psql -f /opt/workfeed/db/structure_admin.sql yam_shards
RUNNING: psql -f /opt/workfeed/db/structure_vertical.sql yam_development_vert
** Invoke db:migrate (first_time)
** Invoke environment
** Invoke db:pre_migrate (first_time)
** Invoke environment
** Execute db:pre_migrate
== PreMigrateTask: started.
-- /opt/workfeed/db/pre_migrate/000_pg_log_type.sql
NOTICE: drop cascades to 13 other objects
DETAIL: drop cascades to function "pg_log$get_log_data"(timestamp without time zone,timestamp without time zone,text,boolean)
drop cascades to view all_queries_mn
drop cascades to view all_queries_td
drop cascades to view all_queries_wk
drop cascades to view ddl_queries_mn
drop cascades to view ddl_queries_td
drop cascades to view ddl_queries_wk
drop cascades to view dml_queries_mn
drop cascades to view dml_queries_td
drop cascades to view dml_queries_wk
drop cascades to view log_errors_mn
drop cascades to view log_errors_td
drop cascades to view log_errors_wk
-- /opt/workfeed/db/pre_migrate/100_db_util.sql
-- /opt/workfeed/db/pre_migrate/200_misc_util.sql
-- /opt/workfeed/db/pre_migrate/300_pg_log_util.sql
-- /opt/workfeed/db/pre_migrate/400_ut.sql
-- /opt/workfeed/db/pre_migrate/500_views.sql
-- /opt/workfeed/db/pre_migrate/600_ddl_views.sql
-- /opt/workfeed/db/pre_migrate/700_dml_views.sql
-- /opt/workfeed/db/pre_migrate/800_error_log_views.sql
-- /opt/workfeed/db/pre_migrate/900_monitor_views.sql
NOTICE: drop cascades to view mn_unused_public_indexes
NOTICE: view "mn_unused_public_indexes" does not exist, skipping
NOTICE: drop cascades to view mn_waiting_locks
NOTICE: view "mn_waiting_locks" does not exist, skipping
== PreMigrateTask: done (0.0646s).
** Execute db:migrate
== UpgradeShardsAdminTables: Switching connection to :sharding ===============
== UpgradeShardsAdminTables: migrating =======================================
-- drop_table(:network_shards_info)
-> 0.0104s
-- drop_table(:network_shards_map)
-> 0.0024s
-- drop_table(:network_shards_groups)
-> 0.0027s
-- create_table(:network_shards_info, {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "network_shards_info_id_seq" for serial column "network_shards_info.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "network_shards_info_pkey" for table "network_shards_info"
-> 0.0125s
-- create_table(:network_shards_map, {:force=>true, :id=>false})
-> 0.0033s
-- add_index(:network_shards_map, [:start_id, :end_id], {:unique=>true})
-> 0.0066s
-- add_index(:network_shards_map, :group_id)
-> 0.0055s
-- create_table(:network_shards_groups, {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "network_shards_groups_id_seq" for serial column "network_shards_groups.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "network_shards_groups_pkey" for table "network_shards_groups"
-> 0.0061s
-- add_index(:network_shards_groups, [:enabled, :open, :blocks_count], {:name=>"index_groups_on_all_cols"})
-> 0.0049s
== UpgradeShardsAdminTables: migrated (0.0666s) ==============================
== UpgradeShardsAdminTables: Switching connection back =======================
== AddSlavesToShardDb: Switching connection to :sharding =====================
== AddSlavesToShardDb: migrating =============================================
-- add_column(:network_shards_info, :db_slave_host, :string)
-> 0.0049s
-- create_table(:vertical_shards_info, {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "vertical_shards_info_id_seq" for serial column "vertical_shards_info.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "vertical_shards_info_pkey" for table "vertical_shards_info"
-> 0.0087s
== AddSlavesToShardDb: Switching connection back =============================
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::Error: FATAL: terminating connection due to administrator command
FATAL: terminating connection due to administrator command
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"vertical_shards_info"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/postgresql_adapter.rb:505:in `exec'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/postgresql_adapter.rb:505:in `query'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract_adapter.rb:202:in `log_without_timing'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-3.0.17/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/yam-db-charmer-1.7.3.7/lib/db_charmer/rails3/abstract_adapter/connection_name.rb:14:in `instrument'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract_adapter.rb:200:in `log_without_timing'
/opt/workfeed/config/../lib/extensions/timing_ext.rb:88:in `log'
/opt/workfeed/vendor/gems/ninjudd-record_cache-0.9.6/lib/record_cache/../../../../../lib/workfeed/timer.rb:83:in `time_block'
/opt/workfeed/config/../lib/extensions/timing_ext.rb:87:in `log'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/postgresql_adapter.rb:501:in `query'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/postgresql_adapter.rb:1030:in `column_definitions_without_silencer'
(eval):3:in `column_definitions'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-3.0.17/lib/active_support/buffered_logger.rb:30:in `silence'
(eval):2:in `column_definitions'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/postgresql_adapter.rb:680:in `columns'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/base.rb:685:in `columns'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/persistence.rb:295:in `attributes_from_column_definition'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/locking/optimistic.rb:62:in `attributes_from_column_definition'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/base.rb:1400:in `initialize'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/validations.rb:32:in `new'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/validations.rb:32:in `create!'
/opt/workfeed/db/migrate/20120814211704_add_slaves_to_shard_db.rb:34:in `up_without_benchmarks'
/opt/workfeed/lib/sharding/active_record_ext.rb:34:in `suppress_cross_connection_write_errors'
/opt/workfeed/db/migrate/20120814211704_add_slaves_to_shard_db.rb:33:in `up_without_benchmarks'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:314:in `send'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:314:in `migrate_without_db_wrapper'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/benchmark.rb:293:in `measure'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:314:in `migrate_without_db_wrapper'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/yam-db-charmer-1.7.3.7/lib/db_charmer/active_record/migration/multi_db_migrations.rb:37:in `migrate'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/yam-db-charmer-1.7.3.7/lib/db_charmer/active_record/migration/multi_db_migrations.rb:59:in `on_db'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/yam-db-charmer-1.7.3.7/lib/db_charmer/active_record/migration/multi_db_migrations.rb:36:in `migrate'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/yam-db-charmer-1.7.3.7/lib/db_charmer/active_record/migration/multi_db_migrations.rb:35:in `each'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/yam-db-charmer-1.7.3.7/lib/db_charmer/active_record/migration/multi_db_migrations.rb:35:in `migrate'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:397:in `__send__'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:397:in `migrate'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:539:in `migrate'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:613:in `call'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:613:in `ddl_transaction'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/transactions.rb:207:in `transaction_without_shards'
/opt/workfeed/lib/sharding/active_record_ext.rb:63:in `transaction'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:613:in `ddl_transaction'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:538:in `migrate'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:525:in `each'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:525:in `migrate'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:435:in `up'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/migration.rb:417:in `migrate'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-3.0.17/lib/active_record/railties/databases.rake:151
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke_without_cronwrapper'
/opt/workfeed/lib/tasks/extend.rake:7:in `invoke'
/opt/workfeed/lib/cronwrapper.rb:41:in `as_cron'
/opt/workfeed/lib/tasks/extend.rake:6:in `invoke'
/opt/workfeed/lib/tasks/dev.rake:61
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke_without_cronwrapper'
/opt/workfeed/lib/tasks/extend.rake:7:in `invoke'
/opt/workfeed/lib/cronwrapper.rb:47:in `as_cron'
/opt/workfeed/lib/tasks/extend.rake:6:in `invoke'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/opt/ruby-enterprise/bin/rake:19:in `load'
/opt/ruby-enterprise/bin/rake:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment