diff options
author | Sitaram Chamarty <sitaram@atc.tcs.com> | 2017-09-18 21:54:04 +0530 |
---|---|---|
committer | Sitaram Chamarty <sitaram@atc.tcs.com> | 2017-09-18 21:54:15 +0530 |
commit | 66966bd9c1ee870926b0786e91e333890cdb853a (patch) | |
tree | 54f1390745f3c8a9ae55db8633aa9823437a331f | |
parent | (test suite) fixes for new git in fedora 26... (diff) | |
download | gitolite-gentoo-66966bd9c1ee870926b0786e91e333890cdb853a.tar.gz gitolite-gentoo-66966bd9c1ee870926b0786e91e333890cdb853a.tar.bz2 gitolite-gentoo-66966bd9c1ee870926b0786e91e333890cdb853a.zip |
Revert "reduce stat() and other calls for huge installs"
This reverts commit 41b7885b77cfe992ad3c96d0b021ece51ce1b3e3.
Some parts of this change may come back later, but the caching logic
will not.
-rw-r--r-- | src/lib/Gitolite/Conf/Store.pm | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/src/lib/Gitolite/Conf/Store.pm b/src/lib/Gitolite/Conf/Store.pm index 6809f67..c7f9ab5 100644 --- a/src/lib/Gitolite/Conf/Store.pm +++ b/src/lib/Gitolite/Conf/Store.pm @@ -25,8 +25,6 @@ use Exporter 'import'; use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; -use Fcntl; -use GDBM_File; use Gitolite::Rc; use Gitolite::Common; @@ -43,11 +41,6 @@ my %groups; my %configs; my %split_conf; -# reduce the number of unnecessary stat() calls for installations like Fedora, -# which have (as of 2017-08) about 42000 repos. Each compile will only -# *really* change a few repos so this helps us not to touch the others. -my %gl_conf_cache; - my @repolist; # current repo list; reset on each 'repo ...' line my $subconf = 'master'; my $nextseq = 0; @@ -195,13 +188,10 @@ sub new_repos { next unless $repo =~ $REPONAME_PATT; # skip repo patterns next if $repo =~ m(^\@|EXTCMD/); # skip groups and fake repos - # use gl-conf as a sentinel; if it exists, all is well - next if -f "$repo.git/gl-conf"; + # use gl-conf as a sentinel + hook_1($repo) if -d "$repo.git" and not -f "$repo.git/gl-conf"; - if (-d "$repo.git") { - # directory exists but sentinel missing? Maybe a freshly imported repo? - hook_1($repo); - } else { + if ( not -d "$repo.git" ) { push @{ $rc{NEW_REPOS_CREATED} }, $repo; trigger( 'PRE_CREATE', $repo ); new_repo($repo); @@ -247,24 +237,16 @@ sub hook_repos { sub store { trace(3); - my $dbf = "$rc{GL_ADMIN_BASE}/gl-conf.cache"; - tie(%gl_conf_cache, 'GDBM_File', $dbf, O_RDWR|O_CREAT, 0666) or _die "Tie '$dbf' failed: $!"; - # first write out the ones for the physical repos _chdir( $rc{GL_REPO_BASE} ); + my $phy_repos = list_phy_repos(1); - # list of repos (union of keys of %repos plus %configs) - my %kr_kc; - @kr_kc{ keys %repos } = (); - @kr_kc{ keys %configs } = (); - for my $repo ( keys %kr_kc ) { + for my $repo ( @{$phy_repos} ) { store_1($repo); } _chdir( $rc{GL_ADMIN_BASE} ); store_common(); - - untie %gl_conf_cache; } sub parse_done { @@ -302,7 +284,7 @@ sub store_1 { # warning: writes and *deletes* it from %repos and %configs my ($repo) = shift; trace( 3, $repo ); - return unless -d "$repo.git"; + return unless ( $repos{$repo} or $configs{$repo} ) and -d "$repo.git"; my ( %one_repo, %one_config ); @@ -319,10 +301,7 @@ sub store_1 { $dumped_data .= Data::Dumper->Dump( [ \%one_config ], [qw(*one_config)] ); } - if ( ($gl_conf_cache{$repo} || '') ne $dumped_data ) { - _print( "$repo.git/gl-conf", $dumped_data ); - $gl_conf_cache{$repo} = $dumped_data; - } + _print( "$repo.git/gl-conf", $dumped_data ); $split_conf{$repo} = 1; } |