customink / activerecord-aurora-serverless-adapter

ActiveRecord Adapter for Amazon Aurora Serverless
https://technology.customink.com/blog/2020/01/03/migrate-your-rails-app-from-heroku-to-aws-lambda/
MIT License
66 stars 7 forks source link

ActiveRecord Phase #2.a - Foundational Fixes πŸŽ‰ #6

Closed metaskills closed 4 years ago

metaskills commented 4 years ago

BEFORE/AFTER

Till we get to 100% green tests, here are the before & current test suite stats. YUP! Lot of wins for a few key pressure point fixes. This to me just shows that the patterns we have for the adapter's delegation to our facade objects are working really well since we went from ~5100 errors to ~100 πŸŽ‰

Finished in 493.196125s, 13.6437 runs/s, 6.7052 assertions/s.
6729 runs, 3307 assertions, 21 failures, 5075 errors, 11 skips
Finished in 3352.854458s, 2.0069 runs/s, 5.1974 assertions/s.
6729 runs, 17426 assertions, 88 failures, 72 errors, 20 skips

Connection Handling

This is where most of the work happned for this pull request.

ActiveRecord default translate_exception adapter method assumes that RuntimeError will not fall thru to the catch all StatementInvalid. This is kind of sad since all Aws::RDSDataService::Errors::ServiceError inherit from RuntimeError. In a latter commit we will fully translate all exceptions but we had to completly override the abstract adapters so any RDS client error is wrapped in ActiveRecord's StatementInvalid.

Mysql2 Namespace

There are a handful of places in the Mysql2 Adapter that call Mysql2:: objects or constant avalues. Most notable were the adapter's batch insert support methods. Thanks to work done above we got most of these automatically, however, just calling out this work/qa is now done too.

Documentation

Totally added some more.