This is failing for Oracle not because the underlying SELECT doesn''t
work, but as a side effect of the fact that allow_concurrency has been
set to true, and it''s trying to do another db call (to describe the
Readers table) while a prior one is still executing.
Since this particular test doesn''t seem to require allow_concurrency,
this could be refactored into a separate test case, or the below patch
fixes it as well:
Index: test/locking_test.rb
==================================================================---
test/locking_test.rb (revision 5684)
+++ test/locking_test.rb (working copy)
@@ -1,5 +1,6 @@
require ''abstract_unit''
require ''fixtures/person''
+require ''fixtures/reader''
require ''fixtures/legacy_thing''
class LockWithoutDefault < ActiveRecord::Base; end
@@ -10,7 +11,7 @@
end
class OptimisticLockingTest < Test::Unit::TestCase
- fixtures :people, :legacy_things
+ fixtures :people, :legacy_things, :readers
def test_lock_existing
p1 = Person.find(1)
@@ -89,6 +90,7 @@
fixtures :people
def setup
+ r = Reader.new
@allow_concurrency = ActiveRecord::Base.allow_concurrency
ActiveRecord::Base.allow_concurrency = true
end
Michael Schoen wrote:> "bitsweat" made AR/Oracle cry...
>
> http://dev.rubyonrails.org/changeset/5682
> ------------------------------------------------------------------------
> r5682 | bitsweat | 2006-12-05 14:07:55 -0800 (Tue, 05 Dec 2006) | 1 line
>
> find supports :lock with :include. Check whether your database allows
SELECT ... FOR UPDATE with outer joins before using. Closes #6764.
> ------------------------------------------------------------------------
>
> U activerecord/test/locking_test.rb
> U activerecord/lib/active_record/associations.rb
> U activerecord/CHANGELOG
> Updated to revision 5682.
>
> 1) Failure:
> test_eager_find_with_lock(PessimisticLockingTest)
[./test/locking_test.rb:124]:
> Exception raised:
> Class: <RuntimeError>
> Message: <"\"DESC readers\" failed; does it
exist?">
> ---Backtrace---
> ./test/../lib/active_record/connection_adapters/oracle_adapter.rb:316:in
`columns''
> ./test/../lib/active_record/base.rb:760:in `columns''
> ./test/../lib/active_record/base.rb:768:in `columns_hash''
> ./test/../lib/active_record/base.rb:1020:in `find_one''
> ./test/../lib/active_record/base.rb:1011:in `find_from_ids''
> ./test/../lib/active_record/base.rb:416:in `find''
> ./test/locking_test.rb:126:in `test_eager_find_with_lock''
>
./test/../lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
`transaction''
> ./test/../lib/active_record/transactions.rb:95:in `transaction''
> ./test/locking_test.rb:125:in `test_eager_find_with_lock''
> ./test/locking_test.rb:124:in `test_eager_find_with_lock''
> ---------------
>
> 1006 tests, 3871 assertions, 1 failures, 0 errors
> rake aborted!
> Command failed with status (1): [/usr/pkg/ruby184/bin/ruby
-Ilib:test:test/...]
>
> (See full trace by running task with --trace)
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---