Repository: valkey-io/valkey
File: src/server.h (C/C++)

Code before:

#define CHILD_TYPE_NONE 0
#define CHILD_TYPE_RDB 1
#define CHILD_TYPE_AOF 2
#define CHILD_TYPE_LDB 3
#define CHILD_TYPE_MODULE 4

typedef enum childInfoType {
    CHILD_INFO_TYPE_CURRENT_INFO,
    CHILD_INFO_TYPE_AOF_COW_SIZE,
    CHILD_INFO_TYPE_RDB_COW_SIZE,
    CHILD_INFO_TYPE_MODULE_COW_SIZE
} childInfoType;

struct valkeyServer {
    /* General */
    pid_t pid;                /* Main process pid. */
    pthread_t main_thread_id; /* Main thread id */
    char *configfile;         /* Absolute config file path, or NULL */
    char *executable;         /* Absolute executable file path. */
    char **exec_argv;         /* Executable argv vector (copy). */
    mode_t umask;             /* The umask value of the process on startup */
    int hz;                   /* serverCron() calls frequency in hertz */
    int clients_hz;           /* clientsTimeProc() frequency in hertz */
    int in_fork_child;        /* indication that this is a fork child */
    serverDb **db;
    hashtable *commands;      /* Command table */
    hashtable *orig_commands; /* Command table before command renaming. */
    aeEventLoop *el;
    _Atomic AeIoState io_poll_state;     /* Indicates the state of the IO polling. */
    int io_ae_fired_events;              /* Number of poll events received by the IO thread. */
    rax *errors;                         /* Errors table */
    unsigned int lruclock;               /* Clock for LRU eviction */
    volatile sig_atomic_t shutdown_asap; /* Shutdown ordered by signal handler. */
    mstime_t shutdown_mstime;            /* Timestamp to limit graceful shutdown. */
    int last_sig_received;               /* Indicates the last SIGNAL received, if any (e.g., SIGINT or SIGTERM). */
    int shutdown_flags;                  /* Flags passed to prepareForShutdown(). */
    int activerehashing;                 /* Incremental rehash in serverCron() */
    int active_defrag_cpu_percent;       /* Current desired CPU percentage for active defrag */
    char *pidfile;                       /* PID file path */
    int arch_bits;                       /* 32 or 64 depending on sizeof(long) */
    int cronloops;                       /* Number of times the cron function run */
    char runid[CONFIG_RUN_ID_SIZE + 1];  /* ID always different at every exec. */
    int sentinel_mode;                   /* True if this instance is a Sentinel. */
    size_t initial_memory_usage;         /* Bytes used after initialization. */
    int always_show_logo;                /* Show logo even for non-stdout logging. */
    int in_exec;                         /* Are we inside EXEC? */
    int busy_module_yield_flags;         /* Are we inside a busy module? (triggered by RM_Yield). see BUSY_MODULE_YIELD_ flags. */
    const char *busy_module_yield_reply; /* When non-null, we are inside RM_Yield. */
    char *ignore_warnings;               /* Config: warnings that should be ignored. */
    int client_pause_in_transaction;     /* Was a client pause executed during this Exec? */

Review comment (suggestion):
```suggestion
    serverDb **db;            /* each db created when it's first used */
```

Code after:

#define CHILD_TYPE_NONE 0
#define CHILD_TYPE_RDB 1
#define CHILD_TYPE_AOF 2
#define CHILD_TYPE_LDB 3
#define CHILD_TYPE_MODULE 4

typedef enum childInfoType {
    CHILD_INFO_TYPE_CURRENT_INFO,
    CHILD_INFO_TYPE_AOF_COW_SIZE,
    CHILD_INFO_TYPE_RDB_COW_SIZE,
    CHILD_INFO_TYPE_MODULE_COW_SIZE
} childInfoType;

struct valkeyServer {
    /* General */
    pid_t pid;                /* Main process pid. */
    pthread_t main_thread_id; /* Main thread id */
    char *configfile;         /* Absolute config file path, or NULL */
    char *executable;         /* Absolute executable file path. */
    char **exec_argv;         /* Executable argv vector (copy). */
    mode_t umask;             /* The umask value of the process on startup */
    int hz;                   /* serverCron() calls frequency in hertz */
    int clients_hz;           /* clientsTimeProc() frequency in hertz */
    int in_fork_child;        /* indication that this is a fork child */
    serverDb **db;            /* each db created when it's first used */
    hashtable *commands;      /* Command table */
    hashtable *orig_commands; /* Command table before command renaming. */
    aeEventLoop *el;
    _Atomic AeIoState io_poll_state;     /* Indicates the state of the IO polling. */
    int io_ae_fired_events;              /* Number of poll events received by the IO thread. */
    rax *errors;                         /* Errors table */
    unsigned int lruclock;               /* Clock for LRU eviction */
    volatile sig_atomic_t shutdown_asap; /* Shutdown ordered by signal handler. */
    mstime_t shutdown_mstime;            /* Timestamp to limit graceful shutdown. */
    int last_sig_received;               /* Indicates the last SIGNAL received, if any (e.g., SIGINT or SIGTERM). */
    int shutdown_flags;                  /* Flags passed to prepareForShutdown(). */
    int activerehashing;                 /* Incremental rehash in serverCron() */
    int active_defrag_cpu_percent;       /* Current desired CPU percentage for active defrag */
    char *pidfile;                       /* PID file path */
    int arch_bits;                       /* 32 or 64 depending on sizeof(long) */
    int cronloops;                       /* Number of times the cron function run */
    char runid[CONFIG_RUN_ID_SIZE + 1];  /* ID always different at every exec. */
    int sentinel_mode;                   /* True if this instance is a Sentinel. */
    size_t initial_memory_usage;         /* Bytes used after initialization. */
    int always_show_logo;                /* Show logo even for non-stdout logging. */
    int in_exec;                         /* Are we inside EXEC? */
    int busy_module_yield_flags;         /* Are we inside a busy module? (triggered by RM_Yield). see BUSY_MODULE_YIELD_ flags. */
    const char *busy_module_yield_reply; /* When non-null, we are inside RM_Yield. */
    char *ignore_warnings;               /* Config: warnings that should be ignored. */
    int client_pause_in_transaction;     /* Was a client pause executed during this Exec? */