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

Function aofUpdateCurrentSize

src/aof.cpp:1957–1970  ·  view source on GitHub ↗

Update the g_pserver->aof_current_size field explicitly using stat(2) * to check the size of the file. This is useful after a rewrite or after * a restart, normally the size is updated just adding the write length * to the current length, that is much faster. */

Source from the content-addressed store, hash-verified

1955 * a restart, normally the size is updated just adding the write length
1956 * to the current length, that is much faster. */
1957void aofUpdateCurrentSize(void) {
1958 struct redis_stat sb;
1959 mstime_t latency;
1960
1961 latencyStartMonitor(latency);
1962 if (redis_fstat(g_pserver->aof_fd,&sb) == -1) {
1963 serverLog(LL_WARNING,"Unable to obtain the AOF file length. stat: %s",
1964 strerror(errno));
1965 } else {
1966 g_pserver->aof_current_size = sb.st_size;
1967 }
1968 latencyEndMonitor(latency);
1969 latencyAddSampleIfNeeded("aof-fstat",latency);
1970}
1971
1972/* A background append only file rewriting (BGREWRITEAOF) terminated its work.
1973 * Handle this. */

Callers 2

loadAppendOnlyFileFunction · 0.85

Calls 1

serverLogFunction · 0.85

Tested by

no test coverage detected