r53051 - in /branches/upstream/libcache-fastmmap-perl/current: Cache-FastMmap-CImpl/CImpl.pm Cache-FastMmap-CImpl/mmap_cache.c Changes FastMmap.pm MANIFEST META.yml README t/16.t

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Fri Feb 19 14:56:27 UTC 2010


Author: ansgar-guest
Date: Fri Feb 19 14:56:10 2010
New Revision: 53051

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53051
Log:
[svn-upgrade] Integrating new upstream version, libcache-fastmmap-perl (1.35)

Added:
    branches/upstream/libcache-fastmmap-perl/current/t/16.t
Modified:
    branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/CImpl.pm
    branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache.c
    branches/upstream/libcache-fastmmap-perl/current/Changes
    branches/upstream/libcache-fastmmap-perl/current/FastMmap.pm
    branches/upstream/libcache-fastmmap-perl/current/MANIFEST
    branches/upstream/libcache-fastmmap-perl/current/META.yml
    branches/upstream/libcache-fastmmap-perl/current/README

Modified: branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/CImpl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/CImpl.pm?rev=53051&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/CImpl.pm (original)
+++ branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/CImpl.pm Fri Feb 19 14:56:10 2010
@@ -15,7 +15,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.34';
+our $VERSION = '1.35';
 
 require XSLoader;
 XSLoader::load('Cache::FastMmap::CImpl', $VERSION);
@@ -38,7 +38,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2003 by FastMail IP Partners
+Copyright (C) 2003-2010 by The FastMail Partnership
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 

Modified: branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache.c?rev=53051&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache.c (original)
+++ branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache.c Fri Feb 19 14:56:10 2010
@@ -986,6 +986,7 @@
   MU32 slots_left, * slots_end;
   /* Modulo hash_slot to find starting slot */
   MU32 * slot_ptr = cache->p_base_slots + (hash_slot % cache->p_num_slots);
+  MU32 * first_deleted = (MU32 *)0;
 
   /* Total slots and pointer to end of slot data to do wrapping */
   slots_left = cache->p_num_slots;
@@ -1003,12 +1004,16 @@
 
     /* data_offset == 0 means empty slot, and no more beyond */
     /* data_offset == 1 means deleted slot, we can reuse if writing */
-    if (data_offset == 0 || (data_offset == 1 && mode == 1)) {
-
+    if (data_offset == 0) {
       /* Return pointer to last checked slot */
       return slot_ptr;
     }
-
+    if (data_offset == 1 && mode == 1 && 0 == slot_ptr) {
+      /* Save pointer to first usable slot; if we don't find the key later,
+         we'll fall back to returning this.
+      */
+      first_deleted = slot_ptr;
+    }
     /* deleted slot, keep looking */
     if (data_offset == 1) {
 
@@ -1032,7 +1037,10 @@
     ASSERT(slot_ptr >= cache->p_base_slots && slot_ptr < slots_end);
   }
 
-  return 0;
+  if (1 == mode && 0 != first_deleted)
+    return first_deleted;
+  else
+    return 0;
 }
 
 /*

Modified: branches/upstream/libcache-fastmmap-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/Changes?rev=53051&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/Changes (original)
+++ branches/upstream/libcache-fastmmap-perl/current/Changes Fri Feb 19 14:56:10 2010
@@ -1,4 +1,9 @@
 Revision history for Perl extension Cache::FastMmap.
+
+1.35 Fri Feb 19 12:45 2010
+  - Fix for returning potential bug that returns old stored
+     data. Could occur if you mix deletes
+     (thanks Darrell Bishop)
 
 1.34 Fri Jun 19 12:00 2009
   - perldoc fix (thanks Jonathan Yu)
@@ -17,6 +22,7 @@
     cache is left at interpreter exit time (required
     Scalar::Util qw(weaken) for object tracking)
 
+>>>>>>> .r21903
 1.30 Fri May 8  11:10 2009
   - Fix for Mandriva compiler (thanks Jean-Christian Hassler)
 

Modified: branches/upstream/libcache-fastmmap-perl/current/FastMmap.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/FastMmap.pm?rev=53051&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/FastMmap.pm (original)
+++ branches/upstream/libcache-fastmmap-perl/current/FastMmap.pm Fri Feb 19 14:56:10 2010
@@ -287,7 +287,7 @@
 use warnings;
 use bytes;
 
-our $VERSION = '1.34';
+our $VERSION = '1.35';
 
 # Track currently live caches so we can cleanup in END {}
 #  if we have empty_on_exit set
@@ -1271,7 +1271,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2003-2008 by FastMail IP Partners
+Copyright (C) 2003-2010 by The FastMail Partnership
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 

Modified: branches/upstream/libcache-fastmmap-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/MANIFEST?rev=53051&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/MANIFEST (original)
+++ branches/upstream/libcache-fastmmap-perl/current/MANIFEST Fri Feb 19 14:56:10 2010
@@ -23,6 +23,7 @@
 t/13.t
 t/14.t
 t/15.t
+t/16.t
 t/2.t
 t/3.t
 t/4.t

Modified: branches/upstream/libcache-fastmmap-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/META.yml?rev=53051&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/META.yml (original)
+++ branches/upstream/libcache-fastmmap-perl/current/META.yml Fri Feb 19 14:56:10 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                Cache-FastMmap
-version:             1.34
+version:             1.35
 abstract:            Uses an mmap'ed file to act as a shared memory interprocess cache
 license:             ~
 author:              

Modified: branches/upstream/libcache-fastmmap-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/README?rev=53051&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/README (original)
+++ branches/upstream/libcache-fastmmap-perl/current/README Fri Feb 19 14:56:10 2010
@@ -25,7 +25,7 @@
 
 COPYRIGHT AND LICENCE
 
-Copyright (C) 2003-2009 by FastMail IP Partners
+Copyright (C) 2003-2010 by The FastMail Partnership
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 

Added: branches/upstream/libcache-fastmmap-perl/current/t/16.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/t/16.t?rev=53051&op=file
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/t/16.t (added)
+++ branches/upstream/libcache-fastmmap-perl/current/t/16.t Fri Feb 19 14:56:10 2010
@@ -1,0 +1,42 @@
+
+#########################
+
+use Test::More tests => 3;
+BEGIN { use_ok('Cache::FastMmap') };
+use strict;
+
+#########################
+
+# Insert your test code below, the Test::More module is use()ed here so read
+# its man page ( perldoc Test::More ) for help writing this test script.
+
+my $FC = Cache::FastMmap->new(
+  init_file => 1,
+  raw_values => 0,
+  num_pages => 1,
+  page_size => 2 ** 15,
+);
+ok( defined $FC );
+
+my @d;
+
+for (1 .. 20) {
+
+  $FC->set($_, $d[$_]=$_) for 1 .. 100;
+
+  for (1 .. 50) {
+    $FC->remove($_*2);
+    $d[$_*2] = undef;
+
+    $FC->set($_, $_*2);
+    $d[$_] = $_*2;
+
+    for my $c (1 .. 100) {
+      my $v = $FC->get($c);
+      ($v || 0) == ($d[$c] || 0)
+        || die "at offset $c, got $v expected $d[$c]";
+    }
+  }
+
+}
+ok(1, "ordering santity tests complete");




More information about the Pkg-perl-cvs-commits mailing list