Hi again Sean,
Part of the internal state of a cursor is a key and value. The key can be set either by your application calling WT_CURSOR::set_key(), or by performing an WiredTiger operation, such as WT_CURSOR::next() that sets or updates the key.
The error you are seeing happens if you call WT_CURSOR::get_value() when the cursor's internal key is not set. For example, you can generate this error if you open a cursor and then immediately call WT_CURSOR::get_value(). Similarly, the WT_CURSOR::reset() and WT_CURSOR::reconfigure() methods clear the cursor's state, so if you call WT_CURSOR::get_value() after one of these calls, you will also get this error.
There are also some errors that will clear a cursor's key. A simple example is that if you call WT_CURSOR::set_key() with an invalid key, you will clear any previous key that was set on the cursor, leaving the key unset. It is hard to enumerate the full set of errors that can cause this, as there are a bunch of different cursor methods and some of them behave differently for different cursor types or on different types of tables.
So two likely reasons you might be seeing this error are:
- Calling WT_CURSOR::get_key() on a new or reset cursor before setting the cursor's key.
- Calling WT_CURSOR::get_key() after an error on a previous cursor operation.
Hope this helps!
Keith