-
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
Added support for reindexing of dataExpiration #2211
Added support for reindexing of dataExpiration #2211
Conversation
Hi @fgalan , If PR seems ok, please merge the PR. |
} catch (Exception e) { | ||
LOGGER.warn("Error in collection " + collectionName + " creating index ex=" + e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the try/catch be removed (given that createIndex() will deal with the exception internally)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1458daf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the try/catch block is still there... or maybe I'm missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will remove try/catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b6045a0
} catch (Exception e) { | ||
LOGGER.warn("Error in collection " + collectionName + " creating index ex=" + e.getMessage()); | ||
} // try catch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the try/catch be removed (given that createIndex() will deal with the exception internally)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1458daf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the try/catch block is still there... or maybe I'm missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will remove try/catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b6045a0
* @param options | ||
* @throws Exception | ||
*/ | ||
public void createIndex(MongoDatabase db, String collectionName, BasicDBObject keys, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is throws MongoException
correct?
Given you capture the exception with the try/catch block, I would say that createIndex() is not able to throw any Exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1458daf
CHANGES_NEXT_RELEASE
Outdated
[cygnus-common][cygnus-twitter][cygnus-ngsi][cygnus-ngsi-ld] Upgrade log4j from v1 (1.2.17) to v2 (2.17.2) series (#1592) | ||
[cygnus-ngsi] OracleSQL ngsi sink added (for OracleS 11g and 12c) (#2195) | ||
[cygnus-ngsi] Removes "_" in schema name for DM -schema family (#2201) | ||
[cygnus-common] Added support for reindexing of dataExpiration (#2160) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cygnus-common] Added support for reindexing of dataExpiration (#2160) | |
[cygnus-common] Added support for reindexing of dataExpiration (#2160, partially) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in ffafa96
Hi @fgalan , Thanks for your support. |
} catch (Exception e) { | ||
LOGGER.warn("Error in collection " + collectionName + " creating index ex=" + e.getMessage()); | ||
} // try catch | ||
try { | ||
if (dataExpiration != 0) { | ||
keys = new BasicDBObject().append("recvTime", 1); | ||
options = new IndexOptions().name("cyg_raw_exp").expireAfter(dataExpiration, TimeUnit.SECONDS); | ||
db.getCollection(collectionName).createIndex(keys, options); | ||
createIndex(db, collectionName, keys, options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the try/catch be removed (given that createIndex() will deal with the exception internally)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will remove try/catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b6045a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for the contribution!
Fixes issue #2160
Now, we can change dataExpiration value in agent.conf file to get it reflected in database.