The comments in http://wiki.apache.org/couchdb/Purge_Documents seem to indicate that rotating the databases is probably a better option.
The DB name is static in json_cdr, but there can be many of them (not sure how that gets done in XML, can we repeat the same param multiple times?).
Order of operations with two databases would look like this:
The cleanup process is ran on both A and B.
Block access to A (CDRs are written on disk)
Create B (Can't do that before, or we'll get duplicate CDRs)
Start continuous replication of B
...
Though a simpler option (with the same limitations) is to block access to A, finish replication (mark all records deleted by calling the cleanup process at that time), once all are deleted remove the database, then re-create it, and let the swiper process finish the inserts.
(With two databases, one of which is almost never present, we'll waste a lot of FreeSwitch resources.)
Another option would be to use a Node.js proxy (which would also allow to replace the _id with some unique value based on timestamp, calling/called number, microsecond duration), but that doesn't necessarily make it more robust. (?)
The comments in http://wiki.apache.org/couchdb/Purge_Documents seem to indicate that rotating the databases is probably a better option. The DB name is static in json_cdr, but there can be many of them (not sure how that gets done in XML, can we repeat the same param multiple times?).
Order of operations with two databases would look like this:
Another option would be to use a Node.js proxy (which would also allow to replace the
_id
with some unique value based on timestamp, calling/called number, microsecond duration), but that doesn't necessarily make it more robust. (?)