MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / startLoading

Function startLoading

src/rdb.cpp:2606–2624  ·  view source on GitHub ↗

Mark that we are loading in the global state and setup the fields * needed to provide loading stats. */

Source from the content-addressed store, hash-verified

2604/* Mark that we are loading in the global state and setup the fields
2605 * needed to provide loading stats. */
2606void startLoading(size_t size, int rdbflags) {
2607 /* Load the DB */
2608 g_pserver->loading = (rdbflags & RDBFLAGS_REPLICATION) ? LOADING_REPLICATION : LOADING_BOOT;
2609 g_pserver->loading_start_time = time(NULL);
2610 g_pserver->loading_loaded_bytes = 0;
2611 g_pserver->loading_total_bytes = size;
2612 g_pserver->loading_rdb_used_mem = 0;
2613 blockingOperationStarts();
2614
2615 /* Fire the loading modules start event. */
2616 int subevent;
2617 if (rdbflags & RDBFLAGS_AOF_PREAMBLE)
2618 subevent = REDISMODULE_SUBEVENT_LOADING_AOF_START;
2619 else if(rdbflags & RDBFLAGS_REPLICATION)
2620 subevent = REDISMODULE_SUBEVENT_LOADING_REPL_START;
2621 else
2622 subevent = REDISMODULE_SUBEVENT_LOADING_RDB_START;
2623 moduleFireServerEvent(REDISMODULE_EVENT_LOADING,subevent,NULL);
2624}
2625
2626/* Mark that we are loading in the global state and setup the fields
2627 * needed to provide loading stats.

Callers 3

startLoadingFileFunction · 0.85
readSyncBulkPayloadRdbFunction · 0.85
rdbLoadS3CoreFunction · 0.85

Calls 2

blockingOperationStartsFunction · 0.85
moduleFireServerEventFunction · 0.85

Tested by

no test coverage detected