view · edit · sidebar · attach · print · history

20111206-testcases-new-sequence-button-odba-data-corruption-oddb_org

<< Masa.20111207-check-parallel-importer-oddb_org-migel-importer-ruby193 | 2011 | Masa.20111205-debug-pointer-link-update_price_feeds-odba-data-corruption-oddb_org >>


  1. Fix new sequence/package button
  2. Update testcases oddb.org
  3. Check ODBA data corruption bug

Goal/Estimate/Evaluation
  • Testcases oddb.org / 100% / 100%
  • ODBA corruption bug / 50% / 80%
Milestones
  1. Fix new sequence button
  2. Testcases
Commit

Fix new sequence/package button

Problem

  • 'New Package' button does not work in the following condition
    1. delete a package
    2. load the other package view
    3. delete the second package
    4. click 'new package' button
    5. the new window shows the first registration number

Commit

Update testcases oddb.org

  • 2446 tests, 4664 assertions, 7 failures, 0 errors (the number of tests and assertions should be more)
  1) Failure:
test_export_yaml__on_thursday(ODDB::TestExporter)
    [/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/validators.rb:40:in `validate'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:123:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:64:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:76:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:74:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:41:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:32:in `flexmock_teardown'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/test_unit_integration.rb:37:in `teardown']:
in mock 'flexmock(FlexMock)': method 'export_doctors()' called incorrect number of times.
<1> expected but was
<0>.

  2) Failure:
test_export_yaml__on_tuesday(ODDB::TestExporter)
    [/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/validators.rb:40:in `validate'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:123:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:64:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:76:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:74:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:41:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:32:in `flexmock_teardown'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/test_unit_integration.rb:37:in `teardown']:
in mock 'flexmock(FlexMock)': method 'export_fachinfos()' called incorrect number of times.
<1> expected but was
<0>.
  3) Failure:
test_export_yaml__on_wednesday(ODDB::TestExporter)
    [/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/validators.rb:40:in `validate'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:123:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:64:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:76:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:74:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:41:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:32:in `flexmock_teardown'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/test_unit_integration.rb:37:in `teardown']:
in mock 'flexmock(FlexMock)': method 'export_patinfos()' called incorrect number of times.
<1> expected but was
<0>.

  4) Failure:
test_run__on_15th_day(ODDB::TestExporter)
    [/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/validators.rb:40:in `validate'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:123:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:64:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:76:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:74:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:41:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:32:in `flexmock_teardown'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/test_unit_integration.rb:37:in `teardown']:
in mock 'flexmock(ODDB::Exporter)': method 'export_oddbdat()' called incorrect number of times.
<1> expected but was
<0>.

  5) Failure:
test_run__on_1st_day(ODDB::TestExporter)
    [/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/validators.rb:40:in `validate'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:123:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:64:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:76:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:74:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:41:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:32:in `flexmock_teardown'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/test_unit_integration.rb:37:in `teardown']:
in mock 'flexmock(ODDB::Exporter)': method 'export_oddbdat()' called incorrect number of times.
<1> expected but was
<0>.

  6) Failure:
test_run__on_sunday(ODDB::TestExporter)
    [/usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/validators.rb:40:in `validate'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:123:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation.rb:122:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:64:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/expectation_director.rb:63:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:76:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:75:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:74:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:41:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `each'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:40:in `flexmock_verify'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/mock_container.rb:32:in `flexmock_teardown'
     /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/test_unit_integration.rb:37:in `teardown']:
in mock 'flexmock(ODDB::Exporter)': method 'export_oddbdat()' called incorrect number of times.
<1> expected but was
<0>.

  7) Failure:
test_update_swissmedic_followers(ODDB::TestUpdater) [/home/masa/ywesee/oddb.org/test/test_util/updater.rb:615]:
<"mail_swissmedic_notifications"> expected but was
<nil>.

Error

masa@masa ~/ywesee/oddb.org $ ruby test/test_state/admin/login.rb 
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/grid.rb:27: warning: already initialized constant VERSION
/usr/lib64/ruby/1.8/e2mmap.rb:51: Use Ruby 1.1 (RuntimeError)
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib64/ruby/1.8/matrix.rb:23
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib64/ruby/gems/1.8/gems/gd2-1.1.1/lib/gd2/canvas.rb:23
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
         ... 48 levels...
        from /home/masa/ywesee/oddb.org/src/state/admin/login.rb:5
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from test/test_state/admin/login.rb:9
  • /usr/lib64/ruby/1.8/e2mmap.rb
 #fail "Use Ruby 1.1" if VERSION < "1.1"
 fail "Use Ruby 1.1" if RUBY_VERSION < "1.1"
  • 4184 tests, 6653 assertions, 0 failures, 12 errors
  1) Error:
test_new_sequence(ODDB::State::Admin::TestCompanyRegistration):
NoMethodError: undefined method `persistent_user_input' for <FlexMock:session>:FlexMock
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:105:in `method_missing'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:98:in `method_missing'
    /home/masa/ywesee/oddb.org/src/state/admin/registration.rb:145:in `new_sequence'
    /home/masa/ywesee/oddb.org/src/state/admin/registration.rb:221:in `new_sequence'
    /home/masa/ywesee/oddb.org/test/test_state/admin/registration.rb:338:in `test_new_sequence'

  2) Error:
test_new_sequence(ODDB::State::Admin::TestRegistration):
NoMethodError: undefined method `persistent_user_input' for <FlexMock:session>:FlexMock
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:105:in `method_missing'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:98:in `method_missing'
    /home/masa/ywesee/oddb.org/src/state/admin/registration.rb:145:in `new_sequence'
    /home/masa/ywesee/oddb.org/test/test_state/admin/registration.rb:185:in `test_new_sequence'

  3) Error:
test_new_sequence__resolve_state(ODDB::State::Admin::TestRegistration):
NoMethodError: undefined method `persistent_user_input' for <FlexMock:session>:FlexMock
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:105:in `method_missing'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:98:in `method_missing'
    /home/masa/ywesee/oddb.org/src/state/admin/registration.rb:145:in `new_sequence'
    /home/masa/ywesee/oddb.org/test/test_state/admin/registration.rb:197:in `test_new_sequence__resolve_state'

  4) Error:
test_resolve__else_package(ODDB::State::TestGlobal):
NoMethodError: undefined method `set_persistent_user_input' for #<ODDB::State::TestGlobal::StubSession:0x7f0944971798>
    /home/masa/ywesee/oddb.org/src/state/global.rb:607:in `resolve'
    /home/masa/ywesee/oddb.org/test/test_state/global.rb:582:in `test_resolve__else_package'

  5) Error:
test_resolve__else_registration(ODDB::State::TestGlobal):
NoMethodError: undefined method `set_persistent_user_input' for #<ODDB::State::TestGlobal::StubSession:0x7f0944938ee8>
    /home/masa/ywesee/oddb.org/src/state/global.rb:607:in `resolve'
    /home/masa/ywesee/oddb.org/test/test_state/global.rb:632:in `test_resolve__else_registration'

  6) Error:
test_resolve__else_sequence(ODDB::State::TestGlobal):
NoMethodError: undefined method `set_persistent_user_input' for #<ODDB::State::TestGlobal::StubSession:0x7f0944918418>
    /home/masa/ywesee/oddb.org/src/state/global.rb:607:in `resolve'
    /home/masa/ywesee/oddb.org/test/test_state/global.rb:607:in `test_resolve__else_sequence'

  7) Error:
test_new_package(TestCompanySequence):
NoMethodError: undefined method `persistent_user_input' for <FlexMock:session>:FlexMock
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:105:in `method_missing'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:98:in `method_missing'
    /home/masa/ywesee/oddb.org/src/state/admin/sequence.rb:132:in `new_package'
    /home/masa/ywesee/oddb.org/src/state/admin/sequence.rb:382:in `new_package'
    /home/masa/ywesee/oddb.org/test/test_state/admin/sequence.rb:779:in `test_new_package'

  8) Error:
test_new_package(TestSequence):
NoMethodError: undefined method `persistent_user_input' for <FlexMock:session>:FlexMock
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:105:in `method_missing'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:98:in `method_missing'
    /home/masa/ywesee/oddb.org/src/state/admin/sequence.rb:132:in `new_package'
    /home/masa/ywesee/oddb.org/test/test_state/admin/sequence.rb:289:in `test_new_package'

  9) Error:
test_new_package__resolve_state(TestSequence):
NoMethodError: undefined method `persistent_user_input' for <FlexMock:session>:FlexMock
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:105:in `method_missing'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:98:in `method_missing'
    /home/masa/ywesee/oddb.org/src/state/admin/sequence.rb:132:in `new_package'
    /home/masa/ywesee/oddb.org/test/test_state/admin/sequence.rb:304:in `test_new_package__resolve_state'

  10) Error:
test_generic_group(TestPackageForm):
NoMethodError: undefined method `iksnr' for <FlexMock:model>:FlexMock
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:105:in `method_missing'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:98:in `method_missing'
    /home/masa/ywesee/oddb.org/src/view/admin/package.rb:234:in `sl_entry'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:85:in `send'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:85:in `create'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:322:in `compose_component'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:239:in `compose'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:232:in `each'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:232:in `compose'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:61:in `init'
    /home/masa/ywesee/oddb.org/src/view/admin/package.rb:213:in `init'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
    /home/masa/ywesee/oddb.org/test/test_view/admin/package.rb:102:in `new'
    /home/masa/ywesee/oddb.org/test/test_view/admin/package.rb:102:in `setup'

  11) Error:
test_init(TestPackageForm):
NoMethodError: undefined method `iksnr' for <FlexMock:model>:FlexMock
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:105:in `method_missing'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:98:in `method_missing'
    /home/masa/ywesee/oddb.org/src/view/admin/package.rb:234:in `sl_entry'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:85:in `send'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:85:in `create'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:322:in `compose_component'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:239:in `compose'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:232:in `each'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:232:in `compose'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:61:in `init'
    /home/masa/ywesee/oddb.org/src/view/admin/package.rb:213:in `init'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
    /home/masa/ywesee/oddb.org/test/test_view/admin/package.rb:102:in `new'
    /home/masa/ywesee/oddb.org/test/test_view/admin/package.rb:102:in `setup'
  12) Error:
test_sl_entry(TestPackageForm):
NoMethodError: undefined method `iksnr' for <FlexMock:model>:FlexMock
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:105:in `method_missing'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:191:in `flexmock_wrap'
    /usr/lib64/ruby/gems/1.8/gems/flexmock-0.8.6/lib/flexmock/core.rb:98:in `method_missing'
    /home/masa/ywesee/oddb.org/src/view/admin/package.rb:234:in `sl_entry'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:85:in `send'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:85:in `create'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:322:in `compose_component'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:239:in `compose'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:232:in `each'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:232:in `compose'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:61:in `init'
    /home/masa/ywesee/oddb.org/src/view/admin/package.rb:213:in `init'
    /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
    /home/masa/ywesee/oddb.org/test/test_view/admin/package.rb:102:in `new'
    /home/masa/ywesee/oddb.org/test/test_view/admin/package.rb:102:in `setup'

Final check

4184 tests, 6665 assertions, 0 failures, 0 errors

Commit

Check ODBA data corruption bug

Experiment

Run

  • Prepare database
 sudo -u postgres dropdb testdb; sudo -u postgres createdb -E UTF8 -T template0 testdb
  • Run update_odba1.rb first
  • After the update_odba1.rb running, quickly start to run update_odba2.rb

Screen shot

Note

  • update_odba1.rb runs on the top screen, update_odba2.rb on the bottom screen
  • Sometimes the following error happens
ERROR:  duplicate key value violates unique constraint "object_pkey"

/usr/lib64/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:671:in `execute': ERROR:  duplicate key value violates unique constraint "object_pkey" (DBI::ProgrammingError)
        from /usr/lib64/ruby/site_ruby/1.8/dbi.rb:912:in `execute'
        from /usr/lib64/ruby/site_ruby/1.8/dbi.rb:917:in `do'
        from /usr/lib64/ruby/site_ruby/1.8/dbi.rb:520:in `do'
        from /usr/lib64/ruby/site_ruby/1.8/odba/connection_pool.rb:36:in `send'
        from /usr/lib64/ruby/site_ruby/1.8/odba/connection_pool.rb:36:in `method_missing'
        from /usr/lib64/ruby/site_ruby/1.8/odba/connection_pool.rb:26:in `next_connection'
        from /usr/lib64/ruby/site_ruby/1.8/odba/connection_pool.rb:35:in `method_missing'
        from /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb:555:in `store'
         ... 6 levels...
        from update_odba1.rb:17:in `save'
        from update_odba1.rb:26
        from update_odba1.rb:22:in `times'
        from update_odba1.rb:22
  • But sometimes run both update scripts at the same time

Result

masa@masa ~/work/test_odba $ ruby check_odba.rb 
2       masa1_2
3       masa1_3
4       masa1_4
5       masa1_5
6       masa1_6
7       masa1_7
8       masa1_8
9       masa1_9
10      masa1_10
...
1943    masa1_1943
1944    masa1_1944
1945    masa1_1945
1946    masa1_1946
1947    masa2_1947 # <= update_odba2.rb starts
1948    masa2_1948
1949    masa2_1949
1950    masa2_1950
1951    masa2_1951
...
11941   masa2_11941
11942   masa2_11942
11943   masa2_11943
11944   masa2_11944
11945   masa2_11945
11946   masa2_11946

Note

  • There is no masa1 data after 1946 (odba_id)
  • It looks like that update_odba2.rb overwrites the data
  • Before odba_store (save), the same odba_id is used for a new object

Experiment

Run

  1. run odba_id_test1.rb
  2. quickly run odba_id_test2.rb
masa@masa ~/work/test_odba $ ruby odba_id_test1.rb 
ERROR:  relation "object" already exists

ERROR:  relation "prefetchable_index" already exists

ERROR:  relation "extent_index" already exists

ERROR:  relation "object_connection" already exists

ERROR:  relation "target_id_index" already exists

ERROR:  relation "collection" already exists

(sleep 10)

odba_id=11954
masa@masa ~/work/test_odba $ ruby odba_id_test2.rb 
ERROR:  relation "object" already exists

ERROR:  relation "prefetchable_index" already exists

ERROR:  relation "extent_index" already exists

ERROR:  relation "object_connection" already exists

ERROR:  relation "target_id_index" already exists

ERROR:  relation "collection" already exists

odba_id=11954

Result

masa@masa ~/work/test_odba $ ruby check_odba.rb
...
11954   masa1_11954

Note

  • In this case, odba_id_test1.rb overwrites the data that is save by odba_id_test2.rb

Problems

  • a new odba_id is created sequentially in the same process even if the new object is not saved in the database
  • But the other process does not know which odba_id is the latest before saving the object in the database
  • it is not enough to use flock for the ODBA::Cache#odba_store method for the exclusive control between processes
  • Basically the second process has to wait for the first process from getting new odba_id (next_id) to saving the object (odba_store)
  • Or somehow ODBA share the latest odba_id between processes
  • Or in the application side, the user (programmer) of ODBA must think exclusive control from creating a new odba_id to saving the object.
  • Or making an independent ODBA server process to be shared by several processes using ODBA library

Design (flock exclusive control)

  • If one process can create a new odba_id even if the new object is not saved in the database
    • -> because one process may get a new odba_id without saving the latest object
  • The second process must wait to get a new odba_id until the first process finishes saving objects

Problem

  • File#flock block (LOCK_EX) the second (later) thread even if it is in the same process

Experiment

 require 'odba/lock'
 ...
    def next_id
      #id = ODBA.storage.next_id
      id = new_id
      @peers.each do |peer|
        peer.reserve_next_id id rescue DRb::DRbError
      end
      id
    rescue OdbaDuplicateIdError
      retry
    end

Run

  • First run update_odba1.rb
  • Quickly run update_odba2.rb

Result

masa@masa ~/work/test_odba $ ruby check_odba.rb 
...
1856    masa2_86
1857    masa1_13
1858    masa2_86
1859    masa1_13
1860    masa2_86
1861    masa1_13
1862    masa2_86
1863    masa1_13
1864    masa2_86
1865    masa1_13
1866    masa2_86
1867    masa1_13
1868    masa2_86
1869    masa1_13
1870    masa2_86
1871    masa1_13
1872    masa2_86
1873    masa1_13
...

Note (Problems)

  • It looks like that the data corruption does not happen
  • ODBA.storage.max_id becomes inconsistent
  • The lock file and count file are created in the application directory
  • These lock file and count file are shared by the process using ODBA library, not only oddbd process

Note (Next)

  • lock and count files should be separately created for each database
  • lock and count files should be created in the library directory, not application directory (-> permission problem?)
  • ODBA.storage.max_id (@next_id) should be updated at the same time
  • The updating becomes several times slower

Experiment (database name)

ch.oddb> ODBA.storage.dbi.instance_variable_get('@dbi_args').first.split(/:/).last
-> oddb.org

Experiment

  • /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb
    # File lock exclusive control between processes, not threads, to create safely a new odba_id
    # Sometimes several update jobs (processes) to the same database at the same time
    LOCK_FILE = '/tmp/lockfile'
    COUNT_FILE = '/tmp/count'
    def lock(dbname)
      lock_file = LOCK_FILE + "." + dbname
      open(lock_file, 'a') do |st|
        st.flock(File::LOCK_EX)
        yield
        st.flock(File::LOCK_UN)
      end
    end
    def new_id(dbname, odba_storage)
      count_file = COUNT_FILE + "." + dbname
      unless File.exist?(count_file)
        open(count_file, "w") do |out|
          out.print odba_storage.max_id
        end
      end
      count = nil
      lock(dbname) do
        count = File.read(count_file).to_i
        count += 1
        open(count_file, "w") do |out|
          out.print count
        end
      end
      odba_storage.update_max_id(count)
      count
    end
    # Returns the next valid odba_id
    def next_id
      #id = ODBA.storage.next_id
      dbname = ODBA.storage.dbi.dbi_args.first.split(/:/).last
      id = new_id(dbname, ODBA.storage)
      @peers.each do |peer|
        peer.reserve_next_id id rescue DRb::DRbError
      end
      id
    rescue OdbaDuplicateIdError
      retry
    end
  • /usr/lib64/ruby/site_ruby/1.8/odba/connection_pool.rb
    #attr_reader :connections
    attr_reader :connections, :dbi_args
  • /usr/lib64/ruby/site_ruby/1.8/odba/storage.rb
    def update_max_id(id)
      @id_mutex.synchronize do
        @next_id = id
      end
    end

Run

  • update_odba1.rb and update_odba2.rb at the same time

Result

  • update_odba1.rb
masa@masa ~/work/test_odba $ ruby update_odba1.rb 
...
masa.name = masa1_1927  odba_id=1928
masa.name = masa1_1929  odba_id=1930
masa.name = masa1_1931  odba_id=1932
masa.name = masa1_1933  odba_id=1934
masa.name = masa1_1935  odba_id=1936
masa.name = masa1_1937  odba_id=1938
  • update_odba2.rb
masa@masa ~/work/test_odba $ ruby update_odba2.rb 
...
masa.name = masa2_1997  odba_id=1997
masa.name = masa2_1998  odba_id=1998
masa.name = masa2_1999  odba_id=1999
masa.name = masa2_2000  odba_id=2000
masa.name = masa2_2001  odba_id=2001

Note

  • In fact, the numbers of masa.name and odba_id should be same
  • Probably the ODBA.storage.max_id in the first process takes the updated max_id by the second process
  • But the data corruption never happens
  • It is no problem if ODBA.storage.max_id is called after creating a new odba_id (call object.odba_id method for the first time)

Experiment

Result

  • update_odba1.rb
masa@masa ~/work/test_odba $ ruby update_odba1.rb 
...
masa.name = masa1_981   odba_id=981
masa.name = masa1_983   odba_id=983
masa.name = masa1_985   odba_id=985
masa.name = masa1_987   odba_id=987
  • update_odba2.rb
masa@masa ~/work/test_odba $ ruby update_odba2.rb
...
masa.name = masa2_998   odba_id=998
masa.name = masa2_999   odba_id=999
masa.name = masa2_1000  odba_id=1000
masa.name = masa2_1001  odba_id=1001
view · edit · sidebar · attach · print · history
Page last modified on April 04, 2012, at 08:59 AM