MySQLOnRocksDB/mysql-5.6
forked from facebook/mysql-5.6

Loading…
add option to display open snapshots and iterators #89
I'll take a look and see what I can come up with.
Mark, for snapshots, what information would you like to see in the SHOW ENGINE ROCKSDB TRANSACTION STATUS output? How long the snapshot has been active? What thread is holding the snapshot? Other things?
Mark,
In our Tuesday meeting, the team talked through some of the issues with this. One thing that was of concern is that currently there is no master list of iterators and creating one will require a mutex any time we create or delete one. The guys from RocksDB were concerned with the cost of this. Someone else pointed out that all statements should start snapshots so maybe it isn't necessary to list iterators - snapshots might be enough to know if something is stuck and needs to be killed.
Therefore for now I have just implemented listing snapshots. Here is a current snapshot of what it looks like:
How does this look?
Here's some questions for you.
1) Do you see any need for the sequence number? I'm not sure it would help the user much, but there is almost no cost to it, so I'm also fine with leaving it in.
2) For the Duration column, should I change it so that if the number of seconds is big enough I translate it to minutes, hours, or even days (i.e. 2 mins 10 secs instead of 130 secs)? That is more work, but it might be a cleaner look. Then again, how often will this get called and do we really care if it is exact? It is probably more important that you can see that it is big vs. small.
3) This is just the results of SHOW ENGINE ROCKSDB TRANSACTION STATUS, but the original request was for SHOW ENGINE ROCKSDB STATUS as well. What part of this would you like to see in the broader status request? Maybe just the number of active snapshots?
The initial work for this is done - snapshots are displayed. Future improvements (memory, locks, etc.) will be in a separate task.

With InnoDB we can see open transactions via SHOW ENGINE INNODB STATUS or SHOW ENGINE INNODB TRANSACTION STATUS. I want a command to show open iterators & snapshots for RocksDB. This can debug problems from clients that leave them open for too long by accident.