[svk-commit] r2242 - in branches/2.0-releng/lib/SVK: Mirror/Backend

nobody at bestpractical.com nobody at bestpractical.com
Wed Dec 20 07:14:41 EST 2006


Author: clkao
Date: Wed Dec 20 07:14:39 2006
New Revision: 2242

Modified:
   branches/2.0-releng/lib/SVK/Editor/Serialize.pm
   branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRaPipe.pm

Log:
Make rapipeline constants configurable.

Modified: branches/2.0-releng/lib/SVK/Editor/Serialize.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Editor/Serialize.pm	(original)
+++ branches/2.0-releng/lib/SVK/Editor/Serialize.pm	Wed Dec 20 07:14:39 2006
@@ -52,7 +52,7 @@
 use strict;
 use base 'SVK::Editor';
 
-__PACKAGE__->mk_accessors(qw(cb_serialize_entry));
+__PACKAGE__->mk_accessors(qw(cb_serialize_entry textdelta_threshold));
 
 use SVK::Util qw(tmpfile slurp_fh);
 
@@ -84,7 +84,10 @@
     if (my $entry = $apply_textdelta_entry) {
 	my $fh = $entry->[-1];
 	close $fh;
-	if (-s $fh->filename < 1024 * 1024 * 2) {
+	if (defined $self->textdelta_threshold && -s $fh->filename >= $self->textdelta_threshold) {
+	    $entry->[-1] = $fh->filename;
+	}
+	else {
 	    # it appears using $entry->[-1] = \$buf and open $entry->[-1]
 	    # breaks in 5.8.4
 	    my $buf = '';
@@ -94,9 +97,6 @@
 	    unlink $fh->filename;
 	    $entry->[-1] = \$buf;
 	}
-	else {
-	    $entry->[-1] = $fh->filename;
-	}
 	$self->cb_serialize_entry->($entry);
 	$apply_textdelta_entry = undef;
     }

Modified: branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRaPipe.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRaPipe.pm	(original)
+++ branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRaPipe.pm	Wed Dec 20 07:14:39 2006
@@ -59,6 +59,7 @@
 use Storable qw(nfreeze thaw);
 use SVK::Editor::Serialize;
 use SVK::Util qw(slurp_fh);
+use SVK::Config;
 
 =head1 NAME
 
@@ -109,14 +110,27 @@
     $self->fh($p);
     $File::Temp::KEEP_ALL = 1;
     # Begin external process for buffered ra requests and send response to parent.
-    my $max_editor_in_buf = 5;
+    my $config = SVK::Config->svnconfig;
+    my $max_editor_in_buf
+        = $config ? $config->{config}->get( 'svk', 'ra-pipeline-buffer', '5' ) : 5;
     my $pool = SVN::Pool->new_default;
-    while (my $req = $gen->()) {
-	$pool->clear;
-	my ($cmd, @arg) = @$req;
-	@arg = map { $_ eq 'EDITOR' ? SVK::Editor::Serialize->new({ cb_serialize_entry =>
-								    sub { $self->_enqueue(@_); $self->try_flush } })
-			            : $_ } @arg;
+    while ( my $req = $gen->() ) {
+        $pool->clear;
+        my ( $cmd, @arg ) = @$req;
+
+        my $default_threshold = 2 * 1024 * 1024;
+        @arg = map {
+            $_ eq 'EDITOR'
+                ? SVK::Editor::Serialize->new(
+                  { textdelta_threshold => $config ? $config->{config}->get(
+                        'svk', 'ra-pipeline-delta-threshold',
+                        "$default_threshold"
+                    ) : $default_threshold,
+                    cb_serialize_entry =>
+                        sub { $self->_enqueue(@_); $self->try_flush }
+                  } )
+                : $_
+        } @arg;
 
 	# Note that we might want to switch to bandwidth based buffering,
 	while ($self->current_editors > $max_editor_in_buf) {


More information about the svk-commit mailing list