(String db)
| 49 | private boolean running = true; |
| 50 | |
| 51 | private static void logDump(String db) throws IOException, RocksDBException { |
| 52 | RocksDB.loadLibrary(); |
| 53 | try (var r1 = RocksDB.openReadOnly(RocksDatabase.getCommonOptions(), Paths.get(db, "logs").toString())) { |
| 54 | try (var it1 = r1.newIterator(RocksDatabase.getDefaultReadOptions())) { |
| 55 | var StateMachine = new TestStateMachine(); |
| 56 | var snapshot = Paths.get(db, LogSequence.snapshotFileName).toString(); |
| 57 | if (new File(snapshot).isFile()) |
| 58 | StateMachine._loadSnapshot(snapshot); |
| 59 | try (var dumpFile = new FileOutputStream(db + ".txt")) { |
| 60 | dumpFile.write(String.format("SnapshotCount = %d\n", StateMachine.getCount()).getBytes(StandardCharsets.UTF_8)); |
| 61 | for (it1.seekToFirst(); it1.isValid(); it1.next()) { |
| 62 | var l1 = RaftLog.decode(new Binary(it1.value()), StateMachine::logFactory); |
| 63 | dumpFile.write(l1.toString().getBytes(StandardCharsets.UTF_8)); |
| 64 | dumpFile.write('\n'); |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | public void run(String command, String[] args) throws InterruptedException { |
| 72 | System.out.println(command); |
no test coverage detected