Mark that we are loading in the global state and setup the fields * needed to provide loading stats. */
| 2330 | /* Mark that we are loading in the global state and setup the fields |
| 2331 | * needed to provide loading stats. */ |
| 2332 | void startLoading(size_t size, int rdbflags) { |
| 2333 | /* Load the DB */ |
| 2334 | server.loading = 1; |
| 2335 | server.loading_start_time = time(NULL); |
| 2336 | server.loading_loaded_bytes = 0; |
| 2337 | server.loading_total_bytes = size; |
| 2338 | server.loading_rdb_used_mem = 0; |
| 2339 | blockingOperationStarts(); |
| 2340 | |
| 2341 | /* Fire the loading modules start event. */ |
| 2342 | int subevent; |
| 2343 | if (rdbflags & RDBFLAGS_AOF_PREAMBLE) |
| 2344 | subevent = REDISMODULE_SUBEVENT_LOADING_AOF_START; |
| 2345 | else if(rdbflags & RDBFLAGS_REPLICATION) |
| 2346 | subevent = REDISMODULE_SUBEVENT_LOADING_REPL_START; |
| 2347 | else |
| 2348 | subevent = REDISMODULE_SUBEVENT_LOADING_RDB_START; |
| 2349 | moduleFireServerEvent(REDISMODULE_EVENT_LOADING,subevent,NULL); |
| 2350 | } |
| 2351 | |
| 2352 | /* Mark that we are loading in the global state and setup the fields |
| 2353 | * needed to provide loading stats. |
no test coverage detected