forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
62 lines
19 KiB
HTML
62 lines
19 KiB
HTML
<a name="EN-US_TOPIC_0000001233563133"></a><a name="EN-US_TOPIC_0000001233563133"></a>
|
|
|
|
<h1 class="topictitle1">Lock Management</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001233563133__en-us_topic_0059778102_p174046489815">In <span id="EN-US_TOPIC_0000001233563133__text2136600110">GaussDB(DWS)</span>, a deadlock may occur when concurrently executed transactions compete for resources. This section describes parameters used for managing transaction lock mechanisms.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563133__s34083b462e2947b5a232d8b3a1465d3b"><a name="EN-US_TOPIC_0000001233563133__s34083b462e2947b5a232d8b3a1465d3b"></a><a name="s34083b462e2947b5a232d8b3a1465d3b"></a><h4 class="sectiontitle">deadlock_timeout</h4><p id="EN-US_TOPIC_0000001233563133__aebefef4eb7ac4dea9c417faef925cb82"><strong id="EN-US_TOPIC_0000001233563133__en-us_topic_0059778102_ab357de372dc749b0b7cd20433daa9254">Parameter description</strong>: Specifies the time, in milliseconds, to wait on a lock before checking whether there is a deadlock condition. When the applied lock exceeds the preset value, the system will check whether a deadlock occurs.</p>
|
|
<ul id="EN-US_TOPIC_0000001233563133__u7f25b40473044df39931a033070e95ad"><li id="EN-US_TOPIC_0000001233563133__l50ea0632dd974b81a6f3a2023a349f2a">The check for deadlock is relatively expensive. Therefore, the server does not check it when waiting for a lock every time. Deadlocks do not frequently occur when the system is running. Therefore, the system just needs to wait on the lock for a while before checking for a deadlock. Increasing this value reduces the time wasted in needless deadlock checks, but slows down reporting of real deadlock errors. On a heavily loaded server, you may need to raise it. The value you have set needs to exceed the transaction time. By doing this, the possibility that a lock will be released before the waiter decides to check for deadlocks will be reduced.</li><li id="EN-US_TOPIC_0000001233563133__l3e93f4ff2db24e73bc1d5a11ab70ba44">When <a href="dws_04_0916.html#EN-US_TOPIC_0000001233761693__s80fbcd77ad5a4cdc879fe344d17b2c13">log_lock_waits</a> is set, this parameter also determines the duration you need to wait before a log message about the lock wait is issued. If you are trying to investigate locking delays, you need to set this parameter to a value smaller than normal <strong id="EN-US_TOPIC_0000001233563133__b8192516482">deadlock_timeout</strong>.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001233563133__aa5a679a0025346749a61d1ea100c7d48"><strong id="EN-US_TOPIC_0000001233563133__b3910156192719">Type</strong>: SUSET</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__a33601623115048eeb94f9c79e5e95d50"><strong id="EN-US_TOPIC_0000001233563133__en-us_topic_0059778102_a47abd39c97f042919e698a6a149bf0c1">Value range</strong>: an integer ranging from 1 to 2147483647. The unit is millisecond (ms).</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__a74ffbe2751354c1a85bae8cf2dc83f62"><strong id="EN-US_TOPIC_0000001233563133__b15854097155846">Default value</strong>: <strong id="EN-US_TOPIC_0000001233563133__b842352706151220">1s</strong></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563133__section163241448144916"><h4 class="sectiontitle">ddl_lock_timeout</h4><p id="EN-US_TOPIC_0000001233563133__p17265647544"><strong id="EN-US_TOPIC_0000001233563133__b164618241506">Parameter description</strong>: Indicates the number of seconds a DDL command should wait for the locks to become available. If the time spent in waiting for a lock exceeds the specified time, an error is reported. (This parameter is supported only in 8.1.3.200 and later cluster versions.)</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__p113243487494"><strong id="EN-US_TOPIC_0000001233563133__b5825926428">Type</strong>: SUSET</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__p8324848144911"><strong id="EN-US_TOPIC_0000001233563133__b2774151514388">Value range</strong>: an integer ranging from 0 to INT_MAX. The unit is millisecond (ms).</p>
|
|
<ul id="EN-US_TOPIC_0000001233563133__ul42470264415"><li id="EN-US_TOPIC_0000001233563133__li1424813261945">If the value of this parameter is 0, this parameter does not take effect.</li><li id="EN-US_TOPIC_0000001233563133__li18109298414">If the value of this parameter is greater than 0, the lock wait time of DDL statements is the value of this parameter, and the lock wait time of other locks is the value of <strong id="EN-US_TOPIC_0000001233563133__b2020311571333">lockwait_timeout</strong>.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001233563133__p1632434813490"><strong id="EN-US_TOPIC_0000001233563133__b0647182253913">Default value</strong>: <strong id="EN-US_TOPIC_0000001233563133__b765462212396">0</strong></p>
|
|
<div class="note" id="EN-US_TOPIC_0000001233563133__note1678851320317"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001233563133__p13428376584">This parameter has a higher priority than <strong id="EN-US_TOPIC_0000001233563133__b17382674964177">lockwait_timeout</strong> and takes effect only for <strong id="EN-US_TOPIC_0000001233563133__b9928753004177">AccessExclusiveLock</strong>.</p>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563133__s4c1383de18ec4928a1f9d7a7a4c0498b"><a name="EN-US_TOPIC_0000001233563133__s4c1383de18ec4928a1f9d7a7a4c0498b"></a><a name="s4c1383de18ec4928a1f9d7a7a4c0498b"></a><h4 class="sectiontitle">lockwait_timeout</h4><p id="EN-US_TOPIC_0000001233563133__a1c2f8bb870334b47b380045558eec458"><strong id="EN-US_TOPIC_0000001233563133__en-us_topic_0059778102_a11bf748b453142e4bfece0f45a793f14">Parameter description</strong>: Specifies the longest time to wait before a single lock times out. If the time you wait before acquiring a lock exceeds the specified time, an error is reported.</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__p19521255143819"><strong id="EN-US_TOPIC_0000001233563133__b284037132718">Type</strong>: SUSET</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__afc56aa6d7d0442fabea86fdf2c2f444f"><strong id="EN-US_TOPIC_0000001233563133__en-us_topic_0059778102_aae7931e7938b4f8f8021ead037bc434a">Value range</strong>: an integer ranging from 0 to INT_MAX. The unit is millisecond (ms).</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__ae3ead4aacf31413bb043d93f1d7365dd"><strong id="EN-US_TOPIC_0000001233563133__en-us_topic_0059778102_aaaed2f2f565e40d5b0247dc7cc853b69">Default value</strong>: <strong id="EN-US_TOPIC_0000001233563133__b84235270611550">20 min</strong></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563133__section14495103214523"><h4 class="sectiontitle">update_lockwait_timeout</h4><p id="EN-US_TOPIC_0000001233563133__p1492134465210"><strong id="EN-US_TOPIC_0000001233563133__b5340131581620">Parameter description</strong>: sets the maximum duration that a lock waits for concurrent updates on a row to complete when the concurrent update feature is enabled. If the time you wait before acquiring a lock exceeds the specified time, an error is reported.</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__p1801133397"><strong id="EN-US_TOPIC_0000001233563133__b118861271273">Type</strong>: SUSET</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__p79321544105212"><strong id="EN-US_TOPIC_0000001233563133__b1666356731">Value range</strong>: an integer ranging from 0 to INT_MAX. The unit is millisecond (ms).</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__p18941114416524"><strong id="EN-US_TOPIC_0000001233563133__b1280410197168">Default value</strong>: <strong id="EN-US_TOPIC_0000001233563133__b15805151917164">2 min</strong></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563133__se22bc5884d9f422c95e08fde6901f723"><h4 class="sectiontitle">max_locks_per_transaction</h4><p id="EN-US_TOPIC_0000001233563133__a79d4cedd45f64bcc8e206523d42d6de5"><strong id="EN-US_TOPIC_0000001233563133__en-us_topic_0059778102_a62e514c4e2e94e35be48d78ab06697d8">Parameter description</strong>: Controls the average number of object locks allocated for each transaction.</p>
|
|
<ul id="EN-US_TOPIC_0000001233563133__u3bf12b61df004233a16667e85137d550"><li id="EN-US_TOPIC_0000001233563133__laeec2c78c59b43b193585707679d00bf">The size of the shared lock table is calculated under the condition that a maximum of <em id="EN-US_TOPIC_0000001233563133__i47997984934415">N</em> independent objects need to be locked at any time. <em id="EN-US_TOPIC_0000001233563133__i179099677434415">N</em> = max_locks_per_transaction x (max_connections + max_prepared_transactions). Objects that do not exceed the preset number can be locked simultaneously at any time. You may need to increase this value when you modify many different tables in a single transaction. This parameter can only be set at database start.</li><li id="EN-US_TOPIC_0000001233563133__l7e6c024adb9b43cfbfc2c7e762f815fd">If this parameter is set to a large value, <span id="EN-US_TOPIC_0000001233563133__text1083094595">GaussDB(DWS)</span> may require more System V shared memory than the default setting.</li><li id="EN-US_TOPIC_0000001233563133__l92e0ea6ae9834ab1b571172eac971ff9">When running a standby server, you must set this parameter to a value that is no less than that on the primary server. Otherwise, queries will not be allowed on the standby server.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001233563133__p2986161516393"><strong id="EN-US_TOPIC_0000001233563133__b8811787272">Type</strong>: POSTMASTER</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__ac26728df4ce144b88b79c513ebb533db"><strong id="EN-US_TOPIC_0000001233563133__b617381034415">Value range</strong>: an integer ranging from 10 to INT_MAX</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__a28566415542e4da5be5cec57de637491"><strong id="EN-US_TOPIC_0000001233563133__b6143008416645">Default value</strong>: <strong id="EN-US_TOPIC_0000001233563133__b84235270616559">256</strong></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563133__section137031528165511"><h4 class="sectiontitle">ddl_select_concurrent_mode</h4><p id="EN-US_TOPIC_0000001233563133__p15703102813552"><strong id="EN-US_TOPIC_0000001233563133__b55863384523">Parameter description</strong>: Specifies the concurrency mode of DDL and <strong id="EN-US_TOPIC_0000001233563133__b5922202443912">SELECT</strong> statements. This parameter is supported only by clusters of 8.1.3.320, 8.2.1, and later versions.</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__p187031428195513"><strong id="EN-US_TOPIC_0000001233563133__b15442144675219">Type</strong>: SUSET</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__p2703102813556"><strong id="EN-US_TOPIC_0000001233563133__b118811048205217">Value range</strong>: enumerated values</p>
|
|
<ul id="EN-US_TOPIC_0000001233563133__ul1270392810551"><li id="EN-US_TOPIC_0000001233563133__li1570392813553"><strong id="EN-US_TOPIC_0000001233563133__b790145113521">none</strong>: DDL and <strong id="EN-US_TOPIC_0000001233563133__b18995221143913">SELECT</strong> statements cannot be executed concurrently. Waiting statements are in the lock wait state.</li><li id="EN-US_TOPIC_0000001233563133__li870342865514"><strong id="EN-US_TOPIC_0000001233563133__b11552122718173">truncate</strong>: When a <strong id="EN-US_TOPIC_0000001233563133__b10458047161718">TRUNCATE</strong> statement is blocked by a <strong id="EN-US_TOPIC_0000001233563133__b27086502173">SELECT</strong> statement, the <strong id="EN-US_TOPIC_0000001233563133__b13353192341816">TRUNCATE</strong> statement interrupts the <strong id="EN-US_TOPIC_0000001233563133__b9554632141812">SELECT</strong> statement and is executed first. Other DDL statements and <strong id="EN-US_TOPIC_0000001233563133__b940713182399">SELECT</strong> statements remain in the lock wait state.</li><li id="EN-US_TOPIC_0000001233563133__li11271145915199"><strong id="EN-US_TOPIC_0000001233563133__b84641854151815">exchange</strong>: When an <strong id="EN-US_TOPIC_0000001233563133__b2465155411817">EXCHANGE</strong> statement is blocked by a <strong id="EN-US_TOPIC_0000001233563133__b14465115421815">SELECT</strong> statement, the <strong id="EN-US_TOPIC_0000001233563133__b114665547187">EXCHANGE</strong> statement interrupts the <strong id="EN-US_TOPIC_0000001233563133__b16467205411188">SELECT</strong> statement and is executed first. Other DDL statements and <strong id="EN-US_TOPIC_0000001233563133__b144551399399">SELECT</strong> statements remain in the lock wait state.</li><li id="EN-US_TOPIC_0000001233563133__li1465882515218"><strong id="EN-US_TOPIC_0000001233563133__b99408272194">truncate</strong>, <strong id="EN-US_TOPIC_0000001233563133__b6497730131911">exchange</strong>: When a <strong id="EN-US_TOPIC_0000001233563133__b16391324200">TRUNCATE</strong> and an <strong id="EN-US_TOPIC_0000001233563133__b195531135172010">EXCHANGE</strong> statement are blocked by the <strong id="EN-US_TOPIC_0000001233563133__b34933522015">SELECT</strong> statement, the <strong id="EN-US_TOPIC_0000001233563133__b145382287202">SELECT</strong> statement is interrupted and the <strong id="EN-US_TOPIC_0000001233563133__b4706449102018">TRUNCATE</strong> and <strong id="EN-US_TOPIC_0000001233563133__b9706949152016">EXCHANGE</strong> statement are executed first.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001233563133__p18703928185514"><strong id="EN-US_TOPIC_0000001233563133__b1069271315534">Default value</strong>: <strong id="EN-US_TOPIC_0000001233563133__b2069291335315">none</strong></p>
|
|
<div class="note" id="EN-US_TOPIC_0000001233563133__note146610123419"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001233563133__ul1356611414133"><li id="EN-US_TOPIC_0000001233563133__li356771417138">To reserve time for the <strong id="EN-US_TOPIC_0000001233563133__b1656953400">SELECT</strong> statement to respond to signals, if the value of <strong id="EN-US_TOPIC_0000001233563133__b1831101294020">ddl_lock_timeout</strong> is less than 1 second in the current version, 1 second is used.</li><li id="EN-US_TOPIC_0000001233563133__li12567191491318">Concurrency is not supported when there are conflicts with locks of higher levels (more than one level). For example, <strong id="EN-US_TOPIC_0000001233563133__b16710247406">autoanalyze</strong> is triggered by<strong id="EN-US_TOPIC_0000001233563133__b156820240405"> select</strong> when <strong id="EN-US_TOPIC_0000001233563133__b369102444019">autoanalyze_mode</strong> is set to <strong id="EN-US_TOPIC_0000001233563133__b4702244406">normal</strong>.</li><li id="EN-US_TOPIC_0000001233563133__li55676142138">Concurrency is not supported when there are conflicts with locks in transaction blocks.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563133__s3dade83e35084cbf97d863cd937bbc35"><h4 class="sectiontitle">max_pred_locks_per_transaction</h4><p id="EN-US_TOPIC_0000001233563133__a3b2176a875de476abd4774039645e568"><strong id="EN-US_TOPIC_0000001233563133__en-us_topic_0059778102_a45a8fe30306c40ebaada00dc2aa6dcb5">Parameter description</strong>: Controls the average number of predicated locks allocated for each transaction.</p>
|
|
<ul id="EN-US_TOPIC_0000001233563133__u56383c69c9554823965777819862d940"><li id="EN-US_TOPIC_0000001233563133__l403dae84b2de46ff8a1e4db4e1680cc2">The size of the shared and predicated lock table is calculated under the condition that a maximum of <em id="EN-US_TOPIC_0000001233563133__i140527684834415">N</em> independent objects need to be locked at any time. <em id="EN-US_TOPIC_0000001233563133__i47315383634415">N</em> = max_pred_locks_per_transaction x (max_connections + max_prepared_transactions). Objects that do not exceed the preset number can be locked simultaneously at any time. You may need to increase this value when you modify many different tables in a single transaction. This parameter can only be set at server start.</li><li id="EN-US_TOPIC_0000001233563133__l92a4a28b13f046fd88e03ff8b3b318ad">If this parameter is set to a large value, <span id="EN-US_TOPIC_0000001233563133__text1423314024814">GaussDB(DWS)</span> may require more System V shared memory than the default setting.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001233563133__p207175426399"><strong id="EN-US_TOPIC_0000001233563133__b1686311815277">Type</strong>: POSTMASTER</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__adc0f9bf96ac040ed955fc5a8f9677bb1"><strong id="EN-US_TOPIC_0000001233563133__b24136558934415">Value range</strong>: an integer ranging from 10 to INT_MAX</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__a350db34780724965969a1fd91a5963c0"><strong id="EN-US_TOPIC_0000001233563133__b5735075">Default value</strong>: <strong id="EN-US_TOPIC_0000001233563133__b842352706143016">64</strong></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563133__s9e60e76c946c4167bbac44b06763643e"><h4 class="sectiontitle">partition_lock_upgrade_timeout</h4><p id="EN-US_TOPIC_0000001233563133__af8d27aa64e5a472280e5acc14f145759"><strong id="EN-US_TOPIC_0000001233563133__en-us_topic_0059778102_a0a3f754b01714f8eb42ebd28e1e3aced">Parameter description</strong>: Specifies the time to wait before the attempt of a lock upgrade from ExclusiveLock to AccessExclusiveLock times out on partitions.</p>
|
|
<ul id="EN-US_TOPIC_0000001233563133__u11dac01d617041d2b739e24101925624"><li id="EN-US_TOPIC_0000001233563133__l21aa88468c2e4b9da8f473ba397f12ff">When you do MERGE PARTITION and CLUSTER PARTITION on a partitioned table, temporary tables are used for data rearrangement and file exchange. To concurrently perform as many operations as possible on the partitions, ExclusiveLock is acquired for the partitions during data rearrangement and AccessExclusiveLock is acquired during file exchange.</li><li id="EN-US_TOPIC_0000001233563133__l62feb41355374e7e9c141968baadcfa7">Generally, a partition waits until it acquires a lock, or a timeout occurs if the partition waits for a period of time longer than specified by the <a href="#EN-US_TOPIC_0000001233563133__s4c1383de18ec4928a1f9d7a7a4c0498b">lockwait_timeout</a> parameter.</li><li id="EN-US_TOPIC_0000001233563133__l5a4a9f8beaa2430081819533d939c31d">When doing MERGE PARTITION or CLUSTER PARTITION on a partitioned table, you need to acquire AccessExclusiveLock during file exchange. If the lock fails to be acquired, the acquisition is retried in 50 ms. This parameter specifies the time to wait before the lock acquisition attempt times out.</li><li id="EN-US_TOPIC_0000001233563133__l6af6f4643f8448279da12f0b367b972d">If this parameter is set to <strong id="EN-US_TOPIC_0000001233563133__b8423527069176">-1</strong>, the lock upgrade never times out. The lock upgrade is continuously retried until it succeeds.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001233563133__a08d782463f144356b25d6f937a41fd8a"><strong id="EN-US_TOPIC_0000001233563133__b353151402716">Type</strong>: USERSET</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__a5aa04d74c8c44d3b8962d8c3c3c1fb46"><strong id="EN-US_TOPIC_0000001233563133__b131227031614">Value range</strong>: an integer ranging from -1 to 3000. The unit is second (s).</p>
|
|
<p id="EN-US_TOPIC_0000001233563133__ad5567e8f532b48d88e9ff8f89a1f3553"><strong id="EN-US_TOPIC_0000001233563133__b1940001151">Default value</strong>: <strong id="EN-US_TOPIC_0000001233563133__b842352706143156">1800</strong></p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0883.html">GUC Parameters</a></div>
|
|
</div>
|
|
</div>
|
|
|