| | |
| | | // Read the CNIndexDB to see whether it contains startChangeNumber |
| | | DBCursor<ChangeNumberIndexRecord> cursor = |
| | | cnIndexDB.getCursorFrom(startChangeNumber); |
| | | final ChangeNumberIndexRecord startRecord = cursor.getRecord(); |
| | | if (startRecord != null) |
| | | if (cursor.next()) |
| | | { |
| | | // found the provided startChangeNumber, let's return it |
| | | cnIndexDBCursor = cursor; |
| | | return startRecord.getPreviousCookie(); |
| | | return cursor.getRecord().getPreviousCookie(); |
| | | } |
| | | close(cursor); |
| | | |
| | |
| | | if (startChangeNumber < oldestChangeNumber) |
| | | { |
| | | cursor = cnIndexDB.getCursorFrom(oldestChangeNumber); |
| | | final ChangeNumberIndexRecord oldestRecord = cursor.getRecord(); |
| | | if (oldestRecord == null) |
| | | if (!cursor.next()) |
| | | { |
| | | // This should not happen |
| | | close(cursor); |
| | |
| | | } |
| | | |
| | | cnIndexDBCursor = cursor; |
| | | return oldestRecord.getPreviousCookie(); |
| | | return cursor.getRecord().getPreviousCookie(); |
| | | } |
| | | else if (startChangeNumber <= newestChangeNumber) |
| | | { |
| | |
| | | { |
| | | DBCursor<ChangeNumberIndexRecord> cursor = |
| | | cnIndexDB.getCursorFrom(startChangeNumber); |
| | | cursor.next(); |
| | | if (cursor.getRecord() == null) |
| | | { |
| | | close(cursor); |