Databases Reference
In-Depth Information
granted to a session, no other session can obtain a commit lock for this database object.
All query requests (but not DDL commands) are trying to acquire a shared commit lock.
Multiple requests can simultaneously obtain a shared commit lock if no exclusive commit
lock has been granted to another request. If a transaction requests an exclusive commit
lock, it has to wait until all previously granted shared locks lift and no other transaction
has previously requested an exclusive commit lock. If these conditions are met and the
transaction successfully acquires a commit lock, the session quickly commits all the
objects and lifts the commit lock. However, if the conditions are not met, the transaction
goes into the queue for a commit lock.
A transaction has to stay in the queue until all the requests currently running on the
server complete, and potentially some requests can take a long time. During this time, the
database is unavailable to new query requests because there is a command waiting in the
queue for an exclusive lock. The server won't execute any command until our transaction
is committed. To prevent this, you can specify a value for the ForceCommitTimeout prop-
erty, which limits the time required to commit the transaction. If this timeout expires
while an operation is running and preventing the transaction from committing, the server
cancels all outstanding queries that are currently running.
NOTE
Because Analysis Services creates an implicit transaction for each command, all opera-
tions on the server execute according to this logic, even if the client application does
not call the BeginTransaction command.
Locking Commands
When you have a complex system in which you need to coordinate operations in
Analysis Services with operations in other servers, such as SQL Server or other instances
of Analysis Services, you might need to manage transactions explicitly. For example,
suppose that you want to update a table in SQL Server and process a partition based on
this table in a single transaction. Analysis Services uses the Lock and Unlock commands,
whose syntax is shown in Listing 26.6.
LISTING 26.6
The Syntax of the Lock and Unlock Commands
<Lock>
<ID>lock_id</ID>
<Object>object_reference<Object>
<Mode>lock_mode</Mode>
</Lock>
<Unlock>
<ID>lock_id</ID>
</Unlock>
 
Search WWH ::




Custom Search