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

Function incrementMvccTstamp

src/server.cpp:7270–7287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7268}
7269
7270void incrementMvccTstamp()
7271{
7272 uint64_t msPrev;
7273 __atomic_load(&g_pserver->mvcc_tstamp, &msPrev, __ATOMIC_ACQUIRE);
7274 msPrev >>= MVCC_MS_SHIFT; // convert to milliseconds
7275
7276 long long mst;
7277 __atomic_load(&g_pserver->mstime, &mst, __ATOMIC_ACQUIRE);
7278 if (msPrev >= (uint64_t)mst) // we can be greater if the count overflows
7279 {
7280 __atomic_fetch_add(&g_pserver->mvcc_tstamp, 1, __ATOMIC_RELEASE);
7281 }
7282 else
7283 {
7284 uint64_t val = ((uint64_t)mst) << MVCC_MS_SHIFT;
7285 __atomic_store(&g_pserver->mvcc_tstamp, &val, __ATOMIC_RELEASE);
7286 }
7287}
7288
7289void OnTerminate()
7290{

Callers 2

callFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected