Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

public-api duplicate persistent replications running on multiple threads #214

Closed
march44 opened this Issue · 2 comments

2 participants

@march44

When creating multiple TD object stacks on multiple treads, persistent replications get run on all threads causing conflicts when saving checkpoints.

I am creating the TD stack on the threads like this:

TDDatabaseManager *manager = [[TDDatabaseManager alloc] init];
TDDatabase *myDb = [manager databaseNamed:@"mydb"];

//Set up MAPFUNCTIONS here

TDView view = [myDb viewNamed:@"my view"];
TDLiveQuery
query = [[view query] asLiveQuery];

I am seeing conflicts like these.

21:10:56.768| Sync: TDPusher[http://192.168.0.10:4984/basecouch] checkpointing sequence=11
21:10:56.770| Sync: TDPusher[http://192.168.0.10:4984/basecouch] checkpointing sequence=11
21:10:56.958| TDRemoteJSONRequest[PUT http://192.168.0.10:4984/basecouch/_local/c19d0dd866e9119984073f9bede9a06a1a9a60df]: Got error Error Domain=TDHTTP Code=409 "409 conflict" UserInfo=0x1f82c1e0 {NSURL=http://192.168.0.10:4984/basecouch/_local/c19d0dd866e9119984073f9bede9a06a1a9a60df, NSLocalizedDescription=409 conflict, NSLocalizedFailureReason=conflict}
21:10:56.958| WARNING*** : TDPusher[http://192.168.0.10:4984/basecouch]: Unable to save remote checkpoint: Error Domain=TDHTTP Code=409 "409 conflict" UserInfo=0x1f82c1e0 {NSURL=http://192.168.0.10:4984/basecouch/_local/c19d0dd866e9119984073f9bede9a06a1a9a60df, NSLocalizedDescription=409 conflict, NSLocalizedFailureReason=conflict}
21:10:58.079| Sync: TDPuller[http://192.168.0.10:4984/basecouch] checkpointing sequence=11
21:10:58.082| Sync: TDPuller[http://192.168.0.10:4984/basecouch] checkpointing sequence=11
21:10:59.115| TDRemoteJSONRequest[PUT http://192.168.0.10:4984/basecouch/_local/78283a6234c76dd3e6b054ae98b1861779f93b60]: Got error Error Domain=TDHTTP Code=409 "409 conflict" UserInfo=0x1ed9a330 {NSURL=http://192.168.0.10:4984/basecouch/_local/78283a6234c76dd3e6b054ae98b1861779f93b60, NSLocalizedDescription=409 conflict, NSLocalizedFailureReason=conflict}
21:10:59.116| WARNING*** : TDPuller[http://192.168.0.10:4984/basecouch]: Unable to save remote checkpoint: Error Domain=TDHTTP Code=409 "409 conflict" UserInfo=0x1ed9a330 {NSURL=http://192.168.0.10:4984/basecouch/_local/78283a6234c76dd3e6b054ae98b1861779f93b60, NSLocalizedDescription=409 conflict, NSLocalizedFailureReason=conflict}

@snej
Owner

You can avoid this by starting the secondary-thread TDDatabaseManagers with the noReplicator option.

I'll add some API to make this convenient/automatic — something like calling [myDbManager copy] to get a new database manager you can use on a background thread, and which will automatically have noReplicator set.

@snej
Owner

I'll add some API to make this convenient/automatic — something like calling [myDbManager copy]

I did that a while ago … closing this bug now.

@snej snej closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.