Mark that we are loading in the global state and setup the fields * needed to provide loading stats. */
| 2604 | /* Mark that we are loading in the global state and setup the fields |
| 2605 | * needed to provide loading stats. */ |
| 2606 | void 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. |
no test coverage detected