You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Garrett Rooney <ro...@electricjellyfish.net> on 2006/03/10 23:53:28 UTC

Re: Issue creating large # of nodes in a transaction. (SWIG perl bindings)

On 3/10/06, Dan Mercer <dm...@8kb.net> wrote:

> I'm not sure what I'm doing wrong here, but any pointers would be
> helpful, even if you can just verify that this code behaves the same in
> your environment. It could be that my assumption that a single
> transaction should be able to handle many (certainly more than a few
> thousands) events is incorrect as well.

You're probably running out of memory.  For a nontrivial use of the
bindings you're going to have to do some pool management, see the docs
in SVN::Core.pm for more details.

-garrett

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Issue creating large # of nodes in a transaction. (SWIG perl bindings)

Posted by Dan Mercer <dm...@8kb.net>.
Garrett Rooney wrote:
> On 3/10/06, Dan Mercer <dm...@8kb.net> wrote:
>> I'm not sure what I'm doing wrong here, but any pointers would be
>> helpful, even if you can just verify that this code behaves the same in
>> your environment. 
>
> You're probably running out of memory.  For a nontrivial use of the
> bindings you're going to have to do some pool management, see the docs
> in SVN::Core.pm for more details.
Thanks for the reminder. I've gotten spoiled not having to worry about 
pool allocation under the python bindings thanks to the improvements 
made by David James and others.

The following code works a treat:

#!/usr/local/bin/perl -w

use strict;

use SVN::Core;
use SVN::Fs;
use SVN::Repos;

$|=1;

my $repos_path = shift;
my $count = shift;

my $pool = SVN::Pool->new_default;

my $svn = SVN::Repos::open($repos_path);
my $youngest = $svn->fs->youngest_rev();
my $rev_root = $svn->fs->revision_root($youngest);
my $txn = $svn->fs_begin_txn_for_commit($youngest, 'nobody', '');
my $txn_root = SVN::Fs::txn_root($txn);

my $nc = 0;
while ($nc < $count) {
    my $pool = SVN::Pool->new_default_sub;
    my $path = "/".$nc."_node";
    my $path_type = SVN::Fs::check_path($rev_root, $path, $pool);
    if ($path_type == $SVN::Node::none) {
#        SVN::Fs::make_dir($txn_root, $path);
        SVN::Fs::make_file($txn_root, $path, $pool);
        print "$nc,",
    }
    $nc++;
}
my $revnum = $svn->fs_commit_txn($txn);
print "New revision -> $revnum\n";

I'll make the change in my tool and we'll be on our way.

Thanks,

Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org