>From Ritik Raj <[email protected]>:

Ritik Raj has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21133?usp=email )


Change subject: [NO ISSUE][LOG] Added log to describe the indexComponent
......................................................................

[NO ISSUE][LOG] Added log to describe the indexComponent

- user model changes: no
- storage format changes: no
- interface changes: no

Ext-ref: MB-71382
Change-Id: I1a9ee484afac5c537d9f69fcdcf10cdefdfdbb9d
---
M 
hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/ComponentUtils.java
1 file changed, 54 insertions(+), 1 deletion(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/33/21133/1

diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/ComponentUtils.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/ComponentUtils.java
index 842ec61..421a6da 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/ComponentUtils.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/ComponentUtils.java
@@ -85,6 +85,10 @@
             ILSMMemoryComponent cmc = index.getCurrentMemoryComponent();
             if (cmc.isReadable()) {
                 index.getCurrentMemoryComponent().getMetadata().get(key, 
value);
+            } else {
+                LOGGER.debug(
+                        "{} lookup skipped unreadable mutable memory component 
{} (state={}, modified={}, writers={})",
+                        key, cmc, cmc.getState(), cmc.isModified(), 
cmc.getWriterCount());
             }
             if (value.getLength() == 0) {
                 // was not found in the in current mutable component, search 
in the other in-memory components
@@ -93,7 +97,8 @@
                     // was not found in all in-memory components, search in 
the disk components
                     fromDiskComponents(index, key, value);
                     if (value.getLength() == 0) {
-                        LOGGER.debug("{} was NOT found", key);
+                        LOGGER.debug("{} was NOT found in {}. lookup context: 
{}", key, index,
+                                describeIndexComponentsUnsafe(index));
                     }
                 }
             } else {
@@ -102,6 +107,12 @@
         }
     }

+    public static String describeIndexComponents(ILSMIndex index) {
+        synchronized (index.getOperationTracker()) {
+            return describeIndexComponentsUnsafe(index);
+        }
+    }
+
     /**
      * Put LSM metadata state into the index's current memory component.
      *
@@ -154,6 +165,48 @@
         }
     }

+    private static String describeIndexComponentsUnsafe(ILSMIndex index) {
+        StringBuilder sb = new StringBuilder();
+        List<ILSMMemoryComponent> memComponents = index.getMemoryComponents();
+        
sb.append("currentMutableIndex=").append(index.getCurrentMemoryComponentIndex());
+        sb.append(", memoryComponents=[");
+        for (int i = 0; i < memComponents.size(); i++) {
+            if (i > 0) {
+                sb.append(", ");
+            }
+            appendMemoryComponent(sb, i, 
index.getCurrentMemoryComponentIndex(), memComponents.get(i));
+        }
+        sb.append("]");
+        List<ILSMDiskComponent> diskComponents = index.getDiskComponents();
+        sb.append(", diskComponents=[");
+        for (int i = 0; i < diskComponents.size(); i++) {
+            if (i > 0) {
+                sb.append(", ");
+            }
+            appendDiskComponent(sb, diskComponents.get(i));
+        }
+        sb.append("]");
+        return sb.toString();
+    }
+
+    private static void appendMemoryComponent(StringBuilder sb, int 
componentIndex, int currentMutableIndex,
+            ILSMMemoryComponent component) {
+        sb.append("{index=").append(componentIndex);
+        if (componentIndex == currentMutableIndex) {
+            sb.append(", current=true");
+        }
+        sb.append(", state=").append(component.getState());
+        sb.append(", readable=").append(component.isReadable());
+        sb.append(", modified=").append(component.isModified());
+        sb.append(", writers=").append(component.getWriterCount());
+        sb.append(", component=").append(component).append('}');
+    }
+
+    private static void appendDiskComponent(StringBuilder sb, 
ILSMDiskComponent component) {
+        sb.append("{state=").append(component.getState());
+        sb.append(", component=").append(component).append('}');
+    }
+
     public static void markAsValid(ITreeIndex treeIndex, boolean forceToDisk, 
IPageWriteFailureCallback callback)
             throws HyracksDataException {
         int fileId = treeIndex.getFileId();

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21133?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: trinity
Gerrit-Change-Id: I1a9ee484afac5c537d9f69fcdcf10cdefdfdbb9d
Gerrit-Change-Number: 21133
Gerrit-PatchSet: 1
Gerrit-Owner: Ritik Raj <[email protected]>

Reply via email to