Closed logic-danderson closed 8 years ago
This seems to make a lot of sense. One of those nuances I didn't think about when spitting out all of these different functions. Conceptually I agree that if I am looking for a message I would typically start from now and work backwards.
…method so most recent file is first
There is a comment in the aaLogReader.GetRecordByMessageNumber() method at line 1040 saying that message numbers can be reused so it returns the first log record encountered with that message number. The GetLogFIlePathsForMessageNumber() method sorts the files by time in ascending order, so the oldest file will be used.
For my uses, anyway, that's backwards. The stuff I'm working on needs methods such as GetRecordByMessageNumber() and GetRecordsByStartMessageNumberAndCount() to return the most recent record.
The use case is processing new log records in batches where it needs to start each new batch at the next record after it left off on the previous batch. I cannot use GetUnreadRecords() for this due to other factors, but GetRecordsByStartMessageNumberAndCount() works if it always picks up at the most recent log file containing the given message number.
This PR changes one line in GetLogFilePathsForMessageNumber() to sort by time descending so the most recent file is used. GetLogFIlePathsForMessageNumber() is only called from GetRecordByMessageNumber(), so hopefully that change is OK.
Are there use cases where the oldest file containing that message number should be found instead? If so, I could add a parameter to specify the sort direction, but that would trickle out to other methods.