greenais opened a new issue #2999:
URL: https://github.com/apache/couchdb/issues/2999
## Description
after upgrade to 3.1.0 from some point Couchdb has stopped replicate _one_
document from local DB to another local DB.
In 2.2 following code worked just fine, with no issues:
```
const commonOptions = {
protocol: 'http:',
hostname: CONFIG.CDB.HOSTNAME,
port: CONFIG.CDB.PORT,
auth: CONFIG.CDB.ADMIN + ':' + CONFIG.CDB.ADMINPASS,
headers: {
'Content-Type': 'application/json',
}
};
const postOptions = Object.assign({}, commonOptions);
postOptions.method = 'POST';
postOptions.timeout = CONFIG.CDB.PUTTIMEOUT;
CDB.replicateDoc = (sourceDB, targetDB, docID)=> {
return new Promise((resolve, reject)=> {
let payload = postOptions;
payload.path = '/_replicate';
let doc = {};
doc.source = sourceDB;
doc.target = targetDB;
doc.doc_ids = [docID];
let req = http.request(payload, (res) => {
let data = '';
res.setEncoding('utf8');
res.on('data', (chunk)=> {data += chunk})
res.on('end', ()=> {
if (res.statusCode === 200) {
return resolve('replicateDoc_done')
} else {
return reject('CDB.replicateDoc status' + res.statusCode + ':
' + data)
}
})
});
req.on('error', (err)=> {return reject('CDB.replicateDoc ERR: ' +
err)})
req.write(JSON.stringify(doc));
req.end();
})
};
```
Now I've got no errors, status 200 (in CDB logs as well), but in fact
replicated doc doesn't appear in target DB.
Looks like it has started to happen since doc with same _id was previously
deleted form target DB.
I'm out of ideas what to check additionally, it's production DB already(
Any help would be greatly appreciated.
## Expected Behaviour
Doc is really replicated
## Your Environment
{"couchdb":"Welcome","version":"3.1.0","git_sha":"ff0feea20","uuid":"6fd6fcaf95854eb6db4a7afa44b0454a","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The
Apache Software Foundation"}}
OS; Debian 10 (64)/Windows 8.1 (64)
Node v12.16.3
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]