memcached 0.17.2 → 0.17.3

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ v0.17.3. Compile with -Os. Retry once on Memcached::ClientError.
3
+
2
4
  v0.17.2. Fix realloc bug on Linux that got regressed.
3
5
 
4
6
  v0.17.1. Ruby 1.9 compatibility.
@@ -57,6 +57,8 @@ if !ENV["EXTERNAL_LIB"]
57
57
  puts "Setting debug flags for libmemcached."
58
58
  cflags << " -O0 -ggdb -DHAVE_DEBUG"
59
59
  extraconf << " --enable-debug"
60
+ else
61
+ cflags << " -Os"
60
62
  end
61
63
 
62
64
  puts(cmd = "env CFLAGS='#{cflags}' LDFLAGS='#{ldflags}' ./configure --prefix=#{HERE} --without-memcached --disable-shared --disable-utils #{extraconf} 2>&1")
@@ -87,7 +89,7 @@ if ENV['DEBUG']
87
89
  puts "Setting debug flags for gem."
88
90
  $CFLAGS << " -O0 -ggdb -DHAVE_DEBUG"
89
91
  else
90
- $CFLAGS << " -O3"
92
+ $CFLAGS << " -Os"
91
93
  end
92
94
 
93
95
  if DARWIN
@@ -225,6 +225,10 @@ Please note that when pipelining is enabled, setter and deleter methods do not r
225
225
  Lib.memcached_set(@struct, key, value, ttl, flags),
226
226
  key
227
227
  )
228
+ rescue ClientError
229
+ # FIXME Memcached 1.2.8 occasionally rejects valid sets
230
+ tried = 1 and retry unless defined?(tried)
231
+ raise
228
232
  end
229
233
 
230
234
  # Add a key/value pair. Raises <b>Memcached::NotStored</b> if the key already exists on the server. The parameters are the same as <tt>set</tt>.
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{memcached}
5
- s.version = "0.17.2"
5
+ s.version = "0.17.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Evan Weaver"]
9
9
  s.cert_chain = ["/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-public_cert.pem"]
10
- s.date = %q{2009-09-22}
10
+ s.date = %q{2009-09-30}
11
11
  s.description = %q{An interface to the libmemcached C client.}
12
12
  s.email = %q{}
13
13
  s.extensions = ["ext/extconf.rb"]
@@ -1,4 +1,4 @@
1
-
1
+
2
2
  require "#{File.dirname(__FILE__)}/../test_helper"
3
3
  require 'socket'
4
4
  require 'mocha'
@@ -18,7 +18,7 @@ class MemcachedTest < Test::Unit::TestCase
18
18
  :hash => :default,
19
19
  :distribution => :modula}
20
20
  @cache = Memcached.new(@servers, @options)
21
-
21
+
22
22
  @binary_protocol_options = {
23
23
  :prefix_key => @prefix_key,
24
24
  :hash => :default,
@@ -154,7 +154,7 @@ class MemcachedTest < Test::Unit::TestCase
154
154
  cache.append key, @value
155
155
  rescue Memcached::NotStored => e
156
156
  assert e.backtrace.empty?
157
- end
157
+ end
158
158
  end
159
159
 
160
160
  def test_initialize_with_backtraces
@@ -228,7 +228,7 @@ class MemcachedTest < Test::Unit::TestCase
228
228
  @udp_cache.get(key)
229
229
  end
230
230
  end
231
-
231
+
232
232
  def test_get_nil
233
233
  @cache.set key, nil, 0
234
234
  result = @cache.get key
@@ -264,7 +264,7 @@ class MemcachedTest < Test::Unit::TestCase
264
264
  result = cache.get key
265
265
  end
266
266
  end).real
267
-
267
+
268
268
  socket.close
269
269
  end
270
270
 
@@ -383,14 +383,14 @@ class MemcachedTest < Test::Unit::TestCase
383
383
  @cache.get(["#{key}_1", "#{key}_2"])
384
384
  end
385
385
  end
386
-
386
+
387
387
  def test_random_distribution_is_statistically_random
388
388
  cache = Memcached.new(@servers, :distribution => :random)
389
389
  cache.flush
390
390
  20.times { |i| cache.set "#{key}#{i}", @value }
391
-
391
+
392
392
  cache, hits = Memcached.new(@servers.first), 0
393
- 20.times do |i|
393
+ 20.times do |i|
394
394
  begin
395
395
  cache.get "#{key}#{i}"
396
396
  hits += 1
@@ -407,7 +407,7 @@ class MemcachedTest < Test::Unit::TestCase
407
407
  assert_nothing_raised do
408
408
  @cache.set(key, @value)
409
409
  end
410
-
410
+
411
411
  assert_nothing_raised do
412
412
  @binary_protocol_cache.set(key, @value)
413
413
  end
@@ -443,6 +443,16 @@ class MemcachedTest < Test::Unit::TestCase
443
443
  end
444
444
  end
445
445
 
446
+ def disabled_test_set_retry_on_client_error
447
+ # FIXME Test passes, but Mocha doesn't restore the original method properly
448
+ Rlibmemcached.stubs(:memcached_set).raises(Memcached::ClientError)
449
+ Rlibmemcached.stubs(:memcached_set).returns(0)
450
+
451
+ assert_nothing_raised do
452
+ @cache.set(key, @value)
453
+ end
454
+ end
455
+
446
456
  # Delete
447
457
 
448
458
  def test_delete
@@ -713,10 +723,10 @@ class MemcachedTest < Test::Unit::TestCase
713
723
  rescue Memcached::ServerError => e
714
724
  assert_match /^"object too large for cache". Key/, e.message
715
725
  end
716
-
726
+
717
727
  def test_errno_message
718
728
  Rlibmemcached::MemcachedServerSt.any_instance.stubs("cached_errno").returns(1)
719
- @cache.send(:check_return_code, Rlibmemcached::MEMCACHED_ERRNO, key)
729
+ @cache.send(:check_return_code, Rlibmemcached::MEMCACHED_ERRNO, key)
720
730
  rescue Memcached::SystemError => e
721
731
  assert_match /^Errno 1: "Operation not permitted". Key/, e.message
722
732
  end
@@ -777,10 +787,10 @@ class MemcachedTest < Test::Unit::TestCase
777
787
  )
778
788
  assert_equal Rlibmemcached::MEMCACHED_BUFFERED, ret
779
789
  end
780
-
790
+
781
791
  def test_no_block_get
782
792
  @noblock_cache.set key, @value
783
- assert_equal @value,
793
+ assert_equal @value,
784
794
  @noblock_cache.get(key)
785
795
  end
786
796
 
@@ -814,8 +824,8 @@ class MemcachedTest < Test::Unit::TestCase
814
824
  # Server removal and consistent hashing
815
825
 
816
826
  def test_unresponsive_server
817
- socket = stub_server 43041
818
-
827
+ socket = stub_server 43041
828
+
819
829
  cache = Memcached.new(
820
830
  [@servers.last, 'localhost:43041'],
821
831
  :prefix_key => @prefix_key,
@@ -826,7 +836,7 @@ class MemcachedTest < Test::Unit::TestCase
826
836
  :hash => :md5
827
837
  )
828
838
 
829
- # Hit second server up to the server_failure_limit
839
+ # Hit second server up to the server_failure_limit
830
840
  key2 = 'test_missing_server'
831
841
  assert_raise(Memcached::ATimeoutOccurred) { cache.set(key2, @value) }
832
842
  assert_raise(Memcached::ATimeoutOccurred) { cache.get(key2, @value) }
@@ -845,14 +855,14 @@ class MemcachedTest < Test::Unit::TestCase
845
855
  cache.set(key2, @value)
846
856
  assert_equal cache.get(key2), @value
847
857
  end
848
-
858
+
849
859
  sleep(2)
850
-
860
+
851
861
  # Hit second server again after restore, expect same failure
852
862
  key2 = 'test_missing_server'
853
863
  assert_raise(Memcached::ATimeoutOccurred) do
854
864
  cache.set(key2, @value)
855
- end
865
+ end
856
866
 
857
867
  socket.close
858
868
  end
@@ -868,7 +878,7 @@ class MemcachedTest < Test::Unit::TestCase
868
878
  :hash => :md5
869
879
  )
870
880
 
871
- # Hit second server up to the server_failure_limit
881
+ # Hit second server up to the server_failure_limit
872
882
  key2 = 'test_missing_server'
873
883
  assert_raise(Memcached::SystemError) { cache.set(key2, @value) }
874
884
  assert_raise(Memcached::SystemError) { cache.get(key2, @value) }
@@ -887,16 +897,16 @@ class MemcachedTest < Test::Unit::TestCase
887
897
  cache.set(key2, @value)
888
898
  assert_equal cache.get(key2), @value
889
899
  end
890
-
900
+
891
901
  sleep(2)
892
-
902
+
893
903
  # Hit second server again after restore, expect same failure
894
904
  key2 = 'test_missing_server'
895
905
  assert_raise(Memcached::SystemError) do
896
906
  cache.set(key2, @value)
897
- end
907
+ end
898
908
  end
899
-
909
+
900
910
  def test_unresponsive_with_random_distribution
901
911
  socket = stub_server 43041
902
912
  failures = [Memcached::ATimeoutOccurred, Memcached::ServerIsMarkedDead]
@@ -913,15 +923,15 @@ class MemcachedTest < Test::Unit::TestCase
913
923
  exceptions = []
914
924
  100.times { begin; cache.set key, @value; rescue => e; exceptions << e; end }
915
925
  assert_equal failures, exceptions.map { |x| x.class }
916
-
926
+
917
927
  # Hit first server on retry
918
- assert_nothing_raised { cache.set(key, @value) }
919
-
928
+ assert_nothing_raised { cache.set(key, @value) }
929
+
920
930
  # Hit second server again after restore, expect same failures
921
931
  sleep(2)
922
932
  exceptions = []
923
933
  100.times { begin; cache.set key, @value; rescue => e; exceptions << e; end }
924
- assert_equal failures, exceptions.map { |x| x.class }
934
+ assert_equal failures, exceptions.map { |x| x.class }
925
935
 
926
936
  socket.close
927
937
  end
@@ -973,13 +983,13 @@ class MemcachedTest < Test::Unit::TestCase
973
983
  end
974
984
  threads.each {|thread| thread.join}
975
985
  end
976
-
977
- # Hash
978
-
986
+
987
+ # Hash
988
+
979
989
  def test_hash
980
- assert_equal 3157003241,
990
+ assert_equal 3157003241,
981
991
  Rlibmemcached.memcached_generate_hash_rvalue("test", Rlibmemcached::MEMCACHED_HASH_FNV1_32)
982
- end
992
+ end
983
993
 
984
994
  # Memory cleanup
985
995
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memcached
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.2
4
+ version: 0.17.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Weaver
@@ -30,7 +30,7 @@ cert_chain:
30
30
  yZ0=
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-09-22 00:00:00 -07:00
33
+ date: 2009-09-30 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies: []
36
36
 
metadata.gz.sig CHANGED
Binary file