Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1438,11 +1438,7 @@ private Put createPutForWriteRegionServerLogTimestamp(TableName table, byte[] sm
*/
private Scan createScanForReadLogTimestampMap(String backupRoot) {
Scan scan = new Scan();
byte[] startRow = rowkey(TABLE_RS_LOG_MAP_PREFIX, backupRoot);
byte[] stopRow = Arrays.copyOf(startRow, startRow.length);
stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1);
scan.withStartRow(startRow);
scan.withStopRow(stopRow);
scan.setStartStopRowForPrefixScan(rowkey(TABLE_RS_LOG_MAP_PREFIX, backupRoot, NULL));
scan.addFamily(BackupSystemTable.META_FAMILY);

return scan;
Expand Down Expand Up @@ -1479,11 +1475,7 @@ private Put createPutForRegionServerLastLogRollResult(String server, Long timest
*/
private Scan createScanForReadRegionServerLastLogRollResult(String backupRoot) {
Scan scan = new Scan();
byte[] startRow = rowkey(RS_LOG_TS_PREFIX, backupRoot);
byte[] stopRow = Arrays.copyOf(startRow, startRow.length);
stopRow[stopRow.length - 1] = (byte) (stopRow[stopRow.length - 1] + 1);
scan.withStartRow(startRow);
scan.withStopRow(stopRow);
scan.setStartStopRowForPrefixScan(rowkey(RS_LOG_TS_PREFIX, backupRoot, NULL));
scan.addFamily(BackupSystemTable.META_FAMILY);
scan.readVersions(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,11 @@ public void testRegionServerLastLogRollResults() throws IOException {
String[] servers = new String[] { "server1", "server2", "server3" };
Long[] timestamps = new Long[] { 100L, 102L, 107L };

// validate the prefix scan in readRegionServerlastLogRollResult will get the right timestamps
// when a backup root with the same prefix is present
for (int i = 0; i < servers.length; i++) {
table.writeRegionServerLastLogRollResult(servers[i], timestamps[i], "root");
table.writeRegionServerLastLogRollResult(servers[i], timestamps[i], "root/backup");
}

HashMap<String, Long> result = table.readRegionServerLastLogRollResult("root");
Expand Down Expand Up @@ -265,7 +268,10 @@ public void testRegionServerLogTimestampMap() throws IOException {
rsTimestampMap.put("rs2:100", 101L);
rsTimestampMap.put("rs3:100", 103L);

// validate the prefix scan in readLogTimestampMap will get the right timestamps
// when a backup root with the same prefix is present
table.writeRegionServerLogTimestamp(tables, rsTimestampMap, "root");
table.writeRegionServerLogTimestamp(tables, rsTimestampMap, "root/backup");

Map<TableName, Map<String, Long>> result = table.readLogTimestampMap("root");

Expand All @@ -291,7 +297,10 @@ public void testRegionServerLogTimestampMap() throws IOException {
rsTimestampMap1.put("rs2:100", 201L);
rsTimestampMap1.put("rs3:100", 203L);

// validate the prefix scan in readLogTimestampMap will get the right timestamps
// when a backup root with the same prefix is present
table.writeRegionServerLogTimestamp(tables1, rsTimestampMap1, "root");
table.writeRegionServerLogTimestamp(tables1, rsTimestampMap, "root/backup");

result = table.readLogTimestampMap("root");

Expand Down