You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Michael Bykov <m....@gmail.com> on 2012/08/05 19:47:17 UTC

I replicate _replicator by chance

Hi,

I by chance replicate "_replicator" to a destination database. More
exactly, I click "replicate" button, but nothing happens.

But now, when I replicate my local db, it wrote in a log on each document:

[error] [<0.28457.5>] Replicator: couldn't write document
`4fc8269be10198e2bfa2a137fe1a9333`, revision
`1-4a8baba0dd74f92ec0da91e8fff84774`, to target database
`http://admin:*****@localhost:5986/diglossa/`. Error: `forbidden`,
reason: `The `source' property must exist and be either a string or an
object.`

And in Futon:

{"session_id":"d7c097b8d822f707725b1b79b5bc3bc8","start_time":"Sun, 05
Aug 2012 17:34:34 GMT","end_time":"Sun, 05 Aug 2012 17:34:42
GMT","start_last_seq":262336,"end_last_seq":262672,"recorded_seq":262672,"missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}

I compact and cleanup both databases, it did not help.

Please, suggest, what can be done?



-- 
М.

http://diglossa.ru
xmpp://m.bykov@jabber.ru

Re: I replicate _replicator by chance

Posted by Michael Bykov <m....@gmail.com>.
2012/8/6 Benoit Chesneau <bc...@gmail.com>:
> On Mon, Aug 6, 2012 at 11:55 AM, Michael Bykov <m....@gmail.com> wrote:
>> 2012/8/6 Benoit Chesneau <bc...@gmail.com>:
>>> On Mon, Aug 6, 2012 at 11:35 AM, Michael Bykov <m....@gmail.com> wrote:
>>>> 2012/8/6 Benoit Chesneau <bc...@gmail.com>:
>>>>> did you replicate the _replicator db as an admin ?
>>>>
>>>> Hi Benoit,
>>>>
>>>> Yes.
>>>>
>>>> M.
>>>>
>>>
>>> I mean in the replicator document which auth are you giving? Can you
>>> paste your replicator doc here?
>>>
>>> - benoît
>>
>> Here it is -
>>
>
> This is not the replication task document :)
>>
>>     function(newDoc, oldDoc, userCtx) {
>>         function reportError(error_msg) {
>>             log('Error writing document `' + newDoc._id +
>>                 '\' to the replicator database: ' + error_msg);
>>             throw({forbidden: error_msg});
>>         }
>>
>>         function validateEndpoint(endpoint, fieldName) {
>>             if ((typeof endpoint !== 'string') &&
>>                 ((typeof endpoint !== 'object') || (endpoint === null))) {
>>
>>                 reportError('The `' + fieldName + '\' property must exist' +
>>                     ' and be either a string or an object.');
>>             }
>>
>>             if (typeof endpoint === 'object') {
>>                 if ((typeof endpoint.url !== 'string') || !endpoint.url) {
>>                     reportError('The url property must exist in the `' +
>>                         fieldName + '\' field and must be a non-empty string.');
>>                 }
>>
>>                 if ((typeof endpoint.auth !== 'undefined') &&
>>                     ((typeof endpoint.auth !== 'object') ||
>>                         endpoint.auth === null)) {
>>
>>                     reportError('`' + fieldName +
>>                         '.auth\' must be a non-null object.');
>>                 }
>>
>>                 if ((typeof endpoint.headers !== 'undefined') &&
>>                     ((typeof endpoint.headers !== 'object') ||
>>                         endpoint.headers === null)) {
>>
>>                     reportError('`' + fieldName +
>>                         '.headers\' must be a non-null object.');
>>                 }
>>             }
>>         }
>>
>>         var isReplicator = (userCtx.roles.indexOf('_replicator') >= 0);
>>         var isAdmin = (userCtx.roles.indexOf('_admin') >= 0);
>>
>>         if (oldDoc && !newDoc._deleted && !isReplicator &&
>>             (oldDoc._replication_state === 'triggered')) {
>>             reportError('Only the replicator can edit replication documents ' +
>>                 'that are in the triggered state.');
>>         }
>>
>>         if (!newDoc._deleted) {
>>             validateEndpoint(newDoc.source, 'source');
>>             validateEndpoint(newDoc.target, 'target');
>>
>>             if ((typeof newDoc.create_target !== 'undefined') &&
>>                 (typeof newDoc.create_target !== 'boolean')) {
>>
>>                 reportError('The `create_target\' field must be a boolean.');
>>             }
>>
>>             if ((typeof newDoc.continuous !== 'undefined') &&
>>                 (typeof newDoc.continuous !== 'boolean')) {
>>
>>                 reportError('The `continuous\' field must be a boolean.');
>>             }
>>
>>             if ((typeof newDoc.doc_ids !== 'undefined') &&
>>                 !isArray(newDoc.doc_ids)) {
>>
>>                 reportError('The `doc_ids\' field must be an array of
>> strings.');
>>             }
>>
>>             if ((typeof newDoc.filter !== 'undefined') &&
>>                 ((typeof newDoc.filter !== 'string') || !newDoc.filter)) {
>>
>>                 reportError('The `filter\' field must be a non-empty string.');
>>             }
>>
>>             if ((typeof newDoc.query_params !== 'undefined') &&
>>                 ((typeof newDoc.query_params !== 'object') ||
>>                     newDoc.query_params === null)) {
>>
>>                 reportError('The `query_params\' field must be an object.');
>>             }
>>
>>             if (newDoc.user_ctx) {
>>                 var user_ctx = newDoc.user_ctx;
>>
>>                 if ((typeof user_ctx !== 'object') || (user_ctx === null)) {
>>                     reportError('The `user_ctx\' property must be a ' +
>>                         'non-null object.');
>>                 }
>>
>>                 if (!(user_ctx.name === null ||
>>                     (typeof user_ctx.name === 'undefined') ||
>>                     ((typeof user_ctx.name === 'string') &&
>>                         user_ctx.name.length > 0))) {
>>
>>                     reportError('The `user_ctx.name\' property must be a ' +
>>                         'non-empty string or null.');
>>                 }
>>
>>                 if (!isAdmin && (user_ctx.name !== userCtx.name)) {
>>                     reportError('The given `user_ctx.name\' is not valid');
>>                 }
>>
>>                 if (user_ctx.roles && !isArray(user_ctx.roles)) {
>>                     reportError('The `user_ctx.roles\' property must be ' +
>>                         'an array of strings.');
>>                 }
>>
>>                 if (!isAdmin && user_ctx.roles) {
>>                     for (var i = 0; i < user_ctx.roles.length; i++) {
>>                         var role = user_ctx.roles[i];
>>
>>                         if (typeof role !== 'string' || role.length === 0) {
>>                             reportError('Roles must be non-empty strings.');
>>                         }
>>                         if (userCtx.roles.indexOf(role) === -1) {
>>                             reportError('Invalid role (`' + role +
>>                                 '\') in the `user_ctx\'');
>>                         }
>>                     }
>>                 }
>>             } else {
>>                 if (!isAdmin) {
>>                     reportError('The `user_ctx\' property is missing (it is ' +
>>                        'optional for admins only).');
>>                 }
>>             }
>>         } else {
>>             if (!isAdmin) {
>>                 if (!oldDoc.user_ctx || (oldDoc.user_ctx.name !==
>> userCtx.name)) {
>>                     reportError('Replication documents can only be
>> deleted by ' +
>>                         'admins or by the users who created them.');
>>                 }
>>             }
>>         }
>>     }
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>>>
>>>>
>>>>>
>>>>> On Mon, Aug 6, 2012 at 1:46 AM, Michael Bykov <m....@gmail.com> wrote:
>>>>>> 2012/8/5 Dave Cottlehuber <da...@muse.net.nz>:
>>>>>>> On 5 August 2012 19:47, Michael Bykov <m....@gmail.com> wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I by chance replicate "_replicator" to a destination database. More
>>>>>>>> exactly, I click "replicate" button, but nothing happens.
>>>>>>>>
>>>>>>>> But now, when I replicate my local db, it wrote in a log on each document:
>>>>>>>>
>>>>>>>> [error] [<0.28457.5>] Replicator: couldn't write document
>>>>>>>> `4fc8269be10198e2bfa2a137fe1a9333`, revision
>>>>>>>> `1-4a8baba0dd74f92ec0da91e8fff84774`, to target database
>>>>>>>> `http://admin:*****@localhost:5986/diglossa/`. Error: `forbidden`,
>>>>>>>> reason: `The `source' property must exist and be either a string or an
>>>>>>>> object.`
>>>>>>>>
>>>>>>>> And in Futon:
>>>>>>>>
>>>>>>>> {"session_id":"d7c097b8d822f707725b1b79b5bc3bc8","start_time":"Sun, 05
>>>>>>>> Aug 2012 17:34:34 GMT","end_time":"Sun, 05 Aug 2012 17:34:42
>>>>>>>> GMT","start_last_seq":262336,"end_last_seq":262672,"recorded_seq":262672,"missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>>>>>>>
>>>>>>>> I compact and cleanup both databases, it did not help.
>>>>>>>>
>>>>>>>> Please, suggest, what can be done?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> М.
>>>>>>>>
>>>>>>>> http://diglossa.ru
>>>>>>>> xmpp://m.bykov@jabber.ru
>>>>>>>
>>>>>>> Hi Michael,
>>>>>>>
>>>>>>> The thing stopping writing your docs is a validation function (clue
>>>>>>> "`The `source' property must exist and be either a string or an
>>>>>>> object" is not in the couch source tree). I'm guessing a little but I
>>>>>>> think your _replicator db at one end now has "normal" design docs in
>>>>>>> it.
>>>>>>>
>>>>>>> What I'd do now is:
>>>>>>>
>>>>>>> 1. rename the _replicator.couch db file at the problem end to something else.
>>>>>>> 2. restart couchdb (get a new, clean _replicator)
>>>>>>> 3. if you need to, log into futon as admin and delete all ddocs in the
>>>>>>> renamed, foobared _replicator and rename it back. You'll likely only
>>>>>>> need this if you have continuous replications, or ones that should be
>>>>>>> present on a restart of couchdb.
>>>>>>> 4. any more cleanup as reqd by your application.
>>>>>>>
>>>>>>> I think that's enough to get you started.
>>>>>>>
>>>>>>> A+
>>>>>>> Dave
>>>>>>
>>>>>>
>>>>>> Hi Dave, thank you!
>>>>>>
>>>>>> yes, _replicator.couch files had different sizes, 4.1 kb on local end
>>>>>> and 8.2 on remote.
>>>>>>
>>>>>> I removed both _replicator.couch and restart both couchdb. but alas,
>>>>>> it did not help.
>>>>>>
>>>>>> in logs on my side (each document)
>>>>>>
>>>>>> [error] [<0.3848.0>] Replicator: couldn't write document xxx to target database
>>>>>>
>>>>>> but on remote side
>>>>>>
>>>>>> [info] [<0.253.0>] OS Process #Port<0.3042> Log :: Error writing
>>>>>> document `1a1f377aaa9a5f0125b2344c20087eb7' to the replicator
>>>>>> database: The `source' property must exist and be either a string or
>>>>>> an object.
>>>>>>
>>>>>> Why it write 'replicator database'?
>>>>>>
>>>>>> By the way, remote end had a lot of strange for this place files and
>>>>>> directories, for example .bashrc, .ssh, .bash_logout. .emacs.d/
>>>>>>
>>>>>> I have deleted all of them, and restart it again. Now it has the same
>>>>>> files as my local end.
>>>>>>
>>>>>> Permissions are correct, as far as I can see.
>>>>>>
>>>>>> I have deleted my new docs from local db, replication goes ok, in Futon
>>>>>>
>>>>>> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":280,"doc_write_failures":0}
>>>>>>
>>>>>> and then I have created this docs again and had again
>>>>>>
>>>>>> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> М.
>>>>>>
>>>>>> http://diglossa.ru
>>>>>> xmpp://m.bykov@jabber.ru
>>>>
>>>>
>>>>
>>>> --
>>>> М.
>>>>
>>>> http://diglossa.ru
>>>> xmpp://m.bykov@jabber.ru
>>
>>
>>
>> --
>> М.
>>
>> http://diglossa.ru
>> xmpp://m.bykov@jabber.ru


Yes, it is validate_doc_updat function.

So I am afraid I have no replication task document at all.

What I have in _replicator (created from scratch just now) is only:

_id	_design/_replicator
_rev	1-5bfa2c99eefe2b2eb4962db50aa3cfd4
language	javascript
validate_doc_update	function(newDoc, oldDoc, userCtx) { function
reportError(error_msg) { log('Error writing document `' + newDoc._id +
...

And absolutly the same I have on remote end.

I did not create some persistent replication tasks by hand, I just
remove _replicator.couch and restart couchdb.

Sorry, it is obviously I am missing something important, but what?


-- 
М.

http://diglossa.ru
xmpp://m.bykov@jabber.ru

Re: I replicate _replicator by chance

Posted by Benoit Chesneau <bc...@gmail.com>.
On Mon, Aug 6, 2012 at 11:55 AM, Michael Bykov <m....@gmail.com> wrote:
> 2012/8/6 Benoit Chesneau <bc...@gmail.com>:
>> On Mon, Aug 6, 2012 at 11:35 AM, Michael Bykov <m....@gmail.com> wrote:
>>> 2012/8/6 Benoit Chesneau <bc...@gmail.com>:
>>>> did you replicate the _replicator db as an admin ?
>>>
>>> Hi Benoit,
>>>
>>> Yes.
>>>
>>> M.
>>>
>>
>> I mean in the replicator document which auth are you giving? Can you
>> paste your replicator doc here?
>>
>> - benoît
>
> Here it is -
>

This is not the replication task document :)
>
>     function(newDoc, oldDoc, userCtx) {
>         function reportError(error_msg) {
>             log('Error writing document `' + newDoc._id +
>                 '\' to the replicator database: ' + error_msg);
>             throw({forbidden: error_msg});
>         }
>
>         function validateEndpoint(endpoint, fieldName) {
>             if ((typeof endpoint !== 'string') &&
>                 ((typeof endpoint !== 'object') || (endpoint === null))) {
>
>                 reportError('The `' + fieldName + '\' property must exist' +
>                     ' and be either a string or an object.');
>             }
>
>             if (typeof endpoint === 'object') {
>                 if ((typeof endpoint.url !== 'string') || !endpoint.url) {
>                     reportError('The url property must exist in the `' +
>                         fieldName + '\' field and must be a non-empty string.');
>                 }
>
>                 if ((typeof endpoint.auth !== 'undefined') &&
>                     ((typeof endpoint.auth !== 'object') ||
>                         endpoint.auth === null)) {
>
>                     reportError('`' + fieldName +
>                         '.auth\' must be a non-null object.');
>                 }
>
>                 if ((typeof endpoint.headers !== 'undefined') &&
>                     ((typeof endpoint.headers !== 'object') ||
>                         endpoint.headers === null)) {
>
>                     reportError('`' + fieldName +
>                         '.headers\' must be a non-null object.');
>                 }
>             }
>         }
>
>         var isReplicator = (userCtx.roles.indexOf('_replicator') >= 0);
>         var isAdmin = (userCtx.roles.indexOf('_admin') >= 0);
>
>         if (oldDoc && !newDoc._deleted && !isReplicator &&
>             (oldDoc._replication_state === 'triggered')) {
>             reportError('Only the replicator can edit replication documents ' +
>                 'that are in the triggered state.');
>         }
>
>         if (!newDoc._deleted) {
>             validateEndpoint(newDoc.source, 'source');
>             validateEndpoint(newDoc.target, 'target');
>
>             if ((typeof newDoc.create_target !== 'undefined') &&
>                 (typeof newDoc.create_target !== 'boolean')) {
>
>                 reportError('The `create_target\' field must be a boolean.');
>             }
>
>             if ((typeof newDoc.continuous !== 'undefined') &&
>                 (typeof newDoc.continuous !== 'boolean')) {
>
>                 reportError('The `continuous\' field must be a boolean.');
>             }
>
>             if ((typeof newDoc.doc_ids !== 'undefined') &&
>                 !isArray(newDoc.doc_ids)) {
>
>                 reportError('The `doc_ids\' field must be an array of
> strings.');
>             }
>
>             if ((typeof newDoc.filter !== 'undefined') &&
>                 ((typeof newDoc.filter !== 'string') || !newDoc.filter)) {
>
>                 reportError('The `filter\' field must be a non-empty string.');
>             }
>
>             if ((typeof newDoc.query_params !== 'undefined') &&
>                 ((typeof newDoc.query_params !== 'object') ||
>                     newDoc.query_params === null)) {
>
>                 reportError('The `query_params\' field must be an object.');
>             }
>
>             if (newDoc.user_ctx) {
>                 var user_ctx = newDoc.user_ctx;
>
>                 if ((typeof user_ctx !== 'object') || (user_ctx === null)) {
>                     reportError('The `user_ctx\' property must be a ' +
>                         'non-null object.');
>                 }
>
>                 if (!(user_ctx.name === null ||
>                     (typeof user_ctx.name === 'undefined') ||
>                     ((typeof user_ctx.name === 'string') &&
>                         user_ctx.name.length > 0))) {
>
>                     reportError('The `user_ctx.name\' property must be a ' +
>                         'non-empty string or null.');
>                 }
>
>                 if (!isAdmin && (user_ctx.name !== userCtx.name)) {
>                     reportError('The given `user_ctx.name\' is not valid');
>                 }
>
>                 if (user_ctx.roles && !isArray(user_ctx.roles)) {
>                     reportError('The `user_ctx.roles\' property must be ' +
>                         'an array of strings.');
>                 }
>
>                 if (!isAdmin && user_ctx.roles) {
>                     for (var i = 0; i < user_ctx.roles.length; i++) {
>                         var role = user_ctx.roles[i];
>
>                         if (typeof role !== 'string' || role.length === 0) {
>                             reportError('Roles must be non-empty strings.');
>                         }
>                         if (userCtx.roles.indexOf(role) === -1) {
>                             reportError('Invalid role (`' + role +
>                                 '\') in the `user_ctx\'');
>                         }
>                     }
>                 }
>             } else {
>                 if (!isAdmin) {
>                     reportError('The `user_ctx\' property is missing (it is ' +
>                        'optional for admins only).');
>                 }
>             }
>         } else {
>             if (!isAdmin) {
>                 if (!oldDoc.user_ctx || (oldDoc.user_ctx.name !==
> userCtx.name)) {
>                     reportError('Replication documents can only be
> deleted by ' +
>                         'admins or by the users who created them.');
>                 }
>             }
>         }
>     }
>
>
>
>
>
>
>
>
>
>>>
>>>
>>>>
>>>> On Mon, Aug 6, 2012 at 1:46 AM, Michael Bykov <m....@gmail.com> wrote:
>>>>> 2012/8/5 Dave Cottlehuber <da...@muse.net.nz>:
>>>>>> On 5 August 2012 19:47, Michael Bykov <m....@gmail.com> wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I by chance replicate "_replicator" to a destination database. More
>>>>>>> exactly, I click "replicate" button, but nothing happens.
>>>>>>>
>>>>>>> But now, when I replicate my local db, it wrote in a log on each document:
>>>>>>>
>>>>>>> [error] [<0.28457.5>] Replicator: couldn't write document
>>>>>>> `4fc8269be10198e2bfa2a137fe1a9333`, revision
>>>>>>> `1-4a8baba0dd74f92ec0da91e8fff84774`, to target database
>>>>>>> `http://admin:*****@localhost:5986/diglossa/`. Error: `forbidden`,
>>>>>>> reason: `The `source' property must exist and be either a string or an
>>>>>>> object.`
>>>>>>>
>>>>>>> And in Futon:
>>>>>>>
>>>>>>> {"session_id":"d7c097b8d822f707725b1b79b5bc3bc8","start_time":"Sun, 05
>>>>>>> Aug 2012 17:34:34 GMT","end_time":"Sun, 05 Aug 2012 17:34:42
>>>>>>> GMT","start_last_seq":262336,"end_last_seq":262672,"recorded_seq":262672,"missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>>>>>>
>>>>>>> I compact and cleanup both databases, it did not help.
>>>>>>>
>>>>>>> Please, suggest, what can be done?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> М.
>>>>>>>
>>>>>>> http://diglossa.ru
>>>>>>> xmpp://m.bykov@jabber.ru
>>>>>>
>>>>>> Hi Michael,
>>>>>>
>>>>>> The thing stopping writing your docs is a validation function (clue
>>>>>> "`The `source' property must exist and be either a string or an
>>>>>> object" is not in the couch source tree). I'm guessing a little but I
>>>>>> think your _replicator db at one end now has "normal" design docs in
>>>>>> it.
>>>>>>
>>>>>> What I'd do now is:
>>>>>>
>>>>>> 1. rename the _replicator.couch db file at the problem end to something else.
>>>>>> 2. restart couchdb (get a new, clean _replicator)
>>>>>> 3. if you need to, log into futon as admin and delete all ddocs in the
>>>>>> renamed, foobared _replicator and rename it back. You'll likely only
>>>>>> need this if you have continuous replications, or ones that should be
>>>>>> present on a restart of couchdb.
>>>>>> 4. any more cleanup as reqd by your application.
>>>>>>
>>>>>> I think that's enough to get you started.
>>>>>>
>>>>>> A+
>>>>>> Dave
>>>>>
>>>>>
>>>>> Hi Dave, thank you!
>>>>>
>>>>> yes, _replicator.couch files had different sizes, 4.1 kb on local end
>>>>> and 8.2 on remote.
>>>>>
>>>>> I removed both _replicator.couch and restart both couchdb. but alas,
>>>>> it did not help.
>>>>>
>>>>> in logs on my side (each document)
>>>>>
>>>>> [error] [<0.3848.0>] Replicator: couldn't write document xxx to target database
>>>>>
>>>>> but on remote side
>>>>>
>>>>> [info] [<0.253.0>] OS Process #Port<0.3042> Log :: Error writing
>>>>> document `1a1f377aaa9a5f0125b2344c20087eb7' to the replicator
>>>>> database: The `source' property must exist and be either a string or
>>>>> an object.
>>>>>
>>>>> Why it write 'replicator database'?
>>>>>
>>>>> By the way, remote end had a lot of strange for this place files and
>>>>> directories, for example .bashrc, .ssh, .bash_logout. .emacs.d/
>>>>>
>>>>> I have deleted all of them, and restart it again. Now it has the same
>>>>> files as my local end.
>>>>>
>>>>> Permissions are correct, as far as I can see.
>>>>>
>>>>> I have deleted my new docs from local db, replication goes ok, in Futon
>>>>>
>>>>> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":280,"doc_write_failures":0}
>>>>>
>>>>> and then I have created this docs again and had again
>>>>>
>>>>> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> М.
>>>>>
>>>>> http://diglossa.ru
>>>>> xmpp://m.bykov@jabber.ru
>>>
>>>
>>>
>>> --
>>> М.
>>>
>>> http://diglossa.ru
>>> xmpp://m.bykov@jabber.ru
>
>
>
> --
> М.
>
> http://diglossa.ru
> xmpp://m.bykov@jabber.ru

Re: I replicate _replicator by chance

Posted by Michael Bykov <m....@gmail.com>.
2012/8/6 Benoit Chesneau <bc...@gmail.com>:
> On Mon, Aug 6, 2012 at 11:35 AM, Michael Bykov <m....@gmail.com> wrote:
>> 2012/8/6 Benoit Chesneau <bc...@gmail.com>:
>>> did you replicate the _replicator db as an admin ?
>>
>> Hi Benoit,
>>
>> Yes.
>>
>> M.
>>
>
> I mean in the replicator document which auth are you giving? Can you
> paste your replicator doc here?
>
> - benoît

Here it is -


    function(newDoc, oldDoc, userCtx) {
        function reportError(error_msg) {
            log('Error writing document `' + newDoc._id +
                '\' to the replicator database: ' + error_msg);
            throw({forbidden: error_msg});
        }

        function validateEndpoint(endpoint, fieldName) {
            if ((typeof endpoint !== 'string') &&
                ((typeof endpoint !== 'object') || (endpoint === null))) {

                reportError('The `' + fieldName + '\' property must exist' +
                    ' and be either a string or an object.');
            }

            if (typeof endpoint === 'object') {
                if ((typeof endpoint.url !== 'string') || !endpoint.url) {
                    reportError('The url property must exist in the `' +
                        fieldName + '\' field and must be a non-empty string.');
                }

                if ((typeof endpoint.auth !== 'undefined') &&
                    ((typeof endpoint.auth !== 'object') ||
                        endpoint.auth === null)) {

                    reportError('`' + fieldName +
                        '.auth\' must be a non-null object.');
                }

                if ((typeof endpoint.headers !== 'undefined') &&
                    ((typeof endpoint.headers !== 'object') ||
                        endpoint.headers === null)) {

                    reportError('`' + fieldName +
                        '.headers\' must be a non-null object.');
                }
            }
        }

        var isReplicator = (userCtx.roles.indexOf('_replicator') >= 0);
        var isAdmin = (userCtx.roles.indexOf('_admin') >= 0);

        if (oldDoc && !newDoc._deleted && !isReplicator &&
            (oldDoc._replication_state === 'triggered')) {
            reportError('Only the replicator can edit replication documents ' +
                'that are in the triggered state.');
        }

        if (!newDoc._deleted) {
            validateEndpoint(newDoc.source, 'source');
            validateEndpoint(newDoc.target, 'target');

            if ((typeof newDoc.create_target !== 'undefined') &&
                (typeof newDoc.create_target !== 'boolean')) {

                reportError('The `create_target\' field must be a boolean.');
            }

            if ((typeof newDoc.continuous !== 'undefined') &&
                (typeof newDoc.continuous !== 'boolean')) {

                reportError('The `continuous\' field must be a boolean.');
            }

            if ((typeof newDoc.doc_ids !== 'undefined') &&
                !isArray(newDoc.doc_ids)) {

                reportError('The `doc_ids\' field must be an array of
strings.');
            }

            if ((typeof newDoc.filter !== 'undefined') &&
                ((typeof newDoc.filter !== 'string') || !newDoc.filter)) {

                reportError('The `filter\' field must be a non-empty string.');
            }

            if ((typeof newDoc.query_params !== 'undefined') &&
                ((typeof newDoc.query_params !== 'object') ||
                    newDoc.query_params === null)) {

                reportError('The `query_params\' field must be an object.');
            }

            if (newDoc.user_ctx) {
                var user_ctx = newDoc.user_ctx;

                if ((typeof user_ctx !== 'object') || (user_ctx === null)) {
                    reportError('The `user_ctx\' property must be a ' +
                        'non-null object.');
                }

                if (!(user_ctx.name === null ||
                    (typeof user_ctx.name === 'undefined') ||
                    ((typeof user_ctx.name === 'string') &&
                        user_ctx.name.length > 0))) {

                    reportError('The `user_ctx.name\' property must be a ' +
                        'non-empty string or null.');
                }

                if (!isAdmin && (user_ctx.name !== userCtx.name)) {
                    reportError('The given `user_ctx.name\' is not valid');
                }

                if (user_ctx.roles && !isArray(user_ctx.roles)) {
                    reportError('The `user_ctx.roles\' property must be ' +
                        'an array of strings.');
                }

                if (!isAdmin && user_ctx.roles) {
                    for (var i = 0; i < user_ctx.roles.length; i++) {
                        var role = user_ctx.roles[i];

                        if (typeof role !== 'string' || role.length === 0) {
                            reportError('Roles must be non-empty strings.');
                        }
                        if (userCtx.roles.indexOf(role) === -1) {
                            reportError('Invalid role (`' + role +
                                '\') in the `user_ctx\'');
                        }
                    }
                }
            } else {
                if (!isAdmin) {
                    reportError('The `user_ctx\' property is missing (it is ' +
                       'optional for admins only).');
                }
            }
        } else {
            if (!isAdmin) {
                if (!oldDoc.user_ctx || (oldDoc.user_ctx.name !==
userCtx.name)) {
                    reportError('Replication documents can only be
deleted by ' +
                        'admins or by the users who created them.');
                }
            }
        }
    }









>>
>>
>>>
>>> On Mon, Aug 6, 2012 at 1:46 AM, Michael Bykov <m....@gmail.com> wrote:
>>>> 2012/8/5 Dave Cottlehuber <da...@muse.net.nz>:
>>>>> On 5 August 2012 19:47, Michael Bykov <m....@gmail.com> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I by chance replicate "_replicator" to a destination database. More
>>>>>> exactly, I click "replicate" button, but nothing happens.
>>>>>>
>>>>>> But now, when I replicate my local db, it wrote in a log on each document:
>>>>>>
>>>>>> [error] [<0.28457.5>] Replicator: couldn't write document
>>>>>> `4fc8269be10198e2bfa2a137fe1a9333`, revision
>>>>>> `1-4a8baba0dd74f92ec0da91e8fff84774`, to target database
>>>>>> `http://admin:*****@localhost:5986/diglossa/`. Error: `forbidden`,
>>>>>> reason: `The `source' property must exist and be either a string or an
>>>>>> object.`
>>>>>>
>>>>>> And in Futon:
>>>>>>
>>>>>> {"session_id":"d7c097b8d822f707725b1b79b5bc3bc8","start_time":"Sun, 05
>>>>>> Aug 2012 17:34:34 GMT","end_time":"Sun, 05 Aug 2012 17:34:42
>>>>>> GMT","start_last_seq":262336,"end_last_seq":262672,"recorded_seq":262672,"missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>>>>>
>>>>>> I compact and cleanup both databases, it did not help.
>>>>>>
>>>>>> Please, suggest, what can be done?
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> М.
>>>>>>
>>>>>> http://diglossa.ru
>>>>>> xmpp://m.bykov@jabber.ru
>>>>>
>>>>> Hi Michael,
>>>>>
>>>>> The thing stopping writing your docs is a validation function (clue
>>>>> "`The `source' property must exist and be either a string or an
>>>>> object" is not in the couch source tree). I'm guessing a little but I
>>>>> think your _replicator db at one end now has "normal" design docs in
>>>>> it.
>>>>>
>>>>> What I'd do now is:
>>>>>
>>>>> 1. rename the _replicator.couch db file at the problem end to something else.
>>>>> 2. restart couchdb (get a new, clean _replicator)
>>>>> 3. if you need to, log into futon as admin and delete all ddocs in the
>>>>> renamed, foobared _replicator and rename it back. You'll likely only
>>>>> need this if you have continuous replications, or ones that should be
>>>>> present on a restart of couchdb.
>>>>> 4. any more cleanup as reqd by your application.
>>>>>
>>>>> I think that's enough to get you started.
>>>>>
>>>>> A+
>>>>> Dave
>>>>
>>>>
>>>> Hi Dave, thank you!
>>>>
>>>> yes, _replicator.couch files had different sizes, 4.1 kb on local end
>>>> and 8.2 on remote.
>>>>
>>>> I removed both _replicator.couch and restart both couchdb. but alas,
>>>> it did not help.
>>>>
>>>> in logs on my side (each document)
>>>>
>>>> [error] [<0.3848.0>] Replicator: couldn't write document xxx to target database
>>>>
>>>> but on remote side
>>>>
>>>> [info] [<0.253.0>] OS Process #Port<0.3042> Log :: Error writing
>>>> document `1a1f377aaa9a5f0125b2344c20087eb7' to the replicator
>>>> database: The `source' property must exist and be either a string or
>>>> an object.
>>>>
>>>> Why it write 'replicator database'?
>>>>
>>>> By the way, remote end had a lot of strange for this place files and
>>>> directories, for example .bashrc, .ssh, .bash_logout. .emacs.d/
>>>>
>>>> I have deleted all of them, and restart it again. Now it has the same
>>>> files as my local end.
>>>>
>>>> Permissions are correct, as far as I can see.
>>>>
>>>> I have deleted my new docs from local db, replication goes ok, in Futon
>>>>
>>>> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":280,"doc_write_failures":0}
>>>>
>>>> and then I have created this docs again and had again
>>>>
>>>> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>>>
>>>>
>>>>
>>>> --
>>>> М.
>>>>
>>>> http://diglossa.ru
>>>> xmpp://m.bykov@jabber.ru
>>
>>
>>
>> --
>> М.
>>
>> http://diglossa.ru
>> xmpp://m.bykov@jabber.ru



-- 
М.

http://diglossa.ru
xmpp://m.bykov@jabber.ru

Re: I replicate _replicator by chance

Posted by Benoit Chesneau <bc...@gmail.com>.
On Mon, Aug 6, 2012 at 11:35 AM, Michael Bykov <m....@gmail.com> wrote:
> 2012/8/6 Benoit Chesneau <bc...@gmail.com>:
>> did you replicate the _replicator db as an admin ?
>
> Hi Benoit,
>
> Yes.
>
> M.
>

I mean in the replicator document which auth are you giving? Can you
paste your replicator doc here?

- benoît
>
>
>>
>> On Mon, Aug 6, 2012 at 1:46 AM, Michael Bykov <m....@gmail.com> wrote:
>>> 2012/8/5 Dave Cottlehuber <da...@muse.net.nz>:
>>>> On 5 August 2012 19:47, Michael Bykov <m....@gmail.com> wrote:
>>>>> Hi,
>>>>>
>>>>> I by chance replicate "_replicator" to a destination database. More
>>>>> exactly, I click "replicate" button, but nothing happens.
>>>>>
>>>>> But now, when I replicate my local db, it wrote in a log on each document:
>>>>>
>>>>> [error] [<0.28457.5>] Replicator: couldn't write document
>>>>> `4fc8269be10198e2bfa2a137fe1a9333`, revision
>>>>> `1-4a8baba0dd74f92ec0da91e8fff84774`, to target database
>>>>> `http://admin:*****@localhost:5986/diglossa/`. Error: `forbidden`,
>>>>> reason: `The `source' property must exist and be either a string or an
>>>>> object.`
>>>>>
>>>>> And in Futon:
>>>>>
>>>>> {"session_id":"d7c097b8d822f707725b1b79b5bc3bc8","start_time":"Sun, 05
>>>>> Aug 2012 17:34:34 GMT","end_time":"Sun, 05 Aug 2012 17:34:42
>>>>> GMT","start_last_seq":262336,"end_last_seq":262672,"recorded_seq":262672,"missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>>>>
>>>>> I compact and cleanup both databases, it did not help.
>>>>>
>>>>> Please, suggest, what can be done?
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> М.
>>>>>
>>>>> http://diglossa.ru
>>>>> xmpp://m.bykov@jabber.ru
>>>>
>>>> Hi Michael,
>>>>
>>>> The thing stopping writing your docs is a validation function (clue
>>>> "`The `source' property must exist and be either a string or an
>>>> object" is not in the couch source tree). I'm guessing a little but I
>>>> think your _replicator db at one end now has "normal" design docs in
>>>> it.
>>>>
>>>> What I'd do now is:
>>>>
>>>> 1. rename the _replicator.couch db file at the problem end to something else.
>>>> 2. restart couchdb (get a new, clean _replicator)
>>>> 3. if you need to, log into futon as admin and delete all ddocs in the
>>>> renamed, foobared _replicator and rename it back. You'll likely only
>>>> need this if you have continuous replications, or ones that should be
>>>> present on a restart of couchdb.
>>>> 4. any more cleanup as reqd by your application.
>>>>
>>>> I think that's enough to get you started.
>>>>
>>>> A+
>>>> Dave
>>>
>>>
>>> Hi Dave, thank you!
>>>
>>> yes, _replicator.couch files had different sizes, 4.1 kb on local end
>>> and 8.2 on remote.
>>>
>>> I removed both _replicator.couch and restart both couchdb. but alas,
>>> it did not help.
>>>
>>> in logs on my side (each document)
>>>
>>> [error] [<0.3848.0>] Replicator: couldn't write document xxx to target database
>>>
>>> but on remote side
>>>
>>> [info] [<0.253.0>] OS Process #Port<0.3042> Log :: Error writing
>>> document `1a1f377aaa9a5f0125b2344c20087eb7' to the replicator
>>> database: The `source' property must exist and be either a string or
>>> an object.
>>>
>>> Why it write 'replicator database'?
>>>
>>> By the way, remote end had a lot of strange for this place files and
>>> directories, for example .bashrc, .ssh, .bash_logout. .emacs.d/
>>>
>>> I have deleted all of them, and restart it again. Now it has the same
>>> files as my local end.
>>>
>>> Permissions are correct, as far as I can see.
>>>
>>> I have deleted my new docs from local db, replication goes ok, in Futon
>>>
>>> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":280,"doc_write_failures":0}
>>>
>>> and then I have created this docs again and had again
>>>
>>> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>>
>>>
>>>
>>> --
>>> М.
>>>
>>> http://diglossa.ru
>>> xmpp://m.bykov@jabber.ru
>
>
>
> --
> М.
>
> http://diglossa.ru
> xmpp://m.bykov@jabber.ru

Re: I replicate _replicator by chance

Posted by Michael Bykov <m....@gmail.com>.
2012/8/6 Benoit Chesneau <bc...@gmail.com>:
> did you replicate the _replicator db as an admin ?

Hi Benoit,

Yes.

M.



>
> On Mon, Aug 6, 2012 at 1:46 AM, Michael Bykov <m....@gmail.com> wrote:
>> 2012/8/5 Dave Cottlehuber <da...@muse.net.nz>:
>>> On 5 August 2012 19:47, Michael Bykov <m....@gmail.com> wrote:
>>>> Hi,
>>>>
>>>> I by chance replicate "_replicator" to a destination database. More
>>>> exactly, I click "replicate" button, but nothing happens.
>>>>
>>>> But now, when I replicate my local db, it wrote in a log on each document:
>>>>
>>>> [error] [<0.28457.5>] Replicator: couldn't write document
>>>> `4fc8269be10198e2bfa2a137fe1a9333`, revision
>>>> `1-4a8baba0dd74f92ec0da91e8fff84774`, to target database
>>>> `http://admin:*****@localhost:5986/diglossa/`. Error: `forbidden`,
>>>> reason: `The `source' property must exist and be either a string or an
>>>> object.`
>>>>
>>>> And in Futon:
>>>>
>>>> {"session_id":"d7c097b8d822f707725b1b79b5bc3bc8","start_time":"Sun, 05
>>>> Aug 2012 17:34:34 GMT","end_time":"Sun, 05 Aug 2012 17:34:42
>>>> GMT","start_last_seq":262336,"end_last_seq":262672,"recorded_seq":262672,"missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>>>
>>>> I compact and cleanup both databases, it did not help.
>>>>
>>>> Please, suggest, what can be done?
>>>>
>>>>
>>>>
>>>> --
>>>> М.
>>>>
>>>> http://diglossa.ru
>>>> xmpp://m.bykov@jabber.ru
>>>
>>> Hi Michael,
>>>
>>> The thing stopping writing your docs is a validation function (clue
>>> "`The `source' property must exist and be either a string or an
>>> object" is not in the couch source tree). I'm guessing a little but I
>>> think your _replicator db at one end now has "normal" design docs in
>>> it.
>>>
>>> What I'd do now is:
>>>
>>> 1. rename the _replicator.couch db file at the problem end to something else.
>>> 2. restart couchdb (get a new, clean _replicator)
>>> 3. if you need to, log into futon as admin and delete all ddocs in the
>>> renamed, foobared _replicator and rename it back. You'll likely only
>>> need this if you have continuous replications, or ones that should be
>>> present on a restart of couchdb.
>>> 4. any more cleanup as reqd by your application.
>>>
>>> I think that's enough to get you started.
>>>
>>> A+
>>> Dave
>>
>>
>> Hi Dave, thank you!
>>
>> yes, _replicator.couch files had different sizes, 4.1 kb on local end
>> and 8.2 on remote.
>>
>> I removed both _replicator.couch and restart both couchdb. but alas,
>> it did not help.
>>
>> in logs on my side (each document)
>>
>> [error] [<0.3848.0>] Replicator: couldn't write document xxx to target database
>>
>> but on remote side
>>
>> [info] [<0.253.0>] OS Process #Port<0.3042> Log :: Error writing
>> document `1a1f377aaa9a5f0125b2344c20087eb7' to the replicator
>> database: The `source' property must exist and be either a string or
>> an object.
>>
>> Why it write 'replicator database'?
>>
>> By the way, remote end had a lot of strange for this place files and
>> directories, for example .bashrc, .ssh, .bash_logout. .emacs.d/
>>
>> I have deleted all of them, and restart it again. Now it has the same
>> files as my local end.
>>
>> Permissions are correct, as far as I can see.
>>
>> I have deleted my new docs from local db, replication goes ok, in Futon
>>
>> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":280,"doc_write_failures":0}
>>
>> and then I have created this docs again and had again
>>
>> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>
>>
>>
>> --
>> М.
>>
>> http://diglossa.ru
>> xmpp://m.bykov@jabber.ru



-- 
М.

http://diglossa.ru
xmpp://m.bykov@jabber.ru

Re: I replicate _replicator by chance

Posted by Benoit Chesneau <bc...@gmail.com>.
did you replicate the _replicator db as an admin ?

On Mon, Aug 6, 2012 at 1:46 AM, Michael Bykov <m....@gmail.com> wrote:
> 2012/8/5 Dave Cottlehuber <da...@muse.net.nz>:
>> On 5 August 2012 19:47, Michael Bykov <m....@gmail.com> wrote:
>>> Hi,
>>>
>>> I by chance replicate "_replicator" to a destination database. More
>>> exactly, I click "replicate" button, but nothing happens.
>>>
>>> But now, when I replicate my local db, it wrote in a log on each document:
>>>
>>> [error] [<0.28457.5>] Replicator: couldn't write document
>>> `4fc8269be10198e2bfa2a137fe1a9333`, revision
>>> `1-4a8baba0dd74f92ec0da91e8fff84774`, to target database
>>> `http://admin:*****@localhost:5986/diglossa/`. Error: `forbidden`,
>>> reason: `The `source' property must exist and be either a string or an
>>> object.`
>>>
>>> And in Futon:
>>>
>>> {"session_id":"d7c097b8d822f707725b1b79b5bc3bc8","start_time":"Sun, 05
>>> Aug 2012 17:34:34 GMT","end_time":"Sun, 05 Aug 2012 17:34:42
>>> GMT","start_last_seq":262336,"end_last_seq":262672,"recorded_seq":262672,"missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>>
>>> I compact and cleanup both databases, it did not help.
>>>
>>> Please, suggest, what can be done?
>>>
>>>
>>>
>>> --
>>> М.
>>>
>>> http://diglossa.ru
>>> xmpp://m.bykov@jabber.ru
>>
>> Hi Michael,
>>
>> The thing stopping writing your docs is a validation function (clue
>> "`The `source' property must exist and be either a string or an
>> object" is not in the couch source tree). I'm guessing a little but I
>> think your _replicator db at one end now has "normal" design docs in
>> it.
>>
>> What I'd do now is:
>>
>> 1. rename the _replicator.couch db file at the problem end to something else.
>> 2. restart couchdb (get a new, clean _replicator)
>> 3. if you need to, log into futon as admin and delete all ddocs in the
>> renamed, foobared _replicator and rename it back. You'll likely only
>> need this if you have continuous replications, or ones that should be
>> present on a restart of couchdb.
>> 4. any more cleanup as reqd by your application.
>>
>> I think that's enough to get you started.
>>
>> A+
>> Dave
>
>
> Hi Dave, thank you!
>
> yes, _replicator.couch files had different sizes, 4.1 kb on local end
> and 8.2 on remote.
>
> I removed both _replicator.couch and restart both couchdb. but alas,
> it did not help.
>
> in logs on my side (each document)
>
> [error] [<0.3848.0>] Replicator: couldn't write document xxx to target database
>
> but on remote side
>
> [info] [<0.253.0>] OS Process #Port<0.3042> Log :: Error writing
> document `1a1f377aaa9a5f0125b2344c20087eb7' to the replicator
> database: The `source' property must exist and be either a string or
> an object.
>
> Why it write 'replicator database'?
>
> By the way, remote end had a lot of strange for this place files and
> directories, for example .bashrc, .ssh, .bash_logout. .emacs.d/
>
> I have deleted all of them, and restart it again. Now it has the same
> files as my local end.
>
> Permissions are correct, as far as I can see.
>
> I have deleted my new docs from local db, replication goes ok, in Futon
>
> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":280,"doc_write_failures":0}
>
> and then I have created this docs again and had again
>
> "missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>
>
>
> --
> М.
>
> http://diglossa.ru
> xmpp://m.bykov@jabber.ru

Re: I replicate _replicator by chance

Posted by Michael Bykov <m....@gmail.com>.
2012/8/5 Dave Cottlehuber <da...@muse.net.nz>:
> On 5 August 2012 19:47, Michael Bykov <m....@gmail.com> wrote:
>> Hi,
>>
>> I by chance replicate "_replicator" to a destination database. More
>> exactly, I click "replicate" button, but nothing happens.
>>
>> But now, when I replicate my local db, it wrote in a log on each document:
>>
>> [error] [<0.28457.5>] Replicator: couldn't write document
>> `4fc8269be10198e2bfa2a137fe1a9333`, revision
>> `1-4a8baba0dd74f92ec0da91e8fff84774`, to target database
>> `http://admin:*****@localhost:5986/diglossa/`. Error: `forbidden`,
>> reason: `The `source' property must exist and be either a string or an
>> object.`
>>
>> And in Futon:
>>
>> {"session_id":"d7c097b8d822f707725b1b79b5bc3bc8","start_time":"Sun, 05
>> Aug 2012 17:34:34 GMT","end_time":"Sun, 05 Aug 2012 17:34:42
>> GMT","start_last_seq":262336,"end_last_seq":262672,"recorded_seq":262672,"missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>>
>> I compact and cleanup both databases, it did not help.
>>
>> Please, suggest, what can be done?
>>
>>
>>
>> --
>> М.
>>
>> http://diglossa.ru
>> xmpp://m.bykov@jabber.ru
>
> Hi Michael,
>
> The thing stopping writing your docs is a validation function (clue
> "`The `source' property must exist and be either a string or an
> object" is not in the couch source tree). I'm guessing a little but I
> think your _replicator db at one end now has "normal" design docs in
> it.
>
> What I'd do now is:
>
> 1. rename the _replicator.couch db file at the problem end to something else.
> 2. restart couchdb (get a new, clean _replicator)
> 3. if you need to, log into futon as admin and delete all ddocs in the
> renamed, foobared _replicator and rename it back. You'll likely only
> need this if you have continuous replications, or ones that should be
> present on a restart of couchdb.
> 4. any more cleanup as reqd by your application.
>
> I think that's enough to get you started.
>
> A+
> Dave


Hi Dave, thank you!

yes, _replicator.couch files had different sizes, 4.1 kb on local end
and 8.2 on remote.

I removed both _replicator.couch and restart both couchdb. but alas,
it did not help.

in logs on my side (each document)

[error] [<0.3848.0>] Replicator: couldn't write document xxx to target database

but on remote side

[info] [<0.253.0>] OS Process #Port<0.3042> Log :: Error writing
document `1a1f377aaa9a5f0125b2344c20087eb7' to the replicator
database: The `source' property must exist and be either a string or
an object.

Why it write 'replicator database'?

By the way, remote end had a lot of strange for this place files and
directories, for example .bashrc, .ssh, .bash_logout. .emacs.d/

I have deleted all of them, and restart it again. Now it has the same
files as my local end.

Permissions are correct, as far as I can see.

I have deleted my new docs from local db, replication goes ok, in Futon

"missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":280,"doc_write_failures":0}

and then I have created this docs again and had again

"missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}



-- 
М.

http://diglossa.ru
xmpp://m.bykov@jabber.ru

Re: I replicate _replicator by chance

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 5 August 2012 19:47, Michael Bykov <m....@gmail.com> wrote:
> Hi,
>
> I by chance replicate "_replicator" to a destination database. More
> exactly, I click "replicate" button, but nothing happens.
>
> But now, when I replicate my local db, it wrote in a log on each document:
>
> [error] [<0.28457.5>] Replicator: couldn't write document
> `4fc8269be10198e2bfa2a137fe1a9333`, revision
> `1-4a8baba0dd74f92ec0da91e8fff84774`, to target database
> `http://admin:*****@localhost:5986/diglossa/`. Error: `forbidden`,
> reason: `The `source' property must exist and be either a string or an
> object.`
>
> And in Futon:
>
> {"session_id":"d7c097b8d822f707725b1b79b5bc3bc8","start_time":"Sun, 05
> Aug 2012 17:34:34 GMT","end_time":"Sun, 05 Aug 2012 17:34:42
> GMT","start_last_seq":262336,"end_last_seq":262672,"recorded_seq":262672,"missing_checked":280,"missing_found":280,"docs_read":280,"docs_written":0,"doc_write_failures":280}
>
> I compact and cleanup both databases, it did not help.
>
> Please, suggest, what can be done?
>
>
>
> --
> М.
>
> http://diglossa.ru
> xmpp://m.bykov@jabber.ru

Hi Michael,

The thing stopping writing your docs is a validation function (clue
"`The `source' property must exist and be either a string or an
object" is not in the couch source tree). I'm guessing a little but I
think your _replicator db at one end now has "normal" design docs in
it.

What I'd do now is:

1. rename the _replicator.couch db file at the problem end to something else.
2. restart couchdb (get a new, clean _replicator)
3. if you need to, log into futon as admin and delete all ddocs in the
renamed, foobared _replicator and rename it back. You'll likely only
need this if you have continuous replications, or ones that should be
present on a restart of couchdb.
4. any more cleanup as reqd by your application.

I think that's enough to get you started.

A+
Dave