Skip to content

feat(log): optimize event service logs #6206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions framework/src/main/java/org/tron/core/db/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2107,8 +2107,6 @@ private void startEventSubscribing() {

private void postSolidityFilter(final long oldSolidNum, final long latestSolidifiedBlockNumber) {
if (oldSolidNum >= latestSolidifiedBlockNumber) {
logger.warn("Post solidity filter failed, oldSolidity: {} >= latestSolidity: {}.",
oldSolidNum, latestSolidifiedBlockNumber);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public boolean checkHelloMessage(HelloMessage message, Channel channel) {
return false;
}

if (getPeerCountByAddress(msg.getAddress()) >= MAX_PEER_COUNT_PER_ADDRESS) {
if (getPeerCountByAddress(msg.getAddress()) > MAX_PEER_COUNT_PER_ADDRESS) {
logger.warn("HelloMessage from {}, the number of peers of {} exceeds {}.",
channel.getInetAddress(),
ByteArray.toHexString(msg.getAddress().toByteArray()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void init(BlockCapsule.BlockId blockId) {
}

public static void add(BlockEvent blockEvent) throws EventException {
logger.info("Add block event, {}", blockEvent.getBlockId().getString(),
logger.info("Add block event, {}, {}", blockEvent.getBlockId().getString(),
blockEvent.getParentId().getString());
if (blockEventMap.get(blockEvent.getParentId()) == null) {
throw new EventException("unlink BlockEvent, "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public void init() {
executor.scheduleWithFixedDelay(() -> {
try {
load();
} catch (Exception exception) {
} catch (Exception e) {
close();
logger.error("Spread thread error", exception);
logger.error("Event load service fail.", e);
}
}, 100, 100, TimeUnit.MILLISECONDS);
logger.info("Event load service start.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ private void syncEvent() {
}
initEventService(manager.getChainBaseManager().getBlockIdByNum(endNum));
} catch (InterruptedException e1) {
logger.warn("Sync event interrupted.");
logger.warn("History event service interrupted.");
Thread.currentThread().interrupt();
} catch (Exception e2) {
logger.error("Sync event failed.", e2);
logger.error("History event service fail.", e2);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void init() {
try {
work();
} catch (Exception e) {
logger.info("Real-time event service fail. {}", e);
logger.error("Realtime event service fail.", e);
}
}, 1, 1, TimeUnit.SECONDS);
logger.info("Realtime event service start.");
Expand Down Expand Up @@ -81,7 +81,7 @@ public void flush(BlockEvent blockEvent, boolean isRemove) {
&& !instance.isTransactionLogTriggerSolidified()
&& !isRemove) {
if (blockEvent.getTransactionLogTriggerCapsules() == null) {
logger.info("TransactionLogTriggerCapsules is null. {}",
logger.warn("TransactionLogTriggerCapsules is null. {}",
blockEvent.getBlockId().getString());
} else {
blockEvent.getTransactionLogTriggerCapsules().forEach(v ->
Expand All @@ -91,7 +91,7 @@ public void flush(BlockEvent blockEvent, boolean isRemove) {

if (instance.isContractEventTriggerEnable()) {
if (blockEvent.getSmartContractTrigger() == null) {
logger.info("SmartContractTrigger is null. {}", blockEvent.getBlockId().getString());
logger.warn("SmartContractTrigger is null. {}", blockEvent.getBlockId().getString());
} else {
blockEvent.getSmartContractTrigger().getContractEventTriggers().forEach(v -> {
v.setTriggerName(Trigger.CONTRACTEVENT_TRIGGER_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public void init() {
executor.scheduleWithFixedDelay(() -> {
try {
work();
} catch (Exception exception) {
logger.error("Spread thread error", exception);
} catch (Exception e) {
logger.error("Solid event service fail.", e);
}
}, 1, 1, TimeUnit.SECONDS);
logger.info("Solid event service start.");
Expand Down Expand Up @@ -67,7 +67,7 @@ public void flush(BlockEvent blockEvent) {

if (instance.isTransactionLogTriggerEnable() && instance.isTransactionLogTriggerSolidified()) {
if (blockEvent.getTransactionLogTriggerCapsules() == null) {
logger.info("TransactionLogTrigger is null. {}", blockEvent.getBlockId());
logger.warn("TransactionLogTrigger is null. {}", blockEvent.getBlockId());
} else {
blockEvent.getTransactionLogTriggerCapsules().forEach(v ->
manager.getTriggerCapsuleQueue().offer(v));
Expand All @@ -76,7 +76,7 @@ public void flush(BlockEvent blockEvent) {

if (instance.isSolidityEventTriggerEnable()) {
if (blockEvent.getSmartContractTrigger() == null) {
logger.info("SmartContractTrigger is null. {}", blockEvent.getBlockId());
logger.warn("SmartContractTrigger is null. {}", blockEvent.getBlockId());
} else {
blockEvent.getSmartContractTrigger().getContractEventTriggers().forEach(v -> {
v.setTriggerName(Trigger.SOLIDITYEVENT_TRIGGER_NAME);
Expand All @@ -100,7 +100,7 @@ public void flush(BlockEvent blockEvent) {

if (instance.isSolidityTriggerEnable()) {
if (blockEvent.getSolidityTriggerCapsule() == null) {
logger.info("SolidityTrigger is null. {}", blockEvent.getBlockId());
logger.warn("SolidityTrigger is null. {}", blockEvent.getBlockId());
} else {
manager.getTriggerCapsuleQueue().offer(blockEvent.getSolidityTriggerCapsule());
}
Expand Down