From 92fd82fc05084e0ebe47634c46c913d12342a11f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 17 Dec 2018 12:45:54 -0300 Subject: [PATCH] Bug 16067: Remove FastMmap --- C4/Installer/PerlDependencies.pm | 5 ----- Koha/Cache.pm | 38 +------------------------------------- debian/control | 2 -- t/Cache.t | 4 ---- 4 files changed, 1 insertion(+), 48 deletions(-) diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index fc5e99e0ca..891bdae3c9 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -262,11 +262,6 @@ our $PERL_DEPS = { 'required' => '0', 'min_ver' => '0.17' }, - 'Cache::FastMmap' => { - 'usage' => 'Caching', - 'required' => '0', - 'min_ver' => '1.34' - }, 'Net::LDAP::Filter' => { 'usage' => 'LDAP Interface Feature', 'required' => '0', diff --git a/Koha/Cache.pm b/Koha/Cache.pm index cf77257825..2406764d51 100644 --- a/Koha/Cache.pm +++ b/Koha/Cache.pm @@ -51,7 +51,7 @@ use Koha::Config; use base qw(Class::Accessor); __PACKAGE__->mk_ro_accessors( - qw( cache memcached_cache fastmmap_cache memory_cache )); + qw( cache memcached_cache )); our %L1_cache; our $L1_encoder = Sereal::Encoder->new; @@ -94,15 +94,6 @@ sub new { $self->{'cache'} = $self->{'memcached_cache'}; } - if ( $self->{'default_type'} eq 'fastmmap' - && defined( $ENV{GATEWAY_INTERFACE} ) - && can_load( modules => { 'Cache::FastMmap' => undef } ) - && _initialize_fastmmap($self) - && defined( $self->{'fastmmap_cache'} ) ) - { - $self->{'cache'} = $self->{'fastmmap_cache'}; - } - $ENV{DEBUG} && carp "Selected caching system: " . ($self->{'cache'} // 'none'); return @@ -141,33 +132,6 @@ sub _initialize_memcached { return $self; } -sub _initialize_fastmmap { - my ($self) = @_; - my ($cache, $share_file); - - # Temporary workaround to catch fatal errors when: C4::Context module - # is not loaded beforehand, or Cache::FastMmap init fails for whatever - # other reason (e.g. due to permission issues - see Bug 13431) - eval { - $share_file = join( '-', - "/tmp/sharefile-koha", $self->{'namespace'}, - C4::Context->config('hostname'), C4::Context->config('database') ); - - $cache = Cache::FastMmap->new( - 'share_file' => $share_file, - 'expire_time' => $self->{'timeout'}, - 'unlink_on_exit' => 0, - ); - }; - if ( $@ ) { - warn "FastMmap cache initialization failed: $@"; - return; - } - return unless defined $cache; - $self->{'fastmmap_cache'} = $cache; - return $self; -} - =head2 is_cache_active Routine that checks whether or not a default caching method is active on this diff --git a/debian/control b/debian/control index 9f77f85466..5017c2c192 100644 --- a/debian/control +++ b/debian/control @@ -19,7 +19,6 @@ Build-Depends: libalgorithm-checkdigits-perl, libbusiness-isbn-perl, libbusiness-issn-perl, libbytes-random-secure-perl, - libcache-fastmmap-perl, libcache-memcached-fast-perl, libcache-memcached-perl, libcache-perl, @@ -254,7 +253,6 @@ Depends: libalgorithm-checkdigits-perl, libbusiness-isbn-perl, libbusiness-issn-perl, libbytes-random-secure-perl, - libcache-fastmmap-perl, libcache-memcached-fast-perl, libcache-memcached-perl, libcache-perl, diff --git a/t/Cache.t b/t/Cache.t index 3af4f6f9fd..e47393f22c 100644 --- a/t/Cache.t +++ b/t/Cache.t @@ -284,9 +284,5 @@ END { skip "Cache not enabled", 1 unless ( $cache->is_cache_active() ); is( $destructorcount, 1, 'Destructor run exactly once' ); - # cleanup temporary file - my $tmp_file = $cache->{ fastmmap_cache }->{ share_file }; - unlink $tmp_file if defined $tmp_file; - } } -- 2.11.0