Add more tracing to DataJournalV0 74/100774/2
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 24 Apr 2022 14:58:40 +0000 (16:58 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 24 Apr 2022 16:42:31 +0000 (18:42 +0200)
We seem to have a problem with completing a specific write, add a few
more traces to try to pin the problem down.

JIRA: CONTROLLER-2043
Change-Id: I9efb37fd40e48ff81c988da7edcb0ae0010f7baf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-akka-segmented-journal/src/main/java/org/opendaylight/controller/akka/segjournal/DataJournalV0.java

index bc5eead..a2b3919 100644 (file)
@@ -21,6 +21,7 @@ import io.atomix.storage.journal.SegmentedJournalWriter;
 import io.atomix.utils.serializer.Namespace;
 import java.io.File;
 import java.io.Serializable;
+import java.util.List;
 import org.opendaylight.controller.akka.segjournal.DataJournalEntry.FromPersistence;
 import org.opendaylight.controller.akka.segjournal.DataJournalEntry.ToPersistence;
 import org.opendaylight.controller.akka.segjournal.SegmentedJournalActor.ReplayMessages;
@@ -110,15 +111,23 @@ final class DataJournalV0 extends DataJournal {
         for (int i = 0; i < count; ++i) {
             final long mark = writer.getLastIndex();
             final AtomicWrite request = message.getRequest(i);
+
+            final List<PersistentRepr> reprs = CollectionConverters.asJava(request.payload());
+            LOG.trace("{}: append {}/{}: {} items at mark {}", persistenceId, i, count, mark, reprs.size());
             try {
-                for (PersistentRepr repr : CollectionConverters.asJava(request.payload())) {
+                for (PersistentRepr repr : reprs) {
                     final Object payload = repr.payload();
                     if (!(payload instanceof Serializable)) {
                         throw new UnsupportedOperationException("Non-serializable payload encountered "
                                 + payload.getClass());
                     }
 
-                    recordMessageSize(writer.append(new ToPersistence(repr)).size());
+                    LOG.trace("{}: starting append of {}", persistenceId, payload);
+                    final Indexed<ToPersistence> entry = writer.append(new ToPersistence(repr));
+                    final int size = entry.size();
+                    LOG.trace("{}: finished append of {} with {} bytes at {}", persistenceId, payload, size,
+                        entry.index());
+                    recordMessageSize(size);
                 }
             } catch (Exception e) {
                 LOG.warn("{}: failed to write out request", persistenceId, e);