cmd_process
Command Process
Redis Server Course | Redis Technical Support | Redis Enterprise Server |
---|
Command Process
Redis 명령 처리(실행) 과정을 함수로 표시했습니다.
이 문서는 버전 7.0.8을 기준으로 작성했습니다.
명령 처리 흐름
전파(AOF/Repl) 흐름
관련 함수들
createClient() networking.c
readQueryFromClient() networking.c
processInputBuffer() networking.c
processCommandAndResetClient() networking.c
processCommand() server.c
call() server.c
afterCommand() server.c
propagatePendingCommands() server.c
propagateNow() server.c
alsoPropagate() server.c
shouldPropagate() server.c
redisOpArrayAppend(), redisOpArrayInit(), redisOpArrayFree()
networking.c Functions
소스 파일 networking.c에 있는 함수들입니다. 버전 7.0.8 기준으로 작성했습니다.
- sdsZmallocSize()
- getStringObjectSdsUsedMemory() -> sdsZmallocSize(o->ptr);
- getStringObjectLen() -> sdslen(o->ptr);
- dupClientReplyValue()
- freeClientReplyValue()
- istMatchObjects()
- linkClient() -> listAddNodeTail(server.clients,c);
- clientSetDefaultAuth() -> c->user = DefaultUser;
- authRequired()
- createClient() -> connSetReadHandler(conn, readQueryFromClient);
- installClientWriteHandler() -> connSetWriteHandlerWithBarrier(c->conn, sendReplyToClient, ae_barrier)
- putClientInPendingWriteQueue() -> listAddNodeHead(server.clients_pending_write,c);
- prepareClientToWrite() -> putClientInPendingWriteQueue(c);
- ----- Low level functions to add more data to output buffers. -----
- _addReplyToBuffer() -> memcpy(c->buf+c->bufpos, s, reply_len);
- _addReplyProtoToList()
if (tail) memcpy(tail->buf + tail->used, s, copy);
if (len) memcpy(tail->buf, s, len);
- _addReplyToBufferOrList()
size_t reply_len = _addReplyToBuffer(c,s,len);
if (len > reply_len) _addReplyProtoToList(c,s+reply_len,len-reply_len); - addReply()
prepareClientToWrite()
_addReplyToBufferOrList() - addReplySds()
prepareClientToWrite()
_addReplyToBufferOrList() - addReplyProto()
prepareClientToWrite()
_addReplyToBufferOrList() - addReplyErrorLength()
- afterErrorReply()
- addReplyErrorObject()
- addReplyOrErrorObject()
- addReplyError()
- addReplyErrorSdsEx()
- addReplyErrorSds()
- addReplyErrorSdsSafe()
- addReplyErrorFormatInternal()
- addReplyErrorFormatEx()
- addReplyErrorFormat()
- addReplyErrorArity()
- addReplyErrorExpireTime()
- addReplyStatusLength()
- addReplyStatus()
- addReplyStatusFormat()
- trimReplyUnusedTailSpace()
- addReplyDeferredLen()
- setDeferredReply()
- setDeferredAggregateLen()
- setDeferredArrayLen()
- setDeferredMapLen()
- setDeferredSetLen()
- setDeferredAttributeLen()
- setDeferredPushLen()
- addReplyDouble()
- addReplyBigNum()
- addReplyHumanLongDouble()
- addReplyLongLongWithPrefix()
- addReplyLongLong()
- addReplyAggregateLen()
- addReplyArrayLen()
- addReplyMapLen()
- addReplySetLen()
- addReplyAttributeLen()
- addReplyPushLen()
- addReplyNull()
- addReplyBool()
- addReplyNullArray()
- addReplyBulkLen()
- addReplyBulk()
- addReplyBulkCBuffer()
- addReplyBulkSds()
- setDeferredReplyBulkSds()
- addReplyBulkCString()
- addReplyBulkLongLong()
- addReplyVerbatim()
- addReplyHelp()
- addReplySubcommandSyntaxError()
- AddReplyFromClient()
- deferredAfterErrorReply()
- copyReplicaOutputBuffer()
- clientHasPendingReplies()
- islocalClient()
- clientAcceptHandler()
- acceptCommonHandler()
- acceptTcpHandler()
- acceptTLSHandler()
- acceptUnixHandler()
- freeClientOriginalArgv()
- freeClientArgv()
- disconnectSlaves()
- anyOtherSlaveWaitRdb()
- unlinkClient()
- clearClientConnectionState()
- freeClient()
- freeClientAsync()
- logInvalidUseAndFreeClientAsync()
- beforeNextClient()
- freeClientsInAsyncFreeQueue()
- lookupClientByID()
- _writevToClient()
- _writeToClient()
- writeToClient()
- sendReplyToClient()
- handleClientsWithPendingWrites()
- resetClient()
- protectClient()
- unprotectClient()
- processInlineBuffer() -> argc와 argv를 만든다.
- setProtocolError()
- processMultibulkBuffer()
- commandProcessed()
- processCommandAndResetClient()
- processPendingCommandAndInputBuffer() -> processInputBuffer()
- processInputBuffer()
- readQueryFromClient()
connRead()
processInputBuffer() - genClientAddrString()
- getClientPeerId()
- getClientSockname()
- catClientInfoString()
- getAllClientsInfoString()
- clientSetName()
- clientSetNameOrReply()
- resetCommand()
- quitCommand()
- clientCommand()
- helloCommand()
- securityWarningCommand()
- retainOriginalCommandVector()
- redactClientCommandArgument()
- rewriteClientCommandVector()
- replaceClientCommandVector()
- rewriteClientCommandArgument()
- getClientOutputBufferMemoryUsage()
- getClientMemoryUsage()
- getClientType()
- getClientTypeByName()
- getClientTypeName()
- checkClientOutputBufferLimits()
- closeClientOnOutputBufferLimitReached()
- flushSlavesOutputBuffers()
- updateClientPauseTypeAndEndTime()
- unblockPostponedClients()
- pauseClients()
- unpauseClients()
- areClientsPaused()
- checkClientPauseTimeoutAndReturnIfPaused()
- processEventsWhileBlocked()
- ----- Threaded I/O -----
- getIOPendingCount()
- setIOPendingCount()
- IOThreadMain()
- initThreadedIO()
- killIOThreads()
- startThreadedIO()
- stopThreadedIOIfNeeded()
- handleClientsWithPendingWritesUsingThreads()
- postponeClientRead()
- handleClientsWithPendingReadsUsingThreads()
- getClientEvictionLimit()
- evictClients()
<< Internal Flow Overview | STRINGS Data Structure >> |
---|
Email
답글이 올라오면 이메일로 알려드리겠습니다.