IGNITE-27716: Add group name to DumpReader logs#12840
IGNITE-27716: Add group name to DumpReader logs#12840DEADripER wants to merge 3 commits intoapache:masterfrom
Conversation
| @@ -129,38 +131,40 @@ public DumpReader(DumpReaderConfiguration cfg, IgniteLogger log) { | |||
|
|
|||
| for (Map.Entry<Integer, List<String>> e : grpsCfgs.grpToNodes.entrySet()) { | |||
| int grp = e.getKey(); | |||
There was a problem hiding this comment.
Maybe we should rename grp -> grpId - both here and in the log messages?
There was a problem hiding this comment.
grp must be used for group name in logs.
|
|
||
| grpsToNodes.get(grp).add(meta.folderName()); | ||
|
|
||
| if (!grpIdToName.containsKey(grp) && !grpCaches.isEmpty()) |
There was a problem hiding this comment.
!grpCaches.isEmpty() - this is always true here.
There's a check above in the loop:
if (F.isEmpty(grpCaches))
continue;
| assertTrue("Consuming with group name not found", cnsmLsnr.check()); | ||
| } | ||
| finally { | ||
| stopAllGrids(); |
There was a problem hiding this comment.
stopAllGrids() is already called after the test completes in IgniteCacheDumpSelf2Test#afterTest, so it can be removed here.
| } | ||
| }; | ||
|
|
||
| try { |
There was a problem hiding this comment.
I suggest replacing it with:
assertThrows(null, () -> new DumpReader(
new DumpReaderConfiguration(
DMP_NAME,
null,
ign0.configuration(),
cnsmr,
DFLT_THREAD_CNT,
DFLT_TIMEOUT,
true,
true,
false,
new String[]{GRP},
null,
false,
null
),
testLog
).run(), RuntimeException.class, "trigger error log");
| String id = "test"; | ||
| setLoggerDebugLevel(); | ||
| ListeningTestLogger testLog = new ListeningTestLogger(log); | ||
|
|
||
| LogListener errLsnr = LogListener.matches("Error consuming partition") | ||
| .andMatches("grpName=" + GRP) | ||
| .build(); | ||
| LogListener cnsmLsnr = LogListener.matches("Consuming partition") | ||
| .andMatches("grpName=" + GRP) | ||
| .build(); | ||
| testLog.registerListener(errLsnr); | ||
| testLog.registerListener(cnsmLsnr); |
There was a problem hiding this comment.
| String id = "test"; | |
| setLoggerDebugLevel(); | |
| ListeningTestLogger testLog = new ListeningTestLogger(log); | |
| LogListener errLsnr = LogListener.matches("Error consuming partition") | |
| .andMatches("grpName=" + GRP) | |
| .build(); | |
| LogListener cnsmLsnr = LogListener.matches("Consuming partition") | |
| .andMatches("grpName=" + GRP) | |
| .build(); | |
| testLog.registerListener(errLsnr); | |
| testLog.registerListener(cnsmLsnr); | |
| String id = "test"; | |
| setLoggerDebugLevel(); | |
| ListeningTestLogger testLog = new ListeningTestLogger(log); | |
| LogListener errLsnr = LogListener.matches("Error consuming partition").andMatches("grpName=" + GRP).build(); | |
| LogListener cnsmLsnr = LogListener.matches("Consuming partition").andMatches("grpName=" + GRP).build(); | |
| testLog.registerListener(errLsnr); | |
| testLog.registerListener(cnsmLsnr); |
| IgniteEx ign0 = startGrid(getConfiguration(id) | ||
| .setConsistentId(id) | ||
| .setGridLogger(testLog)); |
There was a problem hiding this comment.
| IgniteEx ign0 = startGrid(getConfiguration(id) | |
| .setConsistentId(id) | |
| .setGridLogger(testLog)); | |
| IgniteEx ign = startGrid(getConfiguration(id).setConsistentId(id).setGridLogger(testLog)); |
| .setGridLogger(testLog)); | ||
|
|
||
| node0.cluster().state(ClusterState.ACTIVE); | ||
| node1.cluster().state(ClusterState.ACTIVE); |
There was a problem hiding this comment.
The cluster is already active, remove this line.
| .times(parts) | ||
| .andMatches("grpName=" + GRP) | ||
| .build(); | ||
| testLog.registerListener(skipLsnr); |
|
|
||
| node0.snapshot().createDump(dumpName0, null).get(getTestTimeout()); | ||
|
|
||
| Thread.sleep(100); |
There was a problem hiding this comment.
| Thread.sleep(100); | |
| U.sleep(100); |
| assertTrue(skipLsnr.check()); | ||
| } | ||
| finally { | ||
| stopAllGrids(); |
| } | ||
|
|
||
| @Override public void onPartition(int grpId, int partId, Iterator<DumpEntry> data) { | ||
| while (data.hasNext()) |
There was a problem hiding this comment.
The test passes locally without this code.
Thank you for submitting the pull request to the Apache Ignite.
In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:
The Contribution Checklist
The description explains WHAT and WHY was made instead of HOW.
The following pattern must be used:
IGNITE-XXXX Change summarywhereXXXX- number of JIRA issue.(see the Maintainers list)
the
green visaattached to the JIRA ticket (see tabPR Checkat TC.Bot - Instance 1 or TC.Bot - Instance 2)Notes
If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.