Giter VIP home page Giter VIP logo

Comments (7)

palkan avatar palkan commented on May 29, 2024

Hey,

Could you please provide more details? Rails version, Isolator version, environment in which you observe this issue (development, test, production), database configuration (multi-db or not, etc.)

from isolator.

rwehresmann avatar rwehresmann commented on May 29, 2024

Ruby v3.2.2
Rails v7.0.8
Env Test
Isolator 0.11
Multi database with postgresql

from isolator.

palkan avatar palkan commented on May 29, 2024

Isolator 0.11

Let's upgrade Isolator first (the latest version is 1.0.1) and see if it helps.

Multi database with postgresql

Is the model in question use the primary database or some other? That could be smth with multi-db support

from isolator.

rwehresmann avatar rwehresmann commented on May 29, 2024

Tried with 1.0.1, with no success.

Is the model in question use the primary database or some other? That could be smth with multi-db support

Yes, it uses the primary DB.

from isolator.

palkan avatar palkan commented on May 29, 2024

Thanks!

Okay, the next step would be running a failing test with Active Record logs and try to figure out what's going on there. Here is a quick snippet to drop into your spec_helper.rb or test_helper.rb:

ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord.verbose_query_logs = true

from isolator.

rwehresmann avatar rwehresmann commented on May 29, 2024

Thanks for the support @palkan ! Do you know what exactly I should be looking for? The log is huge and I have sensitive data so I cannot paste it here, but what I can see regarding multiple databases (i have 3) is that it follows the pattern of:

  1. Select table names from a specific database: select table_name from information_schema.views where table_schema = 'analytics_test'
  2. Disable triggers:
ALTER TABLE :table1 DISABLE TRIGGER ALL;
ALTER TABLE :table2 DISABLE TRIGGER ALL;
ALTER TABLE :table3 DISABLE TRIGGER ALL;
ALTER TABLE :table4 DISABLE TRIGGER ALL;
ALTER TABLE :table5 DISABLE TRIGGER ALL;
ALTER TABLE :table6 DISABLE TRIGGER ALL;
ALTER TABLE :table7 DISABLE TRIGGER ALL;
ALTER TABLE :table8 DISABLE TRIGGER ALL;
ALTER TABLE :table9 DISABLE TRIGGER ALL;
ALTER TABLE :table10 DISABLE TRIGGER ALL;
ALTER TABLE :table11 DISABLE TRIGGER ALL;
ALTER TABLE :table12 DISABLE TRIGGER ALL;
ALTER TABLE :table13 DISABLE TRIGGER ALL;
ALTER TABLE :table14 DISABLE TRIGGER ALL;
ALTER TABLE :table15 DISABLE TRIGGER ALL;
ALTER TABLE :table16 DISABLE TRIGGER ALL;
ALTER TABLE :table17 DISABLE TRIGGER ALL;
ALTER TABLE :table18 DISABLE TRIGGER ALL;
ALTER TABLE :table19 DISABLE TRIGGER ALL;
  1. Delete data from tables;
  2. Enable triggers;
  3. Disable triggers again
  4. Select tables from next database and do it all again;
  5. The last database is where the data will be created for the test I'm using as example, and it does all the steps except the 5 of disabling triggers once more, where it starts creating the necessary data to perform the test

from isolator.

palkan avatar palkan commented on May 29, 2024

Hey @rwehresmann!

Sorry for late response.

Have no good clues for now, but we can try one more debugging technique (using the latest Isolator). We can define Isolator callbacks to see how it monitors transactions:

Isolator.on_transaction_open do |event|
  puts "New transaction from #{event[:connection_id]}.\n" \
    "Current depth: #{event[:depth]}\n" \
    "From: #{Isolator.backtrace_cleaner.call(caller).take(5).to_a.join("\n")}"
end

# This callback is called every time a transaction is completed
Isolator.on_transaction_close do |event|
  puts "Transaction completed from #{event[:connection_id]}.\n" \
    "Current depth: #{event[:depth]}\n" \
    "From: #{Isolator.backtrace_cleaner.call(caller).take(5).to_a.join("\n")}"
end

from isolator.

Related Issues (20)

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.