mysql2/spec
Eric Wong 8bfbfa2708 fix signal handling when waiting on queries
This reverts the single-threaded select() optimization from
commits 9a63a587c0 and
0190457dbd.

Under Ruby 1.9, the reverted optimization caused signal handlers
to be delayed until the socket became readable.

Under Ruby 1.8, matters are worse as receiving a signal during
select() causes Errno::EINTR to be raised.

There is now a (somewhat fragile) spec for testing signal
handling during a "SELECT sleep(2)" query.

Furthermore, the performance difference I measured on
benchmark/thread_alone.rb was negligible (over 1000 iterations)
between the two:

Ruby 1.8.7-p249
  Rehearsal ----------------------------------------------------
  select             0.040000   0.020000   0.060000 (  0.119448)
  rb_thread_select   0.050000   0.020000   0.070000 (  0.132091)
  ------------------------------------------- total: 0.130000sec

                         user     system      total        real
  select             0.030000   0.030000   0.060000 (  0.116471)
  rb_thread_select   0.050000   0.020000   0.070000 (  0.119874)

Ruby 1.9.2-p0
  Rehearsal ----------------------------------------------------
  select             0.050000   0.030000   0.080000 (  0.134208)
  rb_thread_select   0.080000   0.000000   0.080000 (  0.141316)
  ------------------------------------------- total: 0.160000sec

                         user     system      total        real
  select             0.050000   0.020000   0.070000 (  0.123325)
  rb_thread_select   0.060000   0.010000   0.070000 (  0.124075)

Benchmarks were performed on an _empty_ mysql2_test table to
maximize the relative time for the select(2)-related code path
(vs reading data).  The test was run on Debian Lenny, x86_64 and
a stock 2.6.35.2 Linux kernel.  Hardware was a Core2 Duo @
1.6GHz with the performance CPU governor while on AC power
to eliminate CPU speed fluctuations during the test.
2010-08-18 20:13:13 -07:00
..
em spec helper is in the load path, so no need for expand_path funny business 2010-07-06 15:41:44 -07:00
mysql2 fix signal handling when waiting on queries 2010-08-18 20:13:13 -07:00
rcov.opts result hash keys can be symbols using the :symbolize_keys option with #fetch_row, #fetch_rows or #each. Renamed extension from MySQL to Mysql2. Initial Rakefile and spec dir 2010-03-30 09:56:24 -07:00
spec.opts result hash keys can be symbols using the :symbolize_keys option with #fetch_row, #fetch_rows or #each. Renamed extension from MySQL to Mysql2. Initial Rakefile and spec dir 2010-03-30 09:56:24 -07:00
spec_helper.rb Save on coercion overhead for zero value decimal and float column values 2010-08-11 11:25:20 -07:00