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

Function InitServerLast

src/server.cpp:4137–4155  ·  view source on GitHub ↗

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 */

Source from the content-addressed store, hash-verified

4135 * Thread Local Storage initialization collides with dlopen call.
4136 * see: https://sourceware.org/bugzilla/show_bug.cgi?id=19329 */
4137void 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

Callers 1

mainFunction · 0.85

Calls 5

moduleFireServerEventFunction · 0.85
bioInitFunction · 0.85
set_jemalloc_bg_threadFunction · 0.85
zmalloc_used_memoryFunction · 0.85

Tested by

no test coverage detected