You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"_id": "doc1", "scope": "_default", "collection": "_default", "channels": ["*"], "type": "test", "value": "This is a test document for short_expiry dataset."}
Copy file name to clipboardExpand all lines: spec/tests/QE/test_delta_sync.md
+97-16Lines changed: 97 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,12 @@ Verify push/pull replication works with large data and delta sync. Ensures that
15
15
7. Start push-pull replication and verify only the updated documents are processed due to delta sync.
16
16
8. Check delta sync stats for number of docs updated.
17
17
18
+
### Key Assertions
19
+
- The number of processed documents after modification matches the number of changed documents.
20
+
- No unnecessary documents are replicated.
21
+
- The document IDs of updated documents match the expected set.
22
+
- The document count in the database remains consistent before and after delta sync replication.
23
+
18
24
## #2 test_delta_sync_nested_doc
19
25
20
26
### Description
@@ -30,22 +36,97 @@ Verify delta sync works with nested documents. Ensures that only changed nested
30
36
7. Start push-pull replication and verify only the updated nested document is processed due to delta sync.
31
37
8. Check delta sync stats for number of docs updated.
32
38
33
-
## Purpose
34
-
This test verifies delta sync functionality in Couchbase Lite and Sync Gateway. It ensures that only changed documents are processed and replicated, and that delta sync bandwidth savings are realized.
35
-
36
-
## Test Steps
37
-
1.**Setup**: Reset Sync Gateway and load the required dataset with delta sync enabled.
38
-
2.**Database Initialization**: Reset the local database and load the dataset.
39
-
3.**Initial Replication**: Start a replicator and perform initial replication to ensure all documents are present.
40
-
4.**Document Modification**: Modify a subset of documents in Couchbase Lite.
41
-
5.**Delta Sync Replication**: Start replication again and verify that only the modified documents are processed due to delta sync.
42
-
6.**Assertions**:
43
-
- Only the changed documents are processed during the second replication.
44
-
- The total document count remains unchanged.
45
-
- Delta sync is enabled and functioning as expected.
46
-
47
-
## Key Assertions
39
+
### Key Assertions
48
40
- The number of processed documents after modification matches the number of changed documents.
49
41
- No unnecessary documents are replicated.
50
42
- The document IDs of updated documents match the expected set.
51
-
- The document count in the database remains consistent before and after delta sync replication.
43
+
- The document count in the database remains consistent before and after delta sync replication.
44
+
45
+
## #3 test_delta_sync_utf8_strings
46
+
47
+
### Description
48
+
Verify delta sync works with documents containing large UTF-8 strings. Ensures that delta sync can handle multi-byte and non-ASCII data efficiently.
49
+
50
+
### Steps
51
+
1. Reset Sync Gateway and load the `travel` dataset with delta sync enabled.
52
+
2. Reset the local database and load the `travel` dataset.
53
+
3. Start a replicator and perform initial replication.
54
+
4. Create a document in Couchbase Lite with a large UTF-8 string field.
55
+
5. Push the document to Sync Gateway.
56
+
6. Update the document in Sync Gateway with a new UTF-8 string value.
57
+
7. Pull the changes to Couchbase Lite.
58
+
8. Verify that only the delta is transferred (bytes transferred < doc size).
59
+
60
+
### Key Assertions
61
+
- The document is replicated successfully with UTF-8 content.
62
+
- The bytes transferred for the delta are less than the full document size.
63
+
64
+
## #4 test_delta_sync_enabled_disabled
65
+
66
+
### Description
67
+
Verify delta sync behavior when toggling delta sync enabled/disabled. Ensures that full documents are transferred when delta sync is disabled and deltas are used when enabled.
68
+
69
+
### Steps
70
+
1. Reset Sync Gateway and load the `travel` dataset with delta sync enabled.
71
+
2. Reset the local database and load the `travel` dataset.
72
+
3. Create and update documents in Couchbase Lite.
73
+
4. Replicate and record bytes transferred (delta sync enabled).
74
+
5. Reset Sync Gateway and load the `posts` dataset with delta sync disabled.
75
+
6. Reset the local database and load the `posts` dataset.
76
+
7. Create and update documents in Couchbase Lite.
77
+
8. Replicate and record bytes transferred (delta sync disabled).
78
+
9. Compare bytes transferred in both cases.
79
+
80
+
### Key Assertions
81
+
- When delta sync is enabled, bytes transferred for updates are less than the full doc size.
82
+
- When delta sync is disabled, bytes transferred are close to the full doc size.
83
+
84
+
## #5 test_delta_sync_within_expiry
85
+
86
+
### Description
87
+
Verify delta sync behavior within and after the delta revision expiry window. Ensures that deltas are used before expiry and full docs are sent after expiry.
88
+
89
+
### Steps
90
+
1. Reset Sync Gateway and load a dataset with short delta sync expiry.
91
+
2. Create and update documents in Couchbase Lite.
92
+
3. Replicate to Sync Gateway and record bytes transferred.
93
+
4. Update the document in Sync Gateway.
94
+
5. Wait for the delta revision to expire.
95
+
6. Replicate back to Couchbase Lite and record bytes transferred.
96
+
7. Compare bytes transferred before and after expiry.
97
+
98
+
### Key Assertions
99
+
- Before expiry, delta sync is used (bytes transferred < doc size).
100
+
- After expiry, a full document is transferred (bytes transferred ≈ doc size).
101
+
102
+
## #6 test_delta_sync_with_no_deltas
103
+
104
+
### Description
105
+
Test the case where an update does not produce any changes (empty delta). Ensures that no unnecessary data is transferred and document content remains consistent.
106
+
107
+
### Steps
108
+
1. Create new documents in Couchbase Lite and/or Sync Gateway.
109
+
2. Replicate documents between CBL and SGW.
110
+
3. Update a document with the same value as the previous revision (no actual change).
111
+
4. Replicate again and verify no unnecessary data is transferred.
112
+
5. Ensure document content matches between CBL and SGW.
113
+
114
+
### Key Assertions
115
+
- No unnecessary data is transferred for empty delta updates.
116
+
- Document content is consistent between CBL and SGW after all updates.
117
+
118
+
## #7 test_delta_sync_larger_than_doc
119
+
120
+
### Description
121
+
Verify delta sync behavior when the delta is larger than the document itself. Ensures that Sync Gateway falls back to sending the full document in such cases.
122
+
123
+
### Steps
124
+
1. Reset Sync Gateway and load the `travel` dataset with delta sync enabled.
125
+
2. Create and replicate a document in Couchbase Lite.
126
+
3. Update the document in Sync Gateway with a very large change (delta > doc size).
127
+
4. Replicate the document to Couchbase Lite.
128
+
5. Record and compare bytes transferred.
129
+
130
+
### Key Assertions
131
+
- When the delta is larger than the document, a full document is transferred.
132
+
- The bytes transferred are close to the full document size, not the delta size.
0 commit comments