Skip to content

Commit 1d72288

Browse files
pimpinclaude
andcommitted
Clean up redundant examples and document final findings
Remove redundant and non-functional test examples: - tombstone_purge_test_short.rs: Redundant with tombstone_quick_check - tombstone_resurrection_test.rs: Non-functional - reset checkpoint does not re-push unmodified documents - test_with_reporting.rs: Demo only, not a real test Keep essential examples: - ticket_70596.rs: Original auto-purge test - check_cbs_config.rs: Configuration verification utility - tombstone_quick_check.rs: Rapid validation (~30s) - tombstone_purge_test.rs: Complete automated test with reporting All utility infrastructure (utils/) remains unchanged. README updates: - Document key findings from extensive testing - Tombstone purge timing requirements - Reset checkpoint limitation for BC-994 scenario - Simplified examples section Key findings documented: ✅ Tombstone purge works when configured at bucket creation ❌ Retroactive configuration does not purge existing tombstones ❌ Reset checkpoint alone does not re-push unmodified documents 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 1d0b885 commit 1d72288

File tree

4 files changed

+14
-867
lines changed

4 files changed

+14
-867
lines changed

examples/README.md

Lines changed: 14 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ $ curl -XPUT -v "http://localhost:4985/my-db/" -H 'Content-Type: application/jso
4444

4545
## Automated Test Infrastructure
4646

47-
The long-running tests (`tombstone_purge_test` and `tombstone_purge_test_short`) now include:
47+
The `tombstone_purge_test` includes comprehensive automation:
4848

4949
- **Automatic Docker environment management**: Stops, rebuilds, and starts containers with correct configuration
5050
- **Git validation**: Ensures no uncommitted changes before running
51+
- **Timezone synchronization**: Verifies containers use same timezone as host
5152
- **Structured reporting**: Generates comprehensive test reports in `test_results/` directory
5253

5354
### Test Reports
@@ -62,6 +63,18 @@ Each test run generates a timestamped report directory containing:
6263

6364
**Example report path**: `test_results/test_run_2025-11-01_08-00-00_8db78d6/`
6465

66+
### Important Findings
67+
68+
**Tombstone Purge Behavior:**
69+
- ✅ Tombstones are purged after 1 hour when purge interval is configured **at bucket creation**
70+
- ❌ Configuring purge interval after tombstones are created does NOT purge existing tombstones
71+
- ✅ Re-created documents are always treated as new (`flags=0`) even if tombstone persists
72+
73+
**Reset Checkpoint Limitation:**
74+
- ❌ Reset checkpoint alone does NOT re-push unmodified documents
75+
- CBLite only pushes documents that changed since last successful sync
76+
- For BC-994 scenario, documents must be modified locally before reset to trigger push
77+
6578
## Running an example
6679

6780
### Available examples
@@ -98,15 +111,6 @@ Demonstrates auto-purge behavior when documents are moved to inaccessible channe
98111
$ cargo run --features=enterprise --example ticket_70596
99112
```
100113

101-
#### `tombstone_purge_test_short`
102-
Tests tombstone purge with a short interval (~5 minutes). Useful for quick validation of the test logic, though CBS may not actually purge tombstones below the 1-hour minimum.
103-
104-
**Runtime: ~10 minutes**
105-
106-
```shell
107-
$ cargo run --features=enterprise --example tombstone_purge_test_short
108-
```
109-
110114
#### `tombstone_purge_test`
111115
Complete tombstone purge test following Couchbase support recommendations (Thomas). Tests whether tombstones can be completely purged from CBS and SGW after the minimum 1-hour interval, such that re-creating a document with the same ID is treated as a new document.
112116

@@ -137,52 +141,6 @@ $ cargo run --features=enterprise --example tombstone_purge_test
137141

138142
**Report location**: `test_results/test_run_<timestamp>_<commit_sha>/`
139143

140-
#### `tombstone_resurrection_test`
141-
Complete test for BC-994 scenario: validates soft_delete behavior when documents resurrect after central tombstone expiry.
142-
143-
**Runtime: ~75-80 minutes** (+ ~5 minutes for Docker rebuild)
144-
**Features**: Automatic Docker management, structured reporting, BC-994 logic validation
145-
146-
```shell
147-
$ cargo run --features=enterprise --example tombstone_resurrection_test
148-
```
149-
150-
**What it tests:**
151-
- ✅ Document deletion in central only (remains in cblite)
152-
- ✅ Central tombstone purge after 1 hour
153-
- ✅ Document resurrection via replication reset checkpoint
154-
- ✅ Sync function soft_delete routing (updatedAt > 1h → soft_deleted channel)
155-
- ✅ Auto-purge from cblite (document removed from accessible channels)
156-
- ✅ TTL-based purge from central (5 minutes for testing)
157-
158-
**Test scenario:**
159-
1. Create doc with updatedAt=NOW, replicate to central, STOP replication
160-
2. Delete doc from central only (cblite keeps it)
161-
3. Wait 65 minutes for tombstone purge + compact CBS + SGW
162-
4. Verify central tombstone purged
163-
5. Restart replication with reset checkpoint → doc resurrects (NO modification to doc)
164-
6. Verify sync function routes to "soft_deleted" channel
165-
7. Verify auto-purge removes doc from cblite
166-
8. Wait 6 minutes for TTL expiry + compact
167-
9. Verify doc purged from central
168-
169-
**Note**: The document is NOT modified before resurrection. The reset checkpoint
170-
alone should cause cblite to re-push the document to central where it will be
171-
detected as a resurrection by the sync function (no oldDoc + updatedAt > 1h).
172-
173-
**Report location**: `test_results/test_run_<timestamp>_<commit_sha>/`
174-
175-
**Sync function logic tested** (from billeo-engine PR #7672):
176-
```javascript
177-
if (!oldDoc && doc.updatedAt) {
178-
if (updatedAt < now - 1hour) { // Adapted for testing
179-
channel("soft_deleted");
180-
expiry(5 * 60); // 5 minutes for testing
181-
return;
182-
}
183-
}
184-
```
185-
186144
### Utility functions
187145

188146
There are utility functions available in `examples/utils/` to interact with the Sync Gateway and Couchbase Server:

examples/test_with_reporting.rs

Lines changed: 0 additions & 163 deletions
This file was deleted.

0 commit comments

Comments
 (0)