Some steps in server initialization need to be done last (after modules * are loaded). * Specifically, creation of threads due to a race bug in ld.so, in which * Thread Local Storage initialization collides with dlopen call. * see: https://sourceware.org/bugzilla/show_bug.cgi?id=19329 */
| 4135 | * Thread Local Storage initialization collides with dlopen call. |
| 4136 | * see: https://sourceware.org/bugzilla/show_bug.cgi?id=19329 */ |
| 4137 | void InitServerLast() { |
| 4138 | |
| 4139 | /* We have to initialize storage providers after the cluster has been initialized */ |
| 4140 | moduleFireServerEvent(REDISMODULE_EVENT_LOADING, REDISMODULE_SUBEVENT_LOADING_FLASH_START, NULL); |
| 4141 | for (int idb = 0; idb < cserver.dbnum; ++idb) |
| 4142 | { |
| 4143 | g_pserver->db[idb]->storageProviderInitialize(); |
| 4144 | } |
| 4145 | moduleFireServerEvent(REDISMODULE_EVENT_LOADING, REDISMODULE_SUBEVENT_LOADING_ENDED, NULL); |
| 4146 | |
| 4147 | bioInit(); |
| 4148 | set_jemalloc_bg_thread(cserver.jemalloc_bg_thread); |
| 4149 | g_pserver->initial_memory_usage = zmalloc_used_memory(); |
| 4150 | |
| 4151 | g_pserver->asyncworkqueue = new (MALLOC_LOCAL) AsyncWorkQueue(cserver.cthreads); |
| 4152 | |
| 4153 | // Allocate the repl backlog |
| 4154 | |
| 4155 | } |
| 4156 | |
| 4157 | /* Parse the flags string description 'strflags' and set them to the |
| 4158 | * command 'c'. If the flags are all valid C_OK is returned, otherwise |
no test coverage detected