@Test public void testDoubleFinish() throws IOException { Mutation ignored = new ServerMutation(new Text("ignored")); ignored.put(cf, cq, value); Mutation m = new ServerMutation(new Text("row1")); m.put(cf, cq, value); Mutation m2 = new ServerMutation(new Text("row2")); m2.put(cf, cq, new Value("123")); KeyValue[] entries = {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 1, extent), createKeyValue(COMPACTION_FINISH, 2, 1, null), createKeyValue(COMPACTION_START, 4, 1, "/t1/f1"), createKeyValue(COMPACTION_FINISH, 5, 1, null), createKeyValue(MUTATION, 3, 1, ignored), createKeyValue(MUTATION, 5, 1, m), createKeyValue(MUTATION, 5, 1, m2),}; Map<String,KeyValue[]> logs = new TreeMap<>(); logs.put("entries", entries); List<Mutation> mutations = recover(logs, extent); assertEquals(2, mutations.size()); assertEquals(m, mutations.get(0)); assertEquals(m2, mutations.get(1)); }
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);  }