[Bps-public-commit] Prophet branch, master, updated. 92fcc26c7bc5d3c9f28aa67bba653bc2f706d35e
jesse
jesse at bestpractical.com
Mon Jun 8 17:35:29 EDT 2009
The branch, master has been updated
via 92fcc26c7bc5d3c9f28aa67bba653bc2f706d35e (commit)
via 18c1e97e4e42da469f1eba28f4c751bd8c10e8d6 (commit)
via 9aab3958539df4a05fc9d3aeb5b757ae4077cf3c (commit)
from fc1ae46803313c2b1f168cfa2013ca0d98752557 (commit)
Summary of changes:
lib/Prophet/CLI/Command/Merge.pm | 13 ---------
lib/Prophet/Replica.pm | 53 +++++++++++++++++++------------------
2 files changed, 27 insertions(+), 39 deletions(-)
- Log -----------------------------------------------------------------
commit 9aab3958539df4a05fc9d3aeb5b757ae4077cf3c
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Jun 8 17:11:20 2009 -0400
perltidy
diff --git a/lib/Prophet/Replica.pm b/lib/Prophet/Replica.pm
index b7895b8..2ff018f 100644
--- a/lib/Prophet/Replica.pm
+++ b/lib/Prophet/Replica.pm
@@ -902,17 +902,18 @@ sub record_integration_of_changeset {
my $self = shift;
my ($changeset) = validate_pos( @_, { isa => 'Prophet::ChangeSet' } );
- if ( $changeset->original_source_uuid ne $self->uuid &&
- ( $self->last_changeset_from_source( $changeset->original_source_uuid ) < $changeset->original_sequence_no ) )
- {
- $self->record_last_changeset_from_replica($changeset->original_source_uuid => $changeset->original_sequence_no );
+ if ( $changeset->original_source_uuid ne $self->uuid
+ && ( $self->last_changeset_from_source( $changeset->original_source_uuid ) < $changeset->original_sequence_no )
+ ) {
+ $self->record_last_changeset_from_replica(
+ $changeset->original_source_uuid => $changeset->original_sequence_no );
}
- if ($changeset->source_uuid) {
- if ( $self->last_changeset_from_source( $changeset->source_uuid ) < $changeset->sequence_no ) {
- $self->record_last_changeset_from_replica($changeset->source_uuid => $changeset->sequence_no );
+ if ( $changeset->source_uuid ) {
+ if ( $self->last_changeset_from_source( $changeset->source_uuid ) < $changeset->sequence_no ) {
+ $self->record_last_changeset_from_replica( $changeset->source_uuid => $changeset->sequence_no );
+ }
}
}
-}
sub record_last_changeset_from_replica {
my $self = shift;
commit 18c1e97e4e42da469f1eba28f4c751bd8c10e8d6
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Jun 8 17:18:05 2009 -0400
Better factoring of our "skip txns we've seen before" code.
diff --git a/lib/Prophet/CLI/Command/Merge.pm b/lib/Prophet/CLI/Command/Merge.pm
index 1c37595..8d949cd 100644
--- a/lib/Prophet/CLI/Command/Merge.pm
+++ b/lib/Prophet/CLI/Command/Merge.pm
@@ -83,19 +83,6 @@ sub _do_merge {
resdb => $self->resdb_handle,
resolver_class => $self->merge_resolver(),
force => $self->has_arg('force'),
- before_load_changeset_callback => sub {
- my %args = (@_);
- my ($seq, $orig_uuid, $orig_seq, $key) = @{$args{changeset_metadata}};
- # skip changesets we've seen before
- if (
- $self->target->has_seen_changeset( source_uuid => $orig_uuid,
- sequence_no => $orig_seq) ){
- return undef;
- } else {
- return 1;
- }
-
- },
);
local $| = 1;
diff --git a/lib/Prophet/Replica.pm b/lib/Prophet/Replica.pm
index 2ff018f..cf97748 100644
--- a/lib/Prophet/Replica.pm
+++ b/lib/Prophet/Replica.pm
@@ -167,7 +167,6 @@ sub import_changesets {
resolver_class => { optional => 1 },
conflict_callback => { type => CODEREF, optional => 1 },
reporting_callback => { type => CODEREF, optional => 1 },
- before_load_changeset_callback => { type => CODEREF, optional => 1 },
force => { optional => 1 },
}
);
@@ -182,7 +181,19 @@ sub import_changesets {
$source->traverse_changesets(
after => $self->last_changeset_from_source( $self->uuid ),
- ($args{before_load_changeset_callback} ? (before_load_changeset_callback => $args{before_load_changeset_callback}) : ()),
+ before_load_changeset_callback => sub {
+ my %args = (@_);
+ my ($seq, $orig_uuid, $orig_seq, $key) = @{$args{changeset_metadata}};
+ # skip changesets we've seen before
+ if (
+ $self->has_seen_changeset( source_uuid => $orig_uuid,
+ sequence_no => $orig_seq) ){
+ return undef;
+ } else {
+ return 1;
+ }
+
+ },
callback => sub {
my %callback_args = (@_);
$self->integrate_changeset(
@@ -231,21 +242,6 @@ sub import_resolutions_from_remote_replica {
$self->resolution_db_handle->import_changesets(
from => $source->resolution_db_handle,
- before_load_changeset_callback => sub {
- my %args = (@_);
- my ($seq, $orig_uuid, $orig_seq, $key) = @{$args{changeset_metadata}};
- # skip changesets we've seen before
- if (
- $self->resolution_db_handle->has_seen_changeset( source_uuid => $orig_uuid,
- sequence_no => $orig_seq) ){
- return undef;
- } else {
- return 1;
- }
-
- },
-
-
resolver => sub { die "not implemented yet" },
force => $args{force},
);
commit 92fcc26c7bc5d3c9f28aa67bba653bc2f706d35e
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Jun 8 17:34:49 2009 -0400
Use correct logic for finding after which transaction we should begin reading txns
Record immediate upstream txn even when we're going to skip it.
diff --git a/lib/Prophet/Replica.pm b/lib/Prophet/Replica.pm
index cf97748..a70a9ee 100644
--- a/lib/Prophet/Replica.pm
+++ b/lib/Prophet/Replica.pm
@@ -180,15 +180,19 @@ sub import_changesets {
$self->log_debug("Integrating changesets from ".$source->uuid. " after ". $self->last_changeset_from_source( $self->uuid ));
$source->traverse_changesets(
- after => $self->last_changeset_from_source( $self->uuid ),
+ after => $self->last_changeset_from_source( $source->uuid ),
before_load_changeset_callback => sub {
my %args = (@_);
my ($seq, $orig_uuid, $orig_seq, $key) = @{$args{changeset_metadata}};
# skip changesets we've seen before
- if (
- $self->has_seen_changeset( source_uuid => $orig_uuid,
- sequence_no => $orig_seq) ){
- return undef;
+ if ( $self->has_seen_changeset( source_uuid => $orig_uuid, sequence_no => $orig_seq) ){
+ # If we've seen the changeset, yet we still got here, it means we saw it by original
+ # replica/sequence pair, but not # the direct upstream's uuid/sequence pair.
+ # recording that can help performance a whole bunch for next sync
+ if ($source->uuid && $seq > $self->last_changeset_from_source($source->uuid)) {
+ $self->record_last_changeset_from_replica( $source->uuid => $seq);
+ }
+ return undef;
} else {
return 1;
}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list