ARTEMIS-3825 Improve Print-data output with non existing queues
This commit is contained in:
parent
7a03f58be9
commit
bed9af2e51
|
@ -120,7 +120,7 @@ public class PrintData extends DBOption {
|
|||
|
||||
DescribeJournal describeJournal = DescribeJournal.printSurvivingRecords(storageManager.getMessageJournal(), out, safe);
|
||||
|
||||
printPages(describeJournal, storageManager, pagingmanager, out, safe, maxPages);
|
||||
printPages(describeJournal, storageManager, pagingmanager, out, safe, maxPages, null);
|
||||
|
||||
cleanup();
|
||||
|
||||
|
@ -160,11 +160,13 @@ public class PrintData extends DBOption {
|
|||
}
|
||||
|
||||
printBanner(out, BINDINGS_BANNER);
|
||||
DescribeJournal bindingsDescribe;
|
||||
if (skipBindings) {
|
||||
out.println(".... skipping");
|
||||
out.println();
|
||||
bindingsDescribe = null;
|
||||
} else {
|
||||
printBindings(bindingsDirectory, out, safe, true, true, reclaimed);
|
||||
bindingsDescribe = printBindings(bindingsDirectory, out, safe, true, true, reclaimed);
|
||||
}
|
||||
|
||||
printBanner(out, MESSAGES_BANNER);
|
||||
|
@ -185,7 +187,7 @@ public class PrintData extends DBOption {
|
|||
out.println(".... skipping");
|
||||
out.println();
|
||||
} else {
|
||||
printPages(pagingDirectory, describeJournal, out, safe, maxPages);
|
||||
printPages(pagingDirectory, describeJournal, out, safe, maxPages, bindingsDescribe);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -205,11 +207,12 @@ public class PrintData extends DBOption {
|
|||
return describeJournal;
|
||||
}
|
||||
|
||||
public static void printBindings(File bindingsDirectory, PrintStream out, boolean safe, boolean printRecords, boolean printSurviving, boolean reclaimed) {
|
||||
public static DescribeJournal printBindings(File bindingsDirectory, PrintStream out, boolean safe, boolean printRecords, boolean printSurviving, boolean reclaimed) {
|
||||
try {
|
||||
DescribeJournal.describeBindingsJournal(bindingsDirectory, out, safe, printRecords, printSurviving, reclaimed);
|
||||
return DescribeJournal.describeBindingsJournal(bindingsDirectory, out, safe, printRecords, printSurviving, reclaimed);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,11 +223,7 @@ public class PrintData extends DBOption {
|
|||
out.println("********************************************");
|
||||
}
|
||||
|
||||
private static void printPages(File pageDirectory, DescribeJournal describeJournal, PrintStream out, boolean safe) {
|
||||
printPages(pageDirectory, describeJournal, out, safe, -1);
|
||||
}
|
||||
|
||||
private static void printPages(File pageDirectory, DescribeJournal describeJournal, PrintStream out, boolean safe, int maxPages) {
|
||||
private static void printPages(File pageDirectory, DescribeJournal describeJournal, PrintStream out, boolean safe, int maxPages, DescribeJournal bindingsDescribe) {
|
||||
ActiveMQThreadFactory daemonFactory = new ActiveMQThreadFactory("cli", true, PrintData.class.getClassLoader());
|
||||
final ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1, daemonFactory);
|
||||
final ExecutorService executor = Executors.newFixedThreadPool(10, daemonFactory);
|
||||
|
@ -242,7 +241,7 @@ public class PrintData extends DBOption {
|
|||
addressSettingsRepository.setDefault(new AddressSettings());
|
||||
PagingManager manager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository);
|
||||
|
||||
printPages(describeJournal, sm, manager, out, safe, maxPages);
|
||||
printPages(describeJournal, sm, manager, out, safe, maxPages, bindingsDescribe);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
@ -255,9 +254,15 @@ public class PrintData extends DBOption {
|
|||
StorageManager sm,
|
||||
PagingManager manager,
|
||||
PrintStream out,
|
||||
boolean safe, int maxPages) throws Exception {
|
||||
boolean safe, int maxPages,
|
||||
DescribeJournal bindingsDescribe) throws Exception {
|
||||
PageCursorsInfo cursorACKs = calculateCursorsInfo(describeJournal.getRecords());
|
||||
|
||||
HashSet<Long> existingQueues = new HashSet<>();
|
||||
if (bindingsDescribe != null && bindingsDescribe.getBindingEncodings() != null) {
|
||||
bindingsDescribe.getBindingEncodings().forEach(e -> existingQueues.add(e.getId()));
|
||||
}
|
||||
|
||||
Set<Long> pgTXs = cursorACKs.getPgTXs();
|
||||
|
||||
manager.start();
|
||||
|
@ -321,8 +326,15 @@ public class PrintData extends DBOption {
|
|||
out.print(" (PG-COMPLETE)");
|
||||
}
|
||||
|
||||
if (!existingQueues.contains(q[i])) {
|
||||
out.print(" (N/A) ");
|
||||
acked = true;
|
||||
}
|
||||
|
||||
if (acked) {
|
||||
ackCount++;
|
||||
} else {
|
||||
out.print(" (OK) ");
|
||||
}
|
||||
|
||||
if (i + 1 < q.length) {
|
||||
|
|
|
@ -109,6 +109,7 @@ public final class DescribeJournal {
|
|||
|
||||
private final List<RecordInfo> records;
|
||||
private final List<PreparedTransactionInfo> preparedTransactions;
|
||||
private List<PersistentQueueBindingEncoding> bindingEncodings;
|
||||
|
||||
private static Configuration getConfiguration() {
|
||||
Configuration configuration;
|
||||
|
@ -143,6 +144,15 @@ public final class DescribeJournal {
|
|||
this.preparedTransactions = preparedTransactions;
|
||||
}
|
||||
|
||||
public List<PersistentQueueBindingEncoding> getBindingEncodings() {
|
||||
return bindingEncodings;
|
||||
}
|
||||
|
||||
public DescribeJournal setBindingEncodings(List<PersistentQueueBindingEncoding> bindingEncodings) {
|
||||
this.bindingEncodings = bindingEncodings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<RecordInfo> getRecords() {
|
||||
return records;
|
||||
}
|
||||
|
@ -160,12 +170,12 @@ public final class DescribeJournal {
|
|||
describeBindingsJournal(bindingsDir, out, safe, printRecords, printSurviving, false);
|
||||
}
|
||||
|
||||
public static void describeBindingsJournal(final File bindingsDir, PrintStream out, boolean safe, boolean printRecords, boolean printSurviving, boolean reclaimed) throws Exception {
|
||||
public static DescribeJournal describeBindingsJournal(final File bindingsDir, PrintStream out, boolean safe, boolean printRecords, boolean printSurviving, boolean reclaimed) throws Exception {
|
||||
|
||||
SequentialFileFactory bindingsFF = new NIOSequentialFileFactory(bindingsDir, null, 1);
|
||||
|
||||
JournalImpl bindings = new JournalImpl(1024 * 1024, 2, 2, -1, 0, bindingsFF, "activemq-bindings", "bindings", 1);
|
||||
describeJournal(bindingsFF, bindings, bindingsDir, out, safe, printRecords, printSurviving, reclaimed);
|
||||
return describeJournal(bindingsFF, bindings, bindingsDir, out, safe, printRecords, printSurviving, reclaimed);
|
||||
}
|
||||
|
||||
public static DescribeJournal describeMessagesJournal(final File messagesDir) throws Exception {
|
||||
|
@ -333,6 +343,7 @@ public final class DescribeJournal {
|
|||
|
||||
List<RecordInfo> records = new LinkedList<>();
|
||||
List<PreparedTransactionInfo> preparedTransactions = new LinkedList<>();
|
||||
List<PersistentQueueBindingEncoding> bindings = null;
|
||||
|
||||
journal.start();
|
||||
|
||||
|
@ -432,6 +443,13 @@ public final class DescribeJournal {
|
|||
|
||||
subsCounter.loadInc(info.id, encoding.getValue(), encoding.getPersistentSize());
|
||||
subsCounter.processReload();
|
||||
} else if (userRecordType == QUEUE_BINDING_RECORD) {
|
||||
PersistentQueueBindingEncoding bindingEncoding = (PersistentQueueBindingEncoding) DescribeJournal.newObjectEncoding(info, null);
|
||||
if (bindings == null) {
|
||||
bindings = new LinkedList<>();
|
||||
}
|
||||
bindings.add(bindingEncoding);
|
||||
|
||||
}
|
||||
|
||||
out.println(describeRecord(info, o, safe));
|
||||
|
@ -501,7 +519,7 @@ public final class DescribeJournal {
|
|||
|
||||
journal.stop();
|
||||
|
||||
return new DescribeJournal(records, preparedTransactions);
|
||||
return new DescribeJournal(records, preparedTransactions).setBindingEncodings(bindings);
|
||||
}
|
||||
|
||||
protected static void printCounters(final PrintStream out, final Map<Long, PageSubscriptionCounterImpl> counters) {
|
||||
|
|
Loading…
Reference in New Issue