8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 20:03:02 +01:00

Fixed CORE-2478: mon$memory_usage: Incorrect database memory reported on CS and SC.

This commit is contained in:
dimitr 2009-08-19 09:35:03 +00:00
parent f309fcc1e6
commit bcebd6f026
2 changed files with 28 additions and 2 deletions

View File

@ -224,6 +224,9 @@ Monitoring tables
record has these columns populated with non-zero values. Small allocations don't go record has these columns populated with non-zero values. Small allocations don't go
to the OS level, they're redirected to the database memory pool instead. So usually to the OS level, they're redirected to the database memory pool instead. So usually
only MON$DATABASE and memory-bound objects point to non-zero "allocated" values. only MON$DATABASE and memory-bound objects point to non-zero "allocated" values.
- the counter set linked to a record in MON$DATABASE reports the memory shared among
all attachments. In Classic and SuperClassic, these counters are zero meaning no
shared cache in these architectures.
6) For table MON$CONTEXT_VARIABLES: 6) For table MON$CONTEXT_VARIABLES:
- column MON$ATTACHMENT_ID contains a valid ID only for session-level context variables. - column MON$ATTACHMENT_ID contains a valid ID only for session-level context variables.

View File

@ -65,6 +65,12 @@
#include <windows.h> #include <windows.h>
#endif #endif
#ifdef SUPERSERVER
const bool sharedDbb = true;
#else
const bool sharedDbb = false;
#endif
using namespace Firebird; using namespace Firebird;
using namespace Jrd; using namespace Jrd;
@ -880,7 +886,16 @@ void DatabaseSnapshot::putDatabase(const Database* database, Writer& writer, int
record.storeGlobalId(f_mon_db_stat_id, getGlobalId(stat_id)); record.storeGlobalId(f_mon_db_stat_id, getGlobalId(stat_id));
writer.putRecord(record); writer.putRecord(record);
putStatistics(database->dbb_stats, writer, stat_id, stat_database); putStatistics(database->dbb_stats, writer, stat_id, stat_database);
putMemoryUsage(database->dbb_memory_stats, writer, stat_id, stat_database);
if (sharedDbb)
{
putMemoryUsage(database->dbb_memory_stats, writer, stat_id, stat_database);
}
else
{
MemoryStats zero_stats;
putMemoryUsage(zero_stats, writer, stat_id, stat_database);
}
} }
@ -945,7 +960,15 @@ bool DatabaseSnapshot::putAttachment(const Attachment* attachment, Writer& write
record.storeGlobalId(f_mon_att_stat_id, getGlobalId(stat_id)); record.storeGlobalId(f_mon_att_stat_id, getGlobalId(stat_id));
writer.putRecord(record); writer.putRecord(record);
putStatistics(attachment->att_stats, writer, stat_id, stat_attachment); putStatistics(attachment->att_stats, writer, stat_id, stat_attachment);
putMemoryUsage(attachment->att_memory_stats, writer, stat_id, stat_attachment);
if (sharedDbb)
{
putMemoryUsage(attachment->att_memory_stats, writer, stat_id, stat_attachment);
}
else
{
putMemoryUsage(attachment->att_database->dbb_memory_stats, writer, stat_id, stat_attachment);
}
return true; return true;
} }