Teammates: Run data migration on legacy comment search documents to update date format

Created on 11 Jul 2017  路  6Comments  路  Source: TEAMMATES/teammates

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).

a-FaultTolerance

All 6 comments

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?

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.

Was this page helpful?
0 / 5 - 0 ratings