I have a versioned EGDB with only the DEFAULT version.
When I compress the database, I never get below 8 states. Wondering about this, I investigated a bit and found that I have exclusive state locks from February this year, which stop these states being compressed.
sqlexe <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ArcSDESQLExecute<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">"my\database\connection.sde"</SPAN><SPAN class="punctuation token">)</SPAN>
sqlexe<SPAN class="punctuation token">.</SPAN>execute<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"SELECT state_id FROM sde.sde_states"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># 8 states</SPAN>
<SPAN class="comment token"># [[0.0], [13388.0], [13394.0], [13389.0], [13390.0], [13391.0], [13392.0], [22930.0]]</SPAN>
query <SPAN class="operator token">=</SPAN> <SPAN class="string token">"SELECT s.state_id, s.creation_time, s.closing_time, s.parent_state_id, l.lock_type, l.lock_time FROM sde.sde_states s JOIN sde.sde_state_locks l ON s.state_id = l.state_id"</SPAN>
<SPAN class="keyword token">for</SPAN> s <SPAN class="keyword token">in</SPAN> sqlexe<SPAN class="punctuation token">.</SPAN>execute<SPAN class="punctuation token">(</SPAN>query<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>s<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># state_id, creation_time, closing_time, parent_state_id, lock_type, lock_time</SPAN>
<SPAN class="comment token"># [13388.0, '07.02.2020 11:36:32', '07.02.2020 11:40:27', 0.0, 'E', '07.02.2020 11:36:32']</SPAN>
<SPAN class="comment token"># [13389.0, '07.02.2020 11:40:27', '07.02.2020 11:52:08', 13388.0, 'E', '07.02.2020 11:40:27']</SPAN>
<SPAN class="comment token"># [13390.0, '07.02.2020 11:52:08', '07.02.2020 11:55:08', 13389.0, 'E', '07.02.2020 11:52:08']</SPAN>
<SPAN class="comment token"># [13391.0, '07.02.2020 11:55:08', '07.02.2020 12:00:17', 13390.0, 'E', '07.02.2020 11:55:08']</SPAN>
<SPAN class="comment token"># [13392.0, '07.02.2020 12:00:17', '07.02.2020 12:00:18', 13391.0, 'E', '07.02.2020 12:00:17']</SPAN>
<SPAN class="comment token"># [13394.0, '07.02.2020 12:04:34', '07.02.2020 12:04:45', 0.0, 'S', '07.02.2020 13:13:50']</SPAN>
<SPAN class="comment token"># [22930.0, '03.09.2020 10:09:39', '03.09.2020 10:09:41', 13394.0, 'S', '03.09.2020 10:09:41']</SPAN>
<SPAN class="comment token"># [22930.0, '03.09.2020 10:09:39', '03.09.2020 10:09:41', 13394.0, 'S', '03.09.2020 10:24:06']</SPAN>
<SPAN class="comment token"># [22930.0, '03.09.2020 10:09:39', '03.09.2020 10:09:41', 13394.0, 'S', '03.09.2020 10:54:31']</SPAN>
<SPAN class="comment token"># [22930.0, '03.09.2020 10:09:39', '03.09.2020 10:09:41', 13394.0, 'S', '03.09.2020 11:14:42']</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>- As I understand it, exclusive locks (lock_type 'E') are created when editing data. The locked states have been closed, so the locks should have been lifted, right? What could have caused them to persist?
- Why does the shared lock (lock_type 'S') persist on state 13394? The current state is accessed by multiple services, but AFAIK there weren't any services running back in February. Is it because it's the parent of the current state?
- Should I worry about this?
- How can I get rid of these locks?