Skip to content

Commit 6519b97

Browse files
committed
add debug log for npe
1 parent a75ab1c commit 6519b97

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

‎src/main/java/org/tron/core/db/Manager.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,17 +1258,18 @@ public void updateLatestSolidifiedBlock() {
12581258
return;
12591259
}
12601260

1261+
long oldSolidifiedBlockNum = dynamicPropertiesStore.getLatestSolidifiedBlockNum();
1262+
getDynamicPropertiesStore().saveLatestSolidifiedBlockNum(latestSolidifiedBlockNum);
1263+
logger.info("update solid block, num = {}", latestSolidifiedBlockNum);
12611264
BlockId blockId;
12621265
try {
12631266
blockId = getBlockIdByNum(latestSolidifiedBlockNum);
12641267
} catch (ItemNotFoundException e) {
12651268
blockId = null;
12661269
}
12671270
if (blockId == null || !blockStore.hasOnSolidity(blockId.getBytes())) {
1268-
revokingStore.updateSolidity(dynamicPropertiesStore.getLatestSolidifiedBlockNum(), latestSolidifiedBlockNum);
1271+
revokingStore.updateSolidity(oldSolidifiedBlockNum, latestSolidifiedBlockNum);
12691272
}
1270-
getDynamicPropertiesStore().saveLatestSolidifiedBlockNum(latestSolidifiedBlockNum);
1271-
logger.info("update solid block, num = {}", latestSolidifiedBlockNum);
12721273
}
12731274

12741275
public void updateFork() {

‎src/main/java/org/tron/core/db2/core/SnapshotManager.java‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.google.common.primitives.Bytes;
88
import com.google.common.primitives.Ints;
99
import com.google.common.primitives.Longs;
10+
import com.sun.org.apache.xpath.internal.WhitespaceStrippingElementMatcher;
1011
import lombok.Getter;
1112
import lombok.extern.slf4j.Slf4j;
1213
import org.iq80.leveldb.WriteOptions;
@@ -199,6 +200,24 @@ public void shutdown() {
199200
@Override
200201
public void updateSolidity(long oldSolidifiedBlockNum, long newSolidifedBlockNum) {
201202
long diff = newSolidifedBlockNum - oldSolidifiedBlockNum;
203+
204+
// debug begin
205+
RevokingDBWithCachingNewValue debugDB = dbs.get(0);
206+
Snapshot next = debugDB.getHead().getRoot();
207+
List<Snapshot> snapshots = new ArrayList<>();
208+
while (next != null) {
209+
snapshots.add(next);
210+
next = next.getNext();
211+
}
212+
logger.info("****updateSolidity db:{}, solid:{}, head:{}, next:{}, all snapshot:{}",
213+
debugDB.getDbName(),
214+
debugDB.getHead().getSolidity(),
215+
debugDB.getHead(),
216+
debugDB.getHead().getSolidity().getNext(),
217+
snapshots
218+
);
219+
// debug end
220+
202221
for (int i = 0; i < diff; i++) {
203222
++flushCount;
204223
for (RevokingDBWithCachingNewValue db : dbs) {

0 commit comments

Comments
 (0)