-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cygnus could deal with changes in expiration and collection size (peding: collection size) #2160
Comments
Side note: it would be great if Cygnus can cover these cases but, if it is too complex, a possible solution is through documentation, I mean, to define the manual procedures to do that and include them in Cygnus documentation. |
Hi @fgalan , With regards to expiration index... I am working on this. |
Hi @fgalan , With regards to expiration index... With regards to collection size... If resizing need to be supported on Cygnus with lower version of MongoDB then we need to follow below approach:
We need to perform above steps for each existing collection. |
Please focus on the "With regards to expiration index" case. The "With regards with collection size" is not very important, as we don't typically run Cygnus in this mode. |
In https://github.com/telefonicaid/fiware-cygnus/blob/master/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/mongo/MongoBackendImpl.java we have to functions for createCollection:
(the second one assuming that dataExpiration has been removed, as described in #2159)
They work perfectly for new collections but for existing collections Cygnus is not able to change the dateExpirations or collection size settings.
With regards with expiration index...
MongoDB does't allow to use createIndex() if an expiration index already exists and the expiration parameter is different, i.e:
so Cygnus would need to remove the old index and create the new one.
With regards with collection size...
It seems MongoDB allows to use the the
convertToCapped
command to do the resize (see https://stackoverflow.com/a/22814104/1485926) although it is not clear if that command work with already capped collections (see my comment in that answer about it)The text was updated successfully, but these errors were encountered: