Skip to content
Newer
Older
100755 94 lines (83 sloc) 4.6 KB
d819887 @steveyen CouchDB replication protocol notes
steveyen authored
1 CouchDB replication protocol...
2
3 PUSH replication...
4
5 Replication when destination is brand-new (clean)...
6
7 HEAD /$DB/
8 GET /$DB/
9 {"db_name":"statuswall-0",
10 "update_seq":"0-g1AAAADneJzLYWBgYMlgTmFQSElKzi9KdUhJMtbLTS3KLElMT9VLzskvTUnMK9HLSy3JAapkSmRIsv___39WIgOqHhM8epIcgGRSPTZt-KzKYwGSDA1ACqhzP0k2QrQegGgF2ZoFAGmrTUA",
11 "purge_seq":0,"other":{"data_size":0},
12 "doc_del_count":0,"doc_count":0,
13 "disk_size":316,"disk_format_version":5,
14 "compact_running":false,"instance_start_time":"0"}
15 GET /$DB/_local/74745a93e31010427fea027036fbd3bc
16 404 Object Not Found
17 POST /$DB/_revs_diff HTTP/1.1
18 => {"_design/statushub":["1-a091ec5162ae0826104ba17beb603ecf"]}
19 <= {"_design/$DB":{"missing":["1-a091ec5162ae0826104ba17beb603ecf"]}}
20 PUT /$DB/_design/statushub?new_edits=false
21 => Content-Type: multipart/related; boundary="17e9d52bc2517c2216438758f99ac192"
22 --17e9d52bc2517c2216438758f99ac192
23 content-type: application/json
24 {"_id":"_design/statushub","_rev":"1-a091ec5162ae0826104ba17beb603ecf",
25 "vendor":{"couchapp":{"evently":{"profile":{"profileReady":{"after":"function(e,
26 ...
27 --17e9d52bc2517c2216438758f99ac192
28 ... (more parts)
29 --17e9d52bc2517c2216438758f99ac192--
30 <= HTTP/1.1 201 Created
31 Location: http://steve.cloudant.com:80/statuswall-0/_design/statushub
32 Etag: "1-a091ec5162ae0826104ba17beb603ecf"
33 {"ok":true,"id":"_design/statushub","rev":"1-a091ec5162ae0826104ba17beb603ecf"}
34 POST /statuswall-0/_revs_diff
35 => {"2011-06-30_hello there2":["1-0286dbb6323b61e7f0be3ba5d1633985"]}
36 <= {"2011-06-30_hello there2":{"missing":["1-0286dbb6323b61e7f0be3ba5d1633985"]}}
37 POST /statuswall-0/_bulk_docs
38 => Transfer-Encoding: chunked
39 X-Couch-Full-Commit: false
40 1B
41 {"new_edits":false,"docs":[
42 C3
43 {"_id":"2011-06-30_hello there2","_rev":"1-0286dbb6323b61e7f0be3ba5d1633985","name":"hello there2","status":"dlskdfjsdf there","_revisions":{"start":1,"ids":["0286dbb6323b61e7f0be3ba5d1633985"]}}
44 2
45 ]}
46 0
47 <= HTTP/1.1 201 Created
48 POST /statuswall-0/_revs_diff
49 => {"2011-06-30_hi":["5-8fe6dd620ea8c93192ddaa7cd45857be"],
50 "2011-06-30_foo3":["1-99180126270af12c48a2500a4c5d1fd6"],
51 "2011-06-30_foo":["8-a8bad1989e78bc172c54327a7655486c"],
52 "2011-06-30_foo2":["2-e40956c5f8f96fb54d8813239f2856ed"],
53 "2011-06-30_afoo2":["1-f175853f526d4115807557cdd2ede448"],
54 "2011-06-30_afoo1":["1-a5c69e5a8f2fc546b32ee92ff7ce2808"],
55 "2011-06-30_steve":["2-0e3e3975ce8532c83ca9c31a9484b7ca"],
56 "_design/statuswall":["65-bf0afebdfead26cbbc603f7d48127182"]}
57 <= {"2011-06-30_foo2":{"missing":["2-e40956c5f8f96fb54d8813239f2856ed"]},
58 "2011-06-30_afoo2":{"missing":["1-f175853f526d4115807557cdd2ede448"]},
59 "_design/statuswall":{"missing":["65-bf0afebdfead26cbbc603f7d48127182"]},
60 "2011-06-30_hi":{"missing":["5-8fe6dd620ea8c93192ddaa7cd45857be"]},
61 "2011-06-30_steve":{"missing":["2-0e3e3975ce8532c83ca9c31a9484b7ca"]},
62 "2011-06-30_afoo1":{"missing":["1-a5c69e5a8f2fc546b32ee92ff7ce2808"]},
63 "2011-06-30_foo":{"missing":["8-a8bad1989e78bc172c54327a7655486c"]},
64 "2011-06-30_foo3":{"missing":["1-99180126270af12c48a2500a4c5d1fd6"]}}
65
66 ...repeat...
67
68 POST /statuswall-0/_ensure_full_commit
69 HTTP/1.1 201 Created
70 {"ok":true,"instance_start_time":"0"}
71
72 PUT /statuswall-0/_local/74745a93e31010427fea027036fbd3bc HTTP/1.1
73 => {"_id":"_local/74745a93e31010427fea027036fbd3bc","session_id":"0e6d14263f13e3ba06aa28c1764f52eb",
74 "source_last_seq":91,"replication_id_version":2,
75 "history":[{"session_id":"0e6d14263f13e3ba06aa28c1764f52eb",
76 "start_time":"Tue, 13 Dec 2011 18:21:32 GMT",
77 "end_time":"Tue, 13 Dec 2011 18:21:33 GMT",
78 "start_last_seq":0,"end_last_seq":91,
79 "recorded_seq":91,"missing_checked":12,"missing_found":12,
80 "docs_read":12,"docs_written":12,"doc_write_failures":0}],
81 "_revisions":{"start":0,"ids":[]}}
82 <= {"ok":true,"id":"_local/74745a93e31010427fea027036fbd3bc","rev":"0-1"}
83
84 Questions?
85
86 * What is "X-Couch-Request-ID: b6fb3dc0"?
87 * What is "GET /$DB/_local/74745a93e31010427fea027036fbd3bc"?
88 * What is "X-Couch-Full-Commit: false"?
89 false means delay_commit (not full_commit).
90
91 * http://wiki.apache.org/couchdb/Replication
92 ** As of CouchDB 0.9, pull replication is a lot more efficient and resistant to errors, and it is suggested that you use pull replication in most cases, especially if your documents are large or you have large attachments.
93
Something went wrong with that request. Please try again.