-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
IGNITE-18534 The WalWritingRate metric is not calculated when walMode is LOG_ONLY or BACKGROUND #10508
Conversation
7363a71
to
4c7c6be
Compare
.setWalArchivePath(DFLT_WAL_PATH) | ||
.setWalSegments(10) | ||
.setWalSegmentSize((int)(1 * MULTIPLICATOR)) | ||
.setMaxWalArchiveSize(20 * MULTIPLICATOR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
20 * MB more clear than your proposal, i suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, MULTIPLICATOR i use for debug, this is not the final PR, this is a PR for questions.
- Is this a good fix?
- Write a test that will check the correctness of the calculation of this metric?
The current test is a reproducer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
bbab9ed
to
dd966fa
Compare
List<Long> walWritingRates = new ArrayList<>(); | ||
|
||
long lastSegment = walMgr(ignite).currentSegment() + MAX_SEGMENTS; | ||
long prewSegment = walMgr(ignite).currentSegment(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: prew -> prev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 0_o
*/ | ||
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { | ||
//for debug | ||
LogExporterSpi exporterSpi = new LogExporterSpi(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we can remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
/** | ||
* {@inheritDoc} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be one line comment like in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
/** | ||
* {@inheritDoc} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be one line comment like in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
/** | ||
* Small report for debug. | ||
*/ | ||
private static final Map<String, List<Long>> report = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
...core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java
Show resolved
Hide resolved
/** | ||
* MULTIPLICATOR. | ||
*/ | ||
private static final long MULTIPLICATOR = U.MB; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use U.MB everywhere in the test without additional review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted it
/** | ||
* Тumber of segments. | ||
*/ | ||
private static final int MAX_SEGMENTS = 20; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this much segements in the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the test, the value of the metric is taken after the segment is filled.
Decreased to 1 to speed up test execution.
It seemed more correct to get the value of the metric by filling the segment than by reaching some time, for example, 1 second after the start of recording.
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override protected void afterTestsStopped() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
… is LOG_ONLY or BACKGROUND
8638ceb
to
667018a
Compare
8ae221c
to
baa46c0
Compare
new DataStorageConfiguration() | ||
.setMetricsEnabled(true) | ||
.setWalArchivePath(DFLT_WAL_PATH) | ||
.setWalSegmentSize(1 * 1024 * 1024) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 * 1024 * 1024 -> U.MB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
/** {@inheritDoc} */ | ||
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { | ||
return super.getConfiguration(igniteInstanceName) | ||
.setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed and replaced with ignite.getOrCreateCache
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
AtomicLong key = new AtomicLong(); | ||
List<Long> walWritingRates = new ArrayList<>(); | ||
|
||
long lastSegment = walMgr(ignite).currentSegment() + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's extract walMgr(ignite)
into variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted it
AtomicLong key = new AtomicLong(); | ||
List<Long> walWritingRates = new ArrayList<>(); | ||
|
||
long lastSegment = walMgr(ignite).currentSegment() + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we don't need to care about segments here.
Le'ts just do the following:
long k = 0;
for (; k<100; k++) {
long[] arr = new long[64];
Arrays.fill(arr, k);
ignite.getOrCreateCache(DEFAULT_CACHE_NAME).put(key, arr);
Long writingRate = metricRegistry(ignite.name(), "io", "datastorage").getAttribute("WalWritingRate");
if (writingRate != null && writingRate > 0)
break;
}
assertTrue(k < 100);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
.setDataStorageConfiguration( | ||
new DataStorageConfiguration() | ||
.setMetricsEnabled(true) | ||
.setWalArchivePath(DFLT_WAL_PATH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need WalArchivePath
for this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, deleted
public class IoDatastorageMetricsTest extends GridCommonAbstractTest { | ||
|
||
/** | ||
* WALMode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be oneline comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
public WALMode walMode; | ||
|
||
/** | ||
* WALMode values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be oneline comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
import static org.junit.Assert.assertNotEquals; | ||
|
||
/** | ||
* The test shows that the WalWritingRate metric is not calculated when walMode is in (LOG_ONLY, BACKGROUND). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test checks that WalWritingRate
metric updated in all WAL modes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
...core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java
Show resolved
Hide resolved
bd62026
to
b8a2a56
Compare
* The test shows that the WalWritingRate metric is not calculated when walMode in all modes. | ||
*/ | ||
@Test | ||
public void WalWritingRate() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, rename WalWritingRate
to testWalWritingRate
or walWritingRate
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
9562a72
to
d81c5bb
Compare
...core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java
Show resolved
Hide resolved
...core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java
Show resolved
Hide resolved
...core/src/test/java/org/apache/ignite/internal/processors/cache/IoDatastorageMetricsTest.java
Show resolved
Hide resolved
|
||
ignite.getOrCreateCache(DEFAULT_CACHE_NAME).put(i, arr); | ||
|
||
writingRate = (long)metricRegistry(ignite.name(), "io", "datastorage").getAttribute("WalWritingRate"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line after this required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
5dde17e
to
f6992ef
Compare
… is LOG_ONLY or BACKGROUND
d9aebaf
to
b3f4668
Compare
Moved the calculation of the metric to another place, which will work in any WalMode.
The result of running the reproducer before and after fixing in https://issues.apache.org/jira/browse/IGNITE-18534.
A commit with a reproducer is not for merging.
The Contribution Checklist
The description explains WHAT and WHY was made instead of HOW.
The following pattern must be used:
IGNITE-XXXX Change summary
whereXXXX
- number of JIRA issue.(see the Maintainers list)
the
green visa
attached to the JIRA ticket (see TC.Bot: Check PR)Notes
If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.