Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | Remove the transaction_open variable | Jon Leighton | 2012-09-15 | 1 | -21/+28 | |
| | ||||||
* | Move transaction joinability into the transaction object | Jon Leighton | 2012-09-15 | 1 | -13/+13 | |
| | ||||||
* | Alter the naming structure a bit | Jon Leighton | 2012-09-15 | 1 | -2/+2 | |
| | ||||||
* | DRY | Jon Leighton | 2012-09-15 | 1 | -4/+8 | |
| | ||||||
* | Don't do the rollback in #commit | Jon Leighton | 2012-09-15 | 1 | -1/+1 | |
| | | | | | The caller needs to have knowledge of the rollback either way, so do it all in the caller (#transaction) | |||||
* | Store the transaction number in the transaction object | Jon Leighton | 2012-09-15 | 1 | -1/+0 | |
| | | | | This avoids us having to manually increment and decrement it. | |||||
* | Start to tease out transaction handling into a state machine | Jon Leighton | 2012-09-15 | 1 | -79/+28 | |
| | ||||||
* | Revert "create a transaction object and point AR objects at that object ↵ | Jon Leighton | 2012-09-15 | 1 | -5/+3 | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | during a" This reverts commit c24c885209ac2334dc6f798c394a821ee270bec6. Here's the explanation I just sent to @tenderlove: Hey, I've been thinking about about the transaction memory leak thing that we were discussing. Example code: post = nil Post.transaction do N.times { post = Post.create } end Post.transaction is going to create a real transaction and there will also be a (savepoint) transaction inside each Post.create. In an idea world, we'd like all but the last Post instance to be GC'd, and for the last Post instance to receive its after_commit callback when Post.transaction returns. I can't see how this can work using your solution where the Post itself holds a reference to the transaction it is in; when Post.transaction returns, control does not switch to any of Post's instance methods, so it can't trigger the callbacks itself. What we really want is for the transaction itself to hold weak references to the objects within the transaction. So those objects can be GC'd, but if they are not GC'd then the transaction can iterate them and execute their callbacks. I've looked into WeakRef implementations that are available. On 1.9.3, the stdlib weakref library is broken and we shouldn't use it. There is a better implementation here: https://github.com/bdurand/ref/blob/master/lib/ref/weak_reference/pure_ruby.rb We could use that, either by pulling in the gem or just copying the code in, but it still suffers from the limitation that it uses ObjectSpace finalizers. In my testing, this finalizers make GC quite expensive: https://gist.github.com/3722432 Ruby 2.0 will have a native WeakRef implementation (via ObjectSpace::WeakMap), hence won't be reliant on finalizers: http://bugs.ruby-lang.org/issues/4168 So the ultimate solution will be for everyone to use Ruby 2.0, and for us to just use ObjectSpace::WeakMap. In the meantime, we have basically 3 options: The first is to leave it as it is. The second is to use a finalizer-based weakref implementation and take the GC perf hit. The final option is to store object ids rather than the actual objects. Then use ObjectSpace._id2ref to deference the objects at the end of the transaction, if they exist. This won't stop memory use growing within the transaction, but it'll grow more slowly. I benchmarked the performance of _id2ref this if the object does or does not exist: https://gist.github.com/3722550 If it does exist it seems decent, but it's hugely more expensive if it doesn't, probably because we have to do the rescue nil. Probably most of the time the objects will exist. However the point of doing this optimisation is to allow people to create a large number of objects inside a transaction and have them be GC'd. So for that use case, we'd be replacing one problem with another. I'm not sure which of the two problems is worse. My feeling is that we should just leave this for now and come back to it when Ruby 2.0 is out. I'm going to revert your commit because I can't see how it solves this. Hope you don't mind... if I've misunderstood then let me know! Jon | |||||
* | create a transaction object and point AR objects at that object during a | Aaron Patterson | 2012-09-07 | 1 | -3/+5 | |
| | | | | transaction. | |||||
* | use Hash#fetch to eliminate conditional | Aaron Patterson | 2012-08-24 | 1 | -8/+3 | |
| | ||||||
* | This method is useless without a block, so remove test | Aaron Patterson | 2012-08-20 | 1 | -11/+9 | |
| | ||||||
* | remove unused variable | Aaron Patterson | 2012-08-20 | 1 | -1/+1 | |
| | ||||||
* | initialize instance variables to avoid conditionals | Aaron Patterson | 2012-08-20 | 1 | -2/+7 | |
| | ||||||
* | Avoid unnecessary catching of Exception instead of StandardError. | Dylan Smith | 2012-06-17 | 1 | -2/+2 | |
| | ||||||
* | Work around undiagnosed bug that's draining a relation's bind_values | Jeremy Kemper | 2012-05-31 | 1 | -0/+1 | |
| | ||||||
* | Merge pull request #5698 from dougcole/support_postgresql_partitioning | Aaron Patterson | 2012-04-27 | 1 | -2/+2 | |
|\ | | | | | Support postgresql partitioning by making INSERT RETURNING optional | |||||
| * | add use_returning as a postgresql connection config | Doug Cole | 2012-03-31 | 1 | -2/+2 | |
| | | ||||||
* | | Fix delete_all when chained with joins. | Rafael Mendonça França | 2012-04-10 | 1 | -3/+17 | |
| | | | | | | | | Closes #5202 and #919 | |||||
* | | Remove unnecessary articles. | Waseem Ahmad | 2012-04-03 | 1 | -3/+3 | |
|/ | ||||||
* | use bind values for join columns | Aaron Patterson | 2012-02-27 | 1 | -4/+4 | |
| | ||||||
* | prepared statements can be disabled | Aaron Patterson | 2012-02-21 | 1 | -7/+9 | |
| | ||||||
* | fix nodocs | Vijay Dev | 2011-12-09 | 1 | -3/+3 | |
| | ||||||
* | Use new SelectManager#projections= method | Jon Leighton | 2011-08-15 | 1 | -2/+2 | |
| | ||||||
* | use update.key instead of update.ast.key. make better use of select manager. | Jon Leighton | 2011-08-15 | 1 | -2/+2 | |
| | ||||||
* | Refactor building the update manager | Jon Leighton | 2011-08-15 | 1 | -5/+3 | |
| | ||||||
* | Support for multi-table updates with limits, offsets and orders | Jon Leighton | 2011-08-15 | 1 | -0/+3 | |
| | ||||||
* | Support updates with joins. Fixes #522. | Jon Leighton | 2011-08-15 | 1 | -0/+9 | |
| | ||||||
* | Make it the responsibility of the connection to hold onto an ARel visitor ↵ | Jon Leighton | 2011-08-08 | 1 | -14/+23 | |
| | | | | for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now. | |||||
* | Merge branch 'master' of github.com:rails/rails | Xavier Noria | 2011-05-25 | 1 | -29/+2 | |
|\ | ||||||
| * | removed deprecated methods, and related tests, from ActiveRecord | Josh Kalderimis | 2011-05-25 | 1 | -29/+2 | |
| | | ||||||
* | | Remove extra white spaces on ActiveRecord docs. | Sebastian Martinez | 2011-05-23 | 1 | -2/+2 | |
|/ | ||||||
* | use a null byte as a bind parameter substitute as it is not allowed in ↵ | Aaron Patterson | 2011-05-09 | 1 | -9/+1 | |
| | | | | normal SQL. fixes #411, #417 | |||||
* | using bind parameters for updates | Aaron Patterson | 2011-04-30 | 1 | -4/+11 | |
| | ||||||
* | postgresql supports prepare statement deletes | Aaron Patterson | 2011-04-29 | 1 | -2/+9 | |
| | ||||||
* | Use existing #empty_insert_statement_value for an insert with no columns. | Ken Collins | 2011-04-24 | 1 | -4/+0 | |
| | ||||||
* | Move #exec_insert to abstract adapter's database statements. | Ken Collins | 2011-04-22 | 1 | -0/+7 | |
| | ||||||
* | insert statements are prepared, but values are not escaped properly | Aaron Patterson | 2011-04-14 | 1 | -2/+20 | |
| | ||||||
* | Merge branch 'master' of git://github.com/lifo/docrails | Xavier Noria | 2011-03-23 | 1 | -1/+0 | |
|\ | ||||||
| * | remove bank line | Paco Guzman | 2011-03-18 | 1 | -1/+0 | |
| | | ||||||
* | | pushing id insertion and prefetch primary keys down to Relation#insert | Aaron Patterson | 2011-03-22 | 1 | -0/+4 | |
|/ | ||||||
* | fixture should quack like a hash | Aaron Patterson | 2011-02-11 | 1 | -1/+9 | |
| | ||||||
* | Allow limit values to accept an ARel SQL literal. | Ken Collins | 2011-02-09 | 1 | -3/+7 | |
| | ||||||
* | limit() should sanitize limit values | Aaron Patterson | 2011-02-08 | 1 | -15/+15 | |
| | | | | This fixes CVE-2011-0448 | |||||
* | require ActiveSupport deprecatation file before using deprecate method in ↵ | Raimonds Simanovskis | 2011-01-04 | 1 | -0/+2 | |
| | | | | | database_statements otherwise when using external ActiveRecord adapters (e.g. Oracle) database_statements might be loaded before active_support/core_ext/module/deprecation which results in NoMethodError (commit 60cf65def805995bcca184c40b44bb01d86a48aa added "deprecate" call to database_statements.rb) | |||||
* | herp derpricating add_limit_offset! | Aaron Patterson | 2011-01-03 | 1 | -0/+3 | |
| | ||||||
* | converted exec to exec_query for sqlite | Aaron Patterson | 2010-11-05 | 1 | -1/+1 | |
| | ||||||
* | renaming bind_values to binds where it makes sense | Aaron Patterson | 2010-10-26 | 1 | -6/+6 | |
| | ||||||
* | adding backwards compatibility for non-prepare statement handling drivers | Aaron Patterson | 2010-10-26 | 1 | -2/+16 | |
| | ||||||
* | exec returns an AR::Result | Aaron Patterson | 2010-10-26 | 1 | -3/+3 | |
| | ||||||
* | adding the abstract method | Aaron Patterson | 2010-10-26 | 1 | -0/+6 | |
| |