When we track operations each tracked function gets itself a static ID that persists throughout the life of the process. The last unused ID is tracked in the connection structure, in the optrack_uid variable. If a function does not yet have an ID, it will take optrack_uid, increment it by one – and use the resulting value as its ID. So the first function that happens to be tracked will get the ID of 1, the second one will get the ID of 2 and so on.
The mapping between function names and IDs is recorded in the map file. The problem is that we can have collisions between IDs. Here is how it can happen:
If we close the connection and then reopen it, optrack_uid gets set to zero. So the next function that needs an ID will get an ID of 1. If another function also had an ID of 1 before the connection was reopened, we will have two functions with the same ID, and we will have trouble interpreting the output of operation tracking logs.
This scenario happens all the time in wtperf.
We need a way to remember the last used optrack id across connection closures.