Comments (7)
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.
Ruby v3.2.2
Rails v7.0.8
Env Test
Isolator 0.11
Multi database with postgresql
from isolator.
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.
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.
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.
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:
- Select table names from a specific database:
select table_name from information_schema.views where table_schema = 'analytics_test'
- 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;
- Delete data from tables;
- Enable triggers;
- Disable triggers again
- Select tables from next database and do it all again;
- 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.
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)
- Add .isolator_ignore support HOT 3
- Error raised when query has invalid encoding HOT 3
- Stack level too deep HOT 1
- Subtransactions tracking/preventions HOT 2
- How to handle rescue of StandardError? HOT 3
- Sidekiq isolator doesn't work if "sidekiq/testing" is required only AFTER "isolator" HOT 2
- Sidekiq isolator doesn't work if "sidekiq/testing" is required only AFTER "isolator" HOT 2
- Mailer is not present in Isolator.adapters after initialize HOT 2
- Isolator raises exceptions when using DatabaseCleaner with multiple DBs HOT 1
- tag v0.10.0
- Corrupt transaction counts when connection closes unexpectedly HOT 4
- Corrupt transaction counts with Rails 7.1 restarting savepoint transactions HOT 1
- Incompatible character encodings when logging jobs with non-utf8 arguments HOT 1
- Errors when combined with `ActiveStorage::FixtureSet.blob` HOT 5
- Ruby 2.7 deprecation warning HOT 1
- Inline isolator exceptions HOT 3
- Should we ignore by default Turbo::Streams::ActionBroadcastJob? HOT 1
- Rails 7.1 compatibility HOT 2
- Untracked transaction for multiple databases in System Tests HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from isolator.