Related to #7569. Script from #7682 can be run in the near future to update all comment search documents to the latest format (with dates in the currently prescribed format).
Will do in the next release, after we are sure the current release is stable.
I tried running the script. It timed out after a while because the whole thing takes too long.
Then I running it for a part of data only. Found out that out of 7000+ comments, only 3 have wrong date format. All 3 them failed to migrate because of NullPointerException, caused by 'cannot locate feedback response'. Perhaps we just leave those three alone?. Or is there any way to delete them?
I'm guessing the NPE occurs inside the .build() step of https://github.com/TEAMMATES/teammates/blob/a446786d53aa235b020d6dfdea1ca64562a595d6/src/client/java/teammates/client/scripts/DataMigrationForFeedbackResponseCommentSearchDocument.java#L124
?
Here's an example:
INFO: Trying to get non-existent response: abczfnRlYW1tYXRlc3Y0ch0LEhBGZWVkYmFja1F1ZXN0aW9uGICAgI7Px54JDA%[email protected]%[email protected].
Exception in thread "main" java.lang.NullPointerException
at teammates.storage.search.FeedbackResponseCommentSearchDocument.prepareData(FeedbackResponseCommentSearchDocument.java:80)
at teammates.storage.search.SearchDocument.build(SearchDocument.java:39)
at teammates.client.scripts.DataMigrationForFeedbackResponseCommentSearchDocument.queueDocumentUpdate(DataMigrationForFeedbackResponseCommentSearchDocument.java:127)
at teammates.client.scripts.DataMigrationForFeedbackResponseCommentSearchDocument.fixDocuments(DataMigrationForFeedbackResponseCommentSearchDocument.java:115)
at teammates.client.scripts.DataMigrationForFeedbackResponseCommentSearchDocument.doOperation(DataMigrationForFeedbackResponseCommentSearchDocument.java:45)
at teammates.client.remoteapi.RemoteApiClient.doOperationRemotely(RemoteApiClient.java:49)
at teammates.client.scripts.DataMigrationForFeedbackResponseCommentSearchDocumentDateFormat.main(DataMigrationForFeedbackResponseCommentSearchDocumentDateFormat.java:43)
Yes; it's possible to delete them. The simplest way would be:
// replace with ID of non-existent response as shown in the log
String invalidResponseId = "abczfnRlYW1tYXRlc3Y0ch0LEhBGZWVkYmFja1F1ZXN0aW9uGICAgI7Px54JDA%[email protected]%[email protected]";
FeedbackResponseCommentsLogic frcLogic = FeedbackResponseCommentsLogic.inst();
List<FeedbackResponseCommentAttributes> invalidComments =
frcLogic.getFeedbackResponseCommentForResponse(invalidResponseId);
for (FeedbackResponseCommentAttributes invalidComment : invalidComments) {
frcLogic.deleteDocument(invalidComment);
}
frcLogic.deleteFeedbackResponseCommentsForResponse(invalidResponseId);
Ok, deleted all three invalid responses.