OpenEdge Data Management: DataServer for Microsoft SQL Server
OpenEdge Data Management: DataServer for Microsoft SQL Server
OpenEdge Data Management: DataServer for Microsoft SQL Server
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>OpenEdge</strong> sequences<br />
<strong>Data</strong>base design issues<br />
A sequence generator is a database object that provides incremental values within any integer<br />
range. (You can specify any positive or negative increment.) During an <strong>OpenEdge</strong> DB to MS<br />
<strong>SQL</strong> <strong>Server</strong> migration, the <strong>Data</strong><strong>Server</strong> internally simulates support <strong>for</strong> <strong>OpenEdge</strong> sequences<br />
using native MS <strong>SQL</strong> <strong>Server</strong> stored procedures and a sequence table. You cannot create<br />
sequences <strong>for</strong> MS <strong>SQL</strong> <strong>Server</strong> tables directly through the <strong>Data</strong> Dictionary.<br />
The <strong>Data</strong><strong>Server</strong> <strong>for</strong> MS <strong>SQL</strong> <strong>Server</strong> offers both a revised and a legacy version of the sequence<br />
generator. Each legacy sequence has one stored procedure and one table object associated with<br />
it whose names are prefixed with _SEQP_ and _SEQT_ respectively. The same objects in the new<br />
sequence generator are prefixed with SEQP_REV_ and SEQT_REV respectively and include a single<br />
common table object named SEQT_REV_SEQTMGR. When a sequence is migrated to MS <strong>SQL</strong><br />
<strong>Server</strong>, the new sequence generator is used if the Use revised sequence generator option is<br />
checked in the migration dialog. If you remigrate with the same option turned off, the sequences<br />
will revert to the legacy model in the <strong>for</strong>eign database and the schema holder. Only one<br />
sequence generator is implemented <strong>for</strong> the <strong>Data</strong><strong>Server</strong> at a given time. If you elect to use the<br />
revised sequence generator and the legacy version already exists, the legacy version is replaced,<br />
and visa versa. It is also possible to change the sequence version using the delta.sql utility by<br />
setting or unsetting the Use revised sequence generator option.<br />
The sequence procedures all run in separate connections from your ABL transactions. In that<br />
connection, a different transaction is established to handle modifications to the sequence table<br />
rows. With all the sequence requests made against the legacy sequence generator, if a sequence<br />
is being actively modified when another user attempts to access the sequence record, the second<br />
user must wait <strong>for</strong> a lock. Under heavy use, it is possible <strong>for</strong> a lock timeout to occur on a<br />
sequence. To avoid any probability of sequence timeouts, sequence retry logic in the<br />
<strong>Data</strong><strong>Server</strong> attempts to handle concurrency automatically. In the remote instance of a sequence<br />
lock timeout that is not resolved internally, the user is given the option to continue to wait and<br />
retry or to cancel the retries and abandon the sequence request. Setting a non-zero value <strong>for</strong> the<br />
–Dsrv switch PRGRS_NATIVE_LOCKWAIT may further reduce any possibility of an unmanaged<br />
sequence timeout. For more in<strong>for</strong>mation on setting the PRGRS_NATIVE_LOCKWAIT value, refer to<br />
the “Handling lock timeouts” section on page 2–37 or “<strong>Data</strong><strong>Server</strong> options” section on<br />
page 8–4.<br />
The revised version of the sequence generator eliminates lock contention when using the<br />
commonly utilized NEXT-VALUE sequence function. Lock contention is also greatly minimized<br />
<strong>for</strong> the GET-VALUE function. Lock contention <strong>for</strong> SET-VALUE function is not reduced and may<br />
not be a better choice over the legacy sequence generator <strong>for</strong> this function. If your particular<br />
application is atypical in the sense that it uses the SET-VALUE function frequently as compared<br />
to your use of NEXT-VALUE and GET-VALUE, then the previous version of the sequence generator<br />
may provide an advantage.<br />
Note: When using the revised sequence generator, your first next-value operation produces<br />
a value that is equal to the initial value specified <strong>for</strong> the sequence generator. By<br />
comparison, the first value produced <strong>for</strong> the legacy sequence generator is equal to the<br />
initial value plus the increment value.<br />
The bit size of the legacy database sequences can be either 32-bit INTEGER or 64-bit INT64. The<br />
revised sequence generator was introduced after the <strong>Data</strong><strong>Server</strong> had already transitioned to<br />
64-bit values. There<strong>for</strong>e all revised sequence generators are 64-bit. The following section<br />
highlights changes regarding 64-bit sequences.<br />
2–15