@Test public void testMultipleCompactionStartEvents() throws IOException { Mutation m1 = new ServerMutation(new Text("r1")); m1.put("f1", "q1", "v1"); Mutation m2 = new ServerMutation(new Text("r2")); m2.put("f1", "q1", "v2"); KeyValue[] entries1 = {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 100, 10, extent), createKeyValue(MUTATION, 100, 10, m1), createKeyValue(COMPACTION_START, 102, 10, "/t/f1"), createKeyValue(COMPACTION_START, 102, 10, "/t/f1"), createKeyValue(COMPACTION_START, 102, 10, "/t/f1"), createKeyValue(COMPACTION_FINISH, 103, 10, null), createKeyValue(MUTATION, 103, 10, m2)}; Arrays.sort(entries1); Map<String,KeyValue[]> logs = new TreeMap<>(); logs.put("entries1", entries1); List<Mutation> mutations1 = recover(logs, extent); assertEquals(1, mutations1.size()); assertEquals(m2, mutations1.get(0)); }
public void recover(KeyExtent extent, List<Path> recoveryLogs, Set<String> tabletFiles, MutationReceiver mr) throws IOException { Entry<Integer,List<Path>> maxEntry = findLogsThatDefineTablet(extent, recoveryLogs); int tabletId = maxEntry.getKey(); List<Path> logsThatDefineTablet = maxEntry.getValue(); if (tabletId == -1) { log.info("Tablet {} is not defined in recovery logs {} ", extent, asNames(recoveryLogs)); return; } else { log.info("Found {} of {} logs with max id {} for tablet {}", logsThatDefineTablet.size(), recoveryLogs.size(), tabletId, extent); } long recoverySeq = findRecoverySeq(logsThatDefineTablet, tabletFiles, tabletId); log.info("Recovering mutations, tablet:{} tabletId:{} seq:{} logs:{}", extent, tabletId, recoverySeq, asNames(logsThatDefineTablet)); playbackMutations(logsThatDefineTablet, mr, tabletId, recoverySeq); }
SortedLogRecovery { public void recover(KeyExtent extent, List<Path> recoveryLogs, Set<String> tabletFiles, MutationReceiver mr) throws IOException { Entry<Integer,List<Path>> maxEntry = findLogsThatDefineTablet(extent, recoveryLogs); int tabletId = maxEntry.getKey(); List<Path> logsThatDefineTablet = maxEntry.getValue(); if (tabletId == -1) { log.info("Tablet {} is not defined in recovery logs {} ", extent, asNames(recoveryLogs)); return; } else { log.info("Found {} of {} logs with max id {} for tablet {}", logsThatDefineTablet.size(), recoveryLogs.size(), tabletId, extent); } long recoverySeq = findRecoverySeq(logsThatDefineTablet, tabletFiles, tabletId); log.info("Recovering mutations, tablet:{} tabletId:{} seq:{} logs:{}", extent, tabletId, recoverySeq, asNames(logsThatDefineTablet)); playbackMutations(logsThatDefineTablet, mr, tabletId, recoverySeq); } }
SortedLogRecovery { public void recover(KeyExtent extent, List<Path> recoveryLogs, Set<String> tabletFiles, MutationReceiver mr) throws IOException { Entry<Integer,List<Path>> maxEntry = findLogsThatDefineTablet(extent, recoveryLogs); int tabletId = maxEntry.getKey(); List<Path> logsThatDefineTablet = maxEntry.getValue(); if (tabletId == -1) { log.info("Tablet {} is not defined in recovery logs {} ", extent, asNames(recoveryLogs)); return; } else { log.info("Found {} of {} logs with max id {} for tablet {}", logsThatDefineTablet.size(), recoveryLogs.size(), tabletId, extent); } long recoverySeq = findRecoverySeq(logsThatDefineTablet, tabletFiles, tabletId); log.info("Recovering mutations, tablet:{} tabletId:{} seq:{} logs:{}", extent, tabletId, recoverySeq, asNames(logsThatDefineTablet)); playbackMutations(logsThatDefineTablet, mr, tabletId, recoverySeq); } SortedLogRecovery(VolumeManager fs); }
SortedLogRecovery { public void recover(KeyExtent extent, List<Path> recoveryLogs, Set<String> tabletFiles, MutationReceiver mr) throws IOException { Entry<Integer,List<Path>> maxEntry = findLogsThatDefineTablet(extent, recoveryLogs); int tabletId = maxEntry.getKey(); List<Path> logsThatDefineTablet = maxEntry.getValue(); if (tabletId == -1) { log.info("Tablet {} is not defined in recovery logs {} ", extent, asNames(recoveryLogs)); return; } else { log.info("Found {} of {} logs with max id {} for tablet {}", logsThatDefineTablet.size(), recoveryLogs.size(), tabletId, extent); } long recoverySeq = findRecoverySeq(logsThatDefineTablet, tabletFiles, tabletId); log.info("Recovering mutations, tablet:{} tabletId:{} seq:{} logs:{}", extent, tabletId, recoverySeq, asNames(logsThatDefineTablet)); playbackMutations(logsThatDefineTablet, mr, tabletId, recoverySeq); } SortedLogRecovery(VolumeManager fs); void recover(KeyExtent extent, List<Path> recoveryLogs, Set<String> tabletFiles,
      MutationReceiver mr); }
SortedLogRecovery { public void recover(KeyExtent extent, List<Path> recoveryLogs, Set<String> tabletFiles, MutationReceiver mr) throws IOException { Entry<Integer,List<Path>> maxEntry = findLogsThatDefineTablet(extent, recoveryLogs); int tabletId = maxEntry.getKey(); List<Path> logsThatDefineTablet = maxEntry.getValue(); if (tabletId == -1) { log.info("Tablet {} is not defined in recovery logs {} ", extent, asNames(recoveryLogs)); return; } else { log.info("Found {} of {} logs with max id {} for tablet {}", logsThatDefineTablet.size(), recoveryLogs.size(), tabletId, extent); } long recoverySeq = findRecoverySeq(logsThatDefineTablet, tabletFiles, tabletId); log.info("Recovering mutations, tablet:{} tabletId:{} seq:{} logs:{}", extent, tabletId, recoverySeq, asNames(logsThatDefineTablet)); playbackMutations(logsThatDefineTablet, mr, tabletId, recoverySeq); } SortedLogRecovery(VolumeManager fs); void recover(KeyExtent extent, List<Path> recoveryLogs, Set<String> tabletFiles,
      MutationReceiver mr);  }