[JAVA-704] Java Driver caches indexes internally, which causes indexes if indexes are managed by multiple apps Created: 29/Nov/12  Updated: 30/Nov/12  Resolved: 30/Nov/12

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Oleg Krook Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Java Driver 2.8.0


Issue Links:
Duplicate
duplicates JAVA-667 Caching Behavior Inconsistent when Dr... Closed

 Description   

Java Driver caches index information when using DBCollection.ensureIndex method that makes it unusable if there are multiple apps managing indexing/db.

DBCollection.createIndex on the other hand does not cache this information.

The mongo console does not have the createIndex method, but instead it has ensureIndex.

The behavior of the JS vs Java ensureIndex is expected to be the same.

The caching behavior is not documented anywhere.

In addition, adding this kind of functionality to a db driver does not make sense, as it should serve as a proxy between the applications and the database. The application can decide whether or not to cache such information.



 Comments   
Comment by Oleg Krook [ 30/Nov/12 ]

Thanks, it makes sense.

Comment by Jeffrey Yemin [ 30/Nov/12 ]

The reason I marked this as a duplicate is that I think all caching behavior for indices should be removed from the driver.

Comment by Oleg Krook [ 30/Nov/12 ]

I do not think the defects are related. The ensureIndex is advocated to be used on the www.mongodb.com, however the caching behavior of it is not documented anywhere. I would consider this to be a documentation defect after I've learned the createIndex should have been used instead.

Comment by Jeffrey Yemin [ 30/Nov/12 ]

This issue duplicates JAVA-667, so I'm going to close it.

Comment by Ian Whalen (Inactive) [ 29/Nov/12 ]

from Steps To Reproduce:

1. App1 uses DBColletion.ensureIndex to create and index
2. App2 drops the database
3. App1 validates that the db is dropped and calls DBColletion.ensureIndex again to ensure indexes.

Generated at Thu Feb 08 08:52:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.