Giter Site home page Giter Site logo

activerecord-turntable's Issues

Reduce connection pool size

Operations that access all connection pools (i,e. clear_active_connections!) might be slowed down if applications having hundreds of model classes, because Turntable adds connection_pools(PoolProxy) object for each model classes.

Sequencer ignores config and updates master shard

Haven't figured out the whole thing yet but the config for sequencer is completely ignored.

The code below is where it gets ignored.

lib/active_record/turntable/cluster.rb:16

# setup sequencer
if (seq = (@options[:seq] || @config[:seq])) && seq[:type] == :mysql
  @seq_shard = SeqShard.new(seq)
end

There is no :type inside seq, there is only a sequence name like user_seq.
I tried doing something like @seq_shard = SeqShard.new(seq["user_seq"]) but that raised an error below.

/usr/lib64/ruby/gems/2.2.0/gems/activerecord-turntable-2.1.1/lib/active_record/turntable/shard.rb:43:in create_connection_class': undefined method with_indifferent_access' for nil:NilClass (NoMethodError)

Thoughts?

Support multi-server DB?

In fact, If we need sharding DB then we must have multi-server host as below.

  • Server MySQL 1: DB1-->DB100 (included user table)
  • Server MySQL 2: DB101-->DB200
    ...
    But I see database.yml config file with one only host DB.
    connection_spec: &spec
      adapter: mysql2
      encoding: utf8
      reconnect: false
      pool: 5
      username: root
      password: root
      socket: /tmp/mysql.sock

Is it support multi-server DB?

Please visit the link.

https://medium.com/@Pinterest_Engineering/sharding-pinterest-how-we-scaled-our-mysql-fleet-3f341e96ca6f

undefined local variable doing rake db:migrate

Using Rails 4 and Turntable gem 2.1.1 (and 2.2.0), doing a rake db:migrate leads to the following error:

NameError: undefined local variable or method config' for main:Object ~/.rvm/gems/ruby-2.1.5/gems/activerecord-turntable-2.1.1/lib/active_record/turntable/railties/databases.rake:81:inblock (4 levels) in <top (required)>'

After performing migrations, it calls dump, which has this line:
shard_configs.merge!(config["seq"]) if config["seq"]

The variable 'config' is not set. 'current_config' is set. In other methods in the file, 'config' is initialized as:
config = ActiveRecord::Base.configurations[Rails.env]

Should config be set or should it be using current_config or do I not have something configured properly in turntable.yml or database.yml?

Turntable installation error

An error occurred when I executed active_record:turntable:install after rails new and bundled activerecord-turntable.

versions

  • turntable: current master (587d982)
  • rails: 5.1.4
  • ruby: 2.4.3

error

$ bundle exec rails g active_record:turntable:install
/path/to/activerecord-turntable-587d9825a957/lib/active_record/turntable/railtie.rb:24:in `exist?': no implicit conversion of nil into String (TypeError)
        from /path/to/activerecord-turntable-587d9825a957/lib/active_record/turntable/railtie.rb:24:in `block (2 levels) in <class:Railtie>'
        from /path/to/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
        from /path/to/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
        from /path/to/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
        from /path/to/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
        from /path/to/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
        from /path/to/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `each'
        from /path/to/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
        from /path/to/gems/activerecord-5.1.4/lib/active_record/base.rb:326:in `<module:ActiveRecord>'
        from /path/to/gems/activerecord-5.1.4/lib/active_record/base.rb:25:in `<top (required)>'
        from /path/to/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /path/to/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
        from /path/to/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /path/to/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /path/to/gems/spring-2.0.2/lib/spring/application.rb:356:in `active_record_configured?'
        from /path/to/gems/spring-2.0.2/lib/spring/application.rb:273:in `disconnect_database'
        from /path/to/gems/spring-2.0.2/lib/spring/application.rb:107:in `preload'
        from /path/to/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
        from /path/to/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
        from /path/to/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
        from /path/to/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
        from /path/to/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
        from /path/to/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /path/to/rubygems/core_ext/kernel_require.rb:55:in `require'
        from -e:1:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.