[Bps-public-commit] r17652 - in sd/trunk/lib/App/SD: . Replica/hm Replica/rt
jesse at bestpractical.com
jesse at bestpractical.com
Thu Jan 8 17:51:14 EST 2009
Author: jesse
Date: Thu Jan 8 17:51:14 2009
New Revision: 17652
Modified:
sd/trunk/lib/App/SD/ForeignReplica.pm
sd/trunk/lib/App/SD/Replica/hm/PullEncoder.pm
sd/trunk/lib/App/SD/Replica/rt.pm
sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm
Log:
* Record the record id in "pushed this transaction to the foreign db" notes.
* renamed pushed-transaction methods and columns to make it more understandable
Modified: sd/trunk/lib/App/SD/ForeignReplica.pm
==============================================================================
--- sd/trunk/lib/App/SD/ForeignReplica.pm (original)
+++ sd/trunk/lib/App/SD/ForeignReplica.pm Thu Jan 8 17:51:14 2009
@@ -36,7 +36,7 @@
-my $TXN_METATYPE = 'txn-source';
+my $TXN_METATYPE = 'txns-pushed-to-foreign-dbs';
sub _foreign_txn_id_storage {
my $self = shift;
return $self->state_handle->metadata_storage( $TXN_METATYPE, 'prophet-txn-source' );
@@ -51,17 +51,17 @@
sub record_pushed_transaction {
my $self = shift;
my %args = validate( @_,
- { transaction => 1, changeset => { isa => 'Prophet::ChangeSet' } } );
+ { transaction => 1, changeset => { isa => 'Prophet::ChangeSet' }, record => 1 } );
$self->_foreign_txn_id_storage->(
- $self->uuid . '-txn-' . $args{transaction},
+ $self->uuid . '-record-'.$args{record}. '-txn-' . $args{transaction},
join( ':',
$args{changeset}->original_source_uuid,
$args{changeset}->original_sequence_no )
);
}
-=head2 prophet_has_seen_foreign_transaction $transaction_id $foreign_record_id
+=head2 foreign_transaction_originated_locally $transaction_id $foreign_record_id
Given an transaction id, will return true if this transaction originated in Prophet
and was pushed to RT or originated in RT and has already been pulled to the prophet replica.
@@ -79,10 +79,10 @@
=cut
-sub prophet_has_seen_foreign_transaction {
+sub foreign_transaction_originated_locally {
my $self = shift;
my ($id, $record) = validate_pos( @_, 1, 1);
- return $self->_foreign_txn_id_storage->( $self->uuid . '-txn-' . $id );
+ return $self->_foreign_txn_id_storage->( $self->uuid .'-record-'.$record. '-txn-' .$id );
}
sub traverse_changesets {
Modified: sd/trunk/lib/App/SD/Replica/hm/PullEncoder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/hm/PullEncoder.pm (original)
+++ sd/trunk/lib/App/SD/Replica/hm/PullEncoder.pm Thu Jan 8 17:51:14 2009
@@ -108,7 +108,7 @@
# Skip things we've pushed
- next if $self->sync_source->prophet_has_seen_foreign_transaction( $txn->{'id'}, $args{task} );
+ next if $self->sync_source->foreign_transaction_originated_locally( $txn->{'id'}, $args{task} );
$txn->{history_entries} = $self->sync_source->hm->search( 'TaskHistory', transaction_id => $txn->{'id'} );
$txn->{email_entries} = $self->sync_source->hm->search( 'TaskEmail', transaction_id => $txn->{'id'} );
Modified: sd/trunk/lib/App/SD/Replica/rt.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/rt.pm (original)
+++ sd/trunk/lib/App/SD/Replica/rt.pm Thu Jan 8 17:51:14 2009
@@ -68,7 +68,8 @@
# XXX TODO - THIS IS WRONG - we should only be recording transactions we pushed
$self->record_pushed_transaction(
transaction => $txn->id,
- changeset => $args{'changeset'}
+ changeset => $args{'changeset'},
+ record => $args{'ticket'}
);
}
}
Modified: sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm (original)
+++ sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm Thu Jan 8 17:51:14 2009
@@ -142,7 +142,7 @@
next if $txn < $args{'starting_transaction'};
# Skip things we've pushed
- next if $self->sync_source->prophet_has_seen_foreign_transaction($txn, $args{'ticket'});
+ next if $self->sync_source->foreign_transaction_originated_locally($txn, $args{'ticket'});
my $txn_hash = $rt_handle->get_transaction(
More information about the Bps-public-commit
mailing list