Description:
This document explains about threshold for memory message.
A.10 MySQL 5.7 FAQ: NDB Cluster
How much RAM do I need to use NDB Cluster? Is it possible to use disk memory at all?
https://dev.mysql.com/doc/refman/5.6/en/faqs-mysql-cluster.html#faq-cluster-what-memory-ne...
https://dev.mysql.com/doc/refman/5.7/en/faqs-mysql-cluster.html#faq-cluster-what-memory-ne...
In addition, warnings are written to the cluster log when 80% of available DataMemory or IndexMemory is in use, and again when usage reaches 85%, 90%, and so on.
But there is no 85% threshold in source code. only 100, 99, 90, 80, 0.
src\kernel\blocks\cmvmi\Cmvmi.cpp
3208 void
3209 Cmvmi::execCONTINUEB(Signal* signal)
3210 {
3211 switch(signal->theData[0]){
3212 case ZREPORT_MEMORY_USAGE:
3213 {
3214 jam();
3215 Uint32 cnt = signal->theData[1];
3216 Uint32 tup_percent_last = signal->theData[2];
3217 Uint32 acc_percent_last = signal->theData[3];
3218
3219 {
3220 // Data memory threshold
3221 Resource_limit rl;
3222 m_ctx.m_mm.get_resource_limit(RG_DATAMEM, rl);
3223
3224 const Uint32 tup_pages_used = rl.m_curr - f_accpages;
3225 const Uint32 tup_pages_total = rl.m_min - f_accpages;
3226 const Uint32 tup_percent_now = calc_percent(tup_pages_used,
3227 tup_pages_total);
3228
3229 int passed;
3230 if ((passed = check_threshold(tup_percent_last, tup_percent_now)) != -1)
3231 {
3232 jam();
3233 reportDMUsage(signal, tup_percent_now >= tup_percent_last ? 1 : -1);
3234 tup_percent_last = passed;
3235 }
3236 }
↓
check_threashould()
↓
3183 static int
3184 check_threshold(Uint32 last, Uint32 now)
3185 {
3186 assert(last <= 100 && now <= 100);
3187
3188 static const Uint32 thresholds[] = { 100, 99, 90, 80, 0 };
3189
3190 Uint32 passed = 0; /* Initialised to silence compiler warning */
3191 for (size_t i = 0; i < NDB_ARRAY_SIZE(thresholds); i++)
3192 {
3193 if (now >= thresholds[i])
3194 {
3195 passed = thresholds[i];
3196 break;
3197 }
3198 }
3199 assert(passed <= 100);
3200
3201 if (passed == last)
3202 return -1; // Already reported this level
3203
3204 return passed;
3205 }
How to repeat:
Make an environment for testing and cross threshold.
Suggested fix:
In addition, warnings are written to the cluster log when 80% of available DataMemory or IndexMemory is in use, and again when usage reaches 85%, 90%, and so on.
↓
In addition, warnings are written to the cluster log when 80% of available DataMemory or IndexMemory is in use, and again when usage crosses %90, and so on.
There is no FAQ for MySQL Cluster 8.0.
https://dev.mysql.com/doc/refman/5.7/en/faqs-mysql-cluster.html#faq-cluster-what-memory-ne...
But from 7.3 to 8.0, there is the explanation that system variable 'MemReportFrequency', like this.
The minimum value—which is also the default value—is 0, in which case memory reports are logged only when memory usage reaches certain percentages (80%, 90%, and 100%), as mentioned in the discussion of statistics events in Section 21.5.6.2, “NDB Cluster Log Events”.
https://dev.mysql.com/doc/refman/8.0/en/mysql-cluster-ndbd-definition.html#ndbparam-ndbd-m...
https://dev.mysql.com/doc/refman/5.7/en/mysql-cluster-ndbd-definition.html#ndbparam-ndbd-m...
https://dev.mysql.com/doc/refman/5.6/en/mysql-cluster-ndbd-definition.html#ndbparam-ndbd-m...
This explanation don't mention about 99%. I supposed that this explanation added at MySQL Cluster 6.4.
https://bugs.mysql.com/bug.php?id=42215
https://lists.mysql.com/commits/65918
In this bug, threshoulds are added, but thresholds are '100,90,80,0', and no 99.
So I think that the explanation should be modified like this.(reaches -> crosses, add 99%)
[Now]
The minimum value—which is also the default value—is 0, in which case memory reports are logged only when memory usage reaches certain percentages (80%, 90%, and 100%), as mentioned in the discussion of statistics events in Section 21.5.6.2, “NDB Cluster Log Events”.
[Should be]
The minimum value—which is also the default value—is 0, in which case memory reports are logged only when memory usage crosses certain percentages (80%, 90%, 99% and 100%), as mentioned in the discussion of statistics events in Section 21.5.6.2, “NDB Cluster Log Events”.