sf_logger_set_schedule_entry change to sf_logger_set_schedule_entries

master
YuQing 2025-09-26 19:57:03 +08:00
parent aef9d803d1
commit 0f75b039f6
4 changed files with 11 additions and 11 deletions

View File

@ -96,6 +96,8 @@
#define SF_BINLOG_SOURCE_USER 'U' //by user call
#define SF_BINLOG_SOURCE_REPLAY 'R' //by binlog replay
#define SF_LOG_SCHEDULE_ENTRIES_COUNT 3
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -782,15 +782,13 @@ int sf_setup_signal_handler()
return 0;
}
#define LOG_SCHEDULE_ENTRIES_COUNT 3
int sf_startup_schedule(pthread_t *schedule_tid)
{
ScheduleArray scheduleArray;
ScheduleEntry scheduleEntries[LOG_SCHEDULE_ENTRIES_COUNT];
ScheduleEntry scheduleEntries[SF_LOG_SCHEDULE_ENTRIES_COUNT];
scheduleArray.entries = scheduleEntries;
sf_setup_schedule(&g_log_context, &g_sf_global_vars.error_log,
sf_logger_setup_schedule(&g_log_context, &g_sf_global_vars.error_log,
&scheduleArray);
return sched_start(&scheduleArray, schedule_tid,
g_sf_global_vars.thread_stack_size, (bool * volatile)
@ -801,7 +799,7 @@ int sf_add_slow_log_schedule(SFSlowLogContext *slowlog_ctx)
{
int result;
ScheduleArray scheduleArray;
ScheduleEntry scheduleEntries[LOG_SCHEDULE_ENTRIES_COUNT];
ScheduleEntry scheduleEntries[SF_LOG_SCHEDULE_ENTRIES_COUNT];
if (!slowlog_ctx->cfg.enabled) {
return 0;
@ -814,8 +812,8 @@ int sf_add_slow_log_schedule(SFSlowLogContext *slowlog_ctx)
}
scheduleArray.entries = scheduleEntries;
sf_setup_schedule(&slowlog_ctx->ctx, &slowlog_ctx->cfg.log_cfg,
&scheduleArray);
sf_logger_setup_schedule(&slowlog_ctx->ctx, &slowlog_ctx->
cfg.log_cfg, &scheduleArray);
return sched_add_entries(&scheduleArray);
}

View File

@ -281,7 +281,7 @@ int sf_logger_init(LogContext *pContext, const char *filename_prefix)
return 0;
}
ScheduleEntry *sf_logger_set_schedule_entry(struct log_context *pContext,
ScheduleEntry *sf_logger_set_schedule_entries(struct log_context *pContext,
SFLogConfig *log_cfg, ScheduleEntry *pScheduleEntry)
{
INIT_SCHEDULE_ENTRY(*pScheduleEntry, sched_generate_next_id(),

View File

@ -96,14 +96,14 @@ void sf_parse_cmd_option_bool(int argc, char *argv[],
int sf_logger_init(LogContext *pContext, const char *filename_prefix);
ScheduleEntry *sf_logger_set_schedule_entry(struct log_context *pContext,
ScheduleEntry *sf_logger_set_schedule_entries(struct log_context *pContext,
SFLogConfig *log_cfg, ScheduleEntry *pScheduleEntry);
static inline void sf_setup_schedule(struct log_context *pContext,
static inline void sf_logger_setup_schedule(struct log_context *pContext,
SFLogConfig *log_cfg, ScheduleArray *scheduleArray)
{
ScheduleEntry *scheduleEntry;
scheduleEntry = sf_logger_set_schedule_entry(pContext,
scheduleEntry = sf_logger_set_schedule_entries(pContext,
log_cfg, scheduleArray->entries);
scheduleArray->count = scheduleEntry - scheduleArray->entries;
}