chore: change Namespaces to be a global pointer (#4032)

* chore: change Namespaces to be a global pointer

Before the namespaces object was defined globally.
However it has non-trivial d'tor that is being called after main exits.
It's quite dangerous to have global non-POD objects being defined globally.
For example, if we used LOG(INFO) inside the Clear function , that would crash dragonfly on exit.

Ths PR changes it to be a global pointer.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2024-11-10 12:45:53 +02:00 committed by GitHub
parent 9366c67464
commit be96e6cf99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 76 additions and 71 deletions

View file

@ -49,6 +49,7 @@ class Transaction;
class EngineShard;
class ConnectionState;
class Interpreter;
class Namespaces;
struct LockTagOptions {
bool enabled = false;
@ -132,6 +133,8 @@ extern std::atomic_uint64_t rss_mem_peak;
extern size_t max_memory_limit;
extern Namespaces* namespaces;
// version 5.11 maps to 511 etc.
// set upon server start.
extern unsigned kernel_version;