MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _PersistenceEventHandler

Function _PersistenceEventHandler

src/module_event_handlers.c:309–334  ·  view source on GitHub ↗

server persistence event handler

Source from the content-addressed store, hash-verified

307
308// server persistence event handler
309static void _PersistenceEventHandler(RedisModuleCtx *ctx, RedisModuleEvent eid,
310 uint64_t subevent, void *data) {
311 if(INTERMEDIATE_GRAPHS) {
312 // check for half-baked graphs
313 // indicated by `aux_field_counter` > 0
314 // in such case we do not want to either perform backup nor do we want to
315 // synchronize our replica, as such we're aborting by existing
316 // assuming we're running on a fork process
317 if(Globals_Get_ProcessIsChild()) {
318 // intermediate graph(s) detected, exit!
319 RedisModule_Log(NULL, REDISMODULE_LOGLEVEL_WARNING,
320 "RedisGraph - aborting BGSAVE, detected intermediate graph(s)");
321
322 exit(255);
323 } else {
324 // don't mess with the keyspace if we have half-baked graphs
325 return;
326 }
327 }
328
329 if(_IsEventPersistenceStart(eid, subevent)) {
330 _CreateKeySpaceMetaKeys(ctx);
331 } else if(_IsEventPersistenceEnd(eid, subevent)) {
332 _ClearKeySpaceMetaKeys(ctx, false);
333 }
334}
335
336// Perform clean-up upon server shutdown.
337static void _ShutdownEventHandler

Callers

nothing calls this directly

Calls 5

_IsEventPersistenceStartFunction · 0.85
_CreateKeySpaceMetaKeysFunction · 0.85
_IsEventPersistenceEndFunction · 0.85
_ClearKeySpaceMetaKeysFunction · 0.85

Tested by

no test coverage detected