From fa53ccda7a0e4e975276ed421e7226393adb7ee8 Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Mon, 19 Mar 2018 08:14:49 +0000 Subject: import: enable locking under v2 Instead of using ssoma-based locking, enable locking via Import for now. --- lib/PublicInbox/V2Writable.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/V2Writable.pm') diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index a305842e..bdde76bb 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -26,10 +26,13 @@ sub nproc () { sub new { my ($class, $v2ibx, $creat) = @_; my $dir = $v2ibx->{mainrepo} or die "no mainrepo in inbox\n"; + my $lock_path = "$dir/inbox.lock"; unless (-d $dir) { if ($creat) { require File::Path; File::Path::mkpath($dir); + open my $fh, '>>', $lock_path or + die "failed to open $lock_path: $!\n"; } else { die "$dir does not exist\n"; } @@ -57,6 +60,7 @@ sub new { xap_ro => undef, partitions => $nparts, transact_bytes => 0, + lock_path => "$dir/inbox.lock", # limit each repo to 1GB or so rotate_bytes => int((1024 * 1024 * 1024) / $PACKING_FACTOR), }; @@ -395,7 +399,7 @@ sub import_init { my $im = PublicInbox::Import->new($git, undef, undef, $self->{-inbox}); $im->{bytes_added} = int($packed_bytes / $PACKING_FACTOR); $im->{want_object_info} = 1; - $im->{ssoma_lock} = 0; + $im->{lock_path} = $self->{lock_path}; $im->{path_type} = 'v2'; $self->{im} = $im; } -- cgit v1.2.3-24-ge0c7