This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch NewAPIMetricsPOC
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/NewAPIMetricsPOC by this push:
new d9f37737f4 Eliminates the dynamic option for maxRecords
d9f37737f4 is described below
commit d9f37737f48964c7a74c2e5ef664c4b466cdf296
Author: Leif Hedstrom <[email protected]>
AuthorDate: Thu Jul 6 22:06:47 2023 -0600
Eliminates the dynamic option for maxRecords
---
include/records/I_RecordsConfig.h | 3 ---
include/records/P_RecCore.h | 2 +-
include/records/P_RecDefs.h | 10 ++++------
plugins/experimental/remap_stats/remap_stats.cc | 3 ---
src/records/RecCore.cc | 9 +--------
src/records/RecUtils.cc | 4 ++--
src/traffic_server/traffic_server.cc | 2 --
7 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/include/records/I_RecordsConfig.h
b/include/records/I_RecordsConfig.h
index 2b16f7c030..df9ea60254 100644
--- a/include/records/I_RecordsConfig.h
+++ b/include/records/I_RecordsConfig.h
@@ -25,9 +25,6 @@
#include "records/P_RecCore.h"
-// This is to manage the librecords table sizes. Not awesome, but better than
the earlier recompiling of ATS requirement...
-extern int max_records_entries;
-
enum RecordRequiredType {
RR_NULL, // config is _not_ required to be defined in records.yaml
RR_REQUIRED // config _is_ required to be defined in record.config
diff --git a/include/records/P_RecCore.h b/include/records/P_RecCore.h
index 062bdec9df..1818ddd2a6 100644
--- a/include/records/P_RecCore.h
+++ b/include/records/P_RecCore.h
@@ -37,7 +37,7 @@
#include <swoc/Errata.h>
// records, record hash-table, and hash-table rwlock
-extern RecRecord *g_records;
+extern RecRecord g_records[REC_MAX_RECORDS];
extern std::unordered_map<std::string, RecRecord *> g_records_ht;
extern ink_rwlock g_records_rwlock;
extern int g_num_records;
diff --git a/include/records/P_RecDefs.h b/include/records/P_RecDefs.h
index f4da85e75a..6755494a97 100644
--- a/include/records/P_RecDefs.h
+++ b/include/records/P_RecDefs.h
@@ -27,12 +27,10 @@
#define REC_MESSAGE_ELE_MAGIC 0xF00DF00D
-// We need at least this many internal record entries for our configurations
and metrics. Any
-// additional slots in librecords will be allocated to the plugin metrics.
These should be
-// updated if we change the internal librecords size significantly.
-#define REC_INTERNAL_RECORDS 1100
-#define REC_DEFAULT_API_RECORDS 1400
-
+// We need at least this many internal record entries for our configurations
and metrics.
+// This may need adjustments if we make significant additions to librecords.
Note that
+// plugins are using their own metrics systems.
+#define REC_MAX_RECORDS 1500
#define REC_CONFIG_UPDATE_INTERVAL_MS 3000
#define REC_REMOTE_SYNC_INTERVAL_MS 5000
diff --git a/plugins/experimental/remap_stats/remap_stats.cc
b/plugins/experimental/remap_stats/remap_stats.cc
index 24d48a811c..dbaa7fb5c0 100644
--- a/plugins/experimental/remap_stats/remap_stats.cc
+++ b/plugins/experimental/remap_stats/remap_stats.cc
@@ -46,9 +46,6 @@ struct config_t {
int txn_slot{-1};
};
-// From "core".... sigh, but we need it for now at least.
-extern int max_records_entries;
-
namespace
{
void
diff --git a/src/records/RecCore.cc b/src/records/RecCore.cc
index 1bf0bd43fe..6dad8eb79e 100644
--- a/src/records/RecCore.cc
+++ b/src/records/RecCore.cc
@@ -36,13 +36,9 @@
#include "tscpp/util/ts_errata.h"
#include "api/Metrics.h"
-// This is needed to manage the size of the librecords record. It can't be
static, because it needs to be modified
-// and used (read) from several binaries / modules.
-int max_records_entries = REC_INTERNAL_RECORDS + REC_DEFAULT_API_RECORDS;
-
static bool g_initialized = false;
-RecRecord *g_records = nullptr;
+RecRecord g_records[REC_MAX_RECORDS];
std::unordered_map<std::string, RecRecord *> g_records_ht;
ink_rwlock g_records_rwlock;
int g_num_records = 0;
@@ -206,9 +202,6 @@ RecCoreInit(Diags *_diags)
g_num_records = 0;
- // initialize record array for our internal stats (this can be reallocated
later)
- g_records = static_cast<RecRecord *>(ats_malloc(max_records_entries *
sizeof(RecRecord)));
-
// initialize record rwlock
ink_rwlock_init(&g_records_rwlock);
diff --git a/src/records/RecUtils.cc b/src/records/RecUtils.cc
index e229a41f6f..53f27afcbf 100644
--- a/src/records/RecUtils.cc
+++ b/src/records/RecUtils.cc
@@ -50,8 +50,8 @@ RecRecordFree(RecRecord *r)
RecRecord *
RecAlloc(RecT rec_type, const char *name, RecDataT data_type)
{
- if (g_num_records >= max_records_entries) {
- Warning("too many stats/configs, please increase max_records_entries using
the --maxRecords command line option");
+ if (g_num_records >= REC_MAX_RECORDS) {
+ Warning("too many stats/configs, please report a bug to
[email protected]");
return nullptr;
}
diff --git a/src/traffic_server/traffic_server.cc
b/src/traffic_server/traffic_server.cc
index d155bc0042..c4e7c7e315 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -206,8 +206,6 @@ static ArgumentDescription argument_descriptions[] = {
{"disable_freelist", 'f', "Disable the freelist memory allocator",
"T",
&cmd_disable_freelist, "PROXY_DPRINTF_LEVEL", nullptr},
{"disable_pfreelist", 'F', "Disable the freelist memory allocator in
ProxyAllocator", "T",
&cmd_disable_pfreelist,
"PROXY_DPRINTF_LEVEL",
nullptr},
- {"maxRecords", 'm', "Max number of librecords metrics and
configurations (default & minimum: 1600)", "I",
&max_records_entries,
- "PROXY_MAX_RECORDS",
nullptr},
#if TS_HAS_TESTS
{"regression", 'R', "Regression Level (quick:1..long:3)",
"I",
®ression_level, "PROXY_REGRESSION", nullptr},