You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Ihor Paliichuk (JIRA)" <ji...@apache.org> on 2017/10/13 12:24:00 UTC

[jira] [Commented] (CAMEL-8063) Persistent tail tracking picks random tail tracker from mongoDB collection

    [ https://issues.apache.org/jira/browse/CAMEL-8063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16203480#comment-16203480 ] 

Ihor Paliichuk commented on CAMEL-8063:
---------------------------------------

Hello. This was fixed in initialize() but still present in persistToStore() function

        Bson updateObj = Updates.set(config.field, lastVal);
        dbCol.updateOne(trackingObj, updateObj);
        trackingObj = dbCol.find().first();

If few trackers are present in one collection, after storing lastVal, each tracker will replaced by first one from collection. Should be

        trackingObj = dbCol.find(filter).first();

Issue present in version 2.20 in both mongodb and mongodb3 component.

> Persistent tail tracking picks random tail tracker from mongoDB collection
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-8063
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8063
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mongodb
>    Affects Versions: 2.13.1
>            Reporter: Jörg Peschke
>            Assignee: Willem Jiang
>            Priority: Minor
>             Fix For: 2.15.0
>
>
> There is a bug the method "initialize" in "MongoDbTailTrackingManager.java": 
> ...
>  if (trackingObj == null) {
>             dbCol.insert(filter, WriteConcern.SAFE);
>             trackingObj = dbCol.findOne();
>  }
> ...
> If no tail tracking object exists in the database, a new one will be inserted (that's okay), but the query "dbCol.findOne()" fetches ANY tail tracking object from the database (and not the one we've just inserted). 
> In my oppinition, this is a bug and should be corrected like this: 
> ...
> DBObject filter = new BasicDBObject("persistentId", config.persistentId);
> trackingObj = dbCol.findOne(filter);
>  if (trackingObj == null) {
>             dbCol.insert(filter, WriteConcern.SAFE);
>             trackingObj = dbCol.findOne(filter);
>  }
> (not tested).
> A workaround can be implemented by putting each persistent tail tracker in it's own collection, so I marked this issue as "minor".
> More details: http://camel.465427.n5.nabble.com/MongoDB-Persistent-tail-tracking-with-concurrent-tailable-consumers-td5759131.html
> Best regards,
> Joerg Peschke



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)