Determine the sequence when locked
Determine the sequence when locked

To avoid a transaction causing the sequences
to be reset we should avoid getting the sequence
number until we have the lock and can use it for
the full create function.

harlowja/Zake,yahoo/Zake