Hello,

Over the last 15 months, we have been successfully operating one of our
platforms using Camel 2.9.1/2.10.1.  Recently, we have upgraded each of our
processes to use Camel 2.12.2, and in the main, this has been a very
straightforward process.

Unfortunately, we have observed some unexpected behaviour within one of our
processes, on two routes which interact with MongoDB, when using the
"dynamicity=true" flag - our indexes are being dropped!

Here is an example of what we're seeing - our routes are externally
configured using a properties file:

route.database.contentcollection.findall={{database.root}}&collection=collection&operation=findAll&dynamicity=true
route.database.contentcollection.update={{database.root}}&collection=collection&operation=update&dynamicity=true

To note, "collection" does not exist, it is replaced within our route with a
computed collection (code sample):

            bean( contentLink, ContentLink.GET_CONTENT_COLLECTION_NAME ).
            setHeader( "CamelMongoDbCollection", body() ).
            bean( contentLink, ContentLink.CREATE_OTHER_DOCUMENT_QUERY ).
            to( "{{route.database.contentcollection.findall}}" ).

Within the MongoDB logs, we are seeing this:

Tue Jan 28 22:22:35 [conn42] query content.feedcontent query: { _id:
ObjectId('5217d372300420b0c1218750') } ntoreturn:1 idhack:1 reslen:4668 0ms
Tue Jan 28 22:22:35 [conn42] run command content.$cmd { deleteIndexes:
"matchinfo", index: "*" }
Tue Jan 28 22:22:35 [conn42] CMD: dropIndexes content.matchinfo
Tue Jan 28 22:22:35 [conn42] command content.$cmd command: { deleteIndexes:
"matchinfo", index: "*" } ntoreturn:1 reslen:106 0ms
Tue Jan 28 22:22:35 [conn42] query content.matchinfo query: { ... query is
here... } reslen:20 80ms

"matchinfo" is computed by the bean.

If I set the route to use "collection=matchinfo" directly, without any
"dynamicity", the database query behaves as intended, as per this example:

Tue Jan 28 22:23:29 [conn47] query content.feedcontent query: { _id:
ObjectId('5217d372300420b0c1218750') } ntoreturn:1 idhack:1 reslen:4668 0ms
Tue Jan 28 22:23:30 [conn47] query content.matchinfo query: { ... query is
here... } reslen:20 88ms


Using Camel 2.9.1/2.10.1, we do not experience this problem.  Using the
grepcode website and comparing "MongoDbEndpoint.java" code with a pre-2.12.x
version, I can see there is new code within the "initializeConnection()"
which calls "ensureIndex".  This appears to be controlled via a parameter
"collectionIndex".

'ensureIndex' issues a command to drop the index, irrespective of whether
there are subsequent parameters set up an index.

I've attempted to add "&collectionIndex=" to set this to an 'empty' value,
but this does not appear to override the 'ensureIndex' call.

Has anyone else experienced this behaviour?  Are there any additional
parameters we should set on the routes with dynamicity to stop this
behaviour (or revert to pre 2.12.x behaviour)?

Any thoughts or assistance would be greatly appreciated.

Best regards, Madhu.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-2-12-MongoDB-pre-existing-indexes-being-dropped-when-using-dynamicity-tp5746575.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to