This file is indexed.

/usr/share/doc/slony1-2-doc/adminguide/locking.html is in slony1-2-doc 2.0.7-3build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Locking Issues</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:slony1-general@lists.slony.info"><LINK
REL="HOME"
TITLE="Slony-I 2.0.7 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Advanced Topics"
HREF="advanced.html"><LINK
REL="PREVIOUS"
TITLE="Slony-I Trigger Handling"
HREF="triggers.html"><LINK
REL="NEXT"
TITLE="Security Considerations"
HREF="security.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2011-12-03T11:44:27"></HEAD
><BODY
CLASS="SECT1"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="5"
ALIGN="center"
VALIGN="bottom"
><SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
> 2.0.7 Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="triggers.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="advanced.html"
>Fast Backward</A
></TD
><TD
WIDTH="60%"
ALIGN="center"
VALIGN="bottom"
>Chapter 4. Advanced Topics</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="advanced.html"
>Fast Forward</A
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="security.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="LOCKING"
>4.10. Locking Issues</A
></H1
><A
NAME="AEN3280"
></A
><P
> One of the usual merits of the use, by <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
>, of
Multi-Version Concurrency Control (<ACRONYM
CLASS="ACRONYM"
>MVCC</ACRONYM
>) is that
this eliminates a whole host of reasons to need to lock database
objects.  On some other database systems, you need to acquire a table
lock in order to insert data into the table; that can
<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>severely</I
></SPAN
> hinder performance.  On other systems,
read locks can impede writes; with <ACRONYM
CLASS="ACRONYM"
>MVCC</ACRONYM
>, <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
>
eliminates that whole class of locks in that <SPAN
CLASS="QUOTE"
>"old reads"</SPAN
>
can access <SPAN
CLASS="QUOTE"
>"old tuples."</SPAN
> Most of the time, this allows
the gentle user of <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> to not need to worry very much about
locks.  <SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
> configuration events normally grab locks on an
internal table, <TT
CLASS="ENVAR"
>sl_config_lock</TT
>, which should not be
visible to applications unless they are performing actions on <SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
>
components.  </P
><P
> Unfortunately, there are several sorts of <SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
> events that
do require exclusive locks on <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> tables, with the result that
modifying <SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
> configuration can bring back some of those
<SPAN
CLASS="QUOTE"
>"locking irritations."</SPAN
>  In particular:</P
><P
></P
><UL
><LI
><P
><A
HREF="stmtsetaddtable.html"
> <TT
CLASS="COMMAND"
>set add
table</TT
> </A
></P
><P
> A momentary exclusive table lock must be acquired on the
<SPAN
CLASS="QUOTE"
>"origin"</SPAN
> node in order to add the trigger that collects
updates for that table.  It only needs to be acquired long enough to
establish the new trigger.</P
></LI
><LI
><P
><A
HREF="stmtmoveset.html"
> <TT
CLASS="COMMAND"
> move
set</TT
> </A
></P
><P
> When a set origin is shifted from one node to another,
exclusive locks must be acquired on each replicated table on both the
old origin and the new origin in order to change the triggers on the
tables.  </P
></LI
><LI
><P
><A
HREF="stmtlockset.html"
> <TT
CLASS="COMMAND"
> lock set</TT
> </A
> </P
><P
> This operation expressly requests locks on each of the tables in a
given replication set on the origin node.</P
></LI
><LI
><P
> During the <TT
CLASS="COMMAND"
>SUBSCRIBE_SET</TT
> event on
a new subscriber. </P
><P
> <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>all</I
></SPAN
> tables in the replication set will be locked
via an exclusive lock for the entire duration of the process of
subscription.  By locking the tables early, this means that the
subscription cannot fail after copying some of the data due to some
other process having held on to a table. </P
><P
> In any case, note that this one began with the wording
<SPAN
CLASS="QUOTE"
>"on a new subscriber."</SPAN
> The locks are applied <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>on
the new subscriber.</I
></SPAN
> They are <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>not</I
></SPAN
>
applied on the provider or on the origin. </P
></LI
><LI
><P
> Each time an event is generated (including SYNC events) <SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
>
obtains an exclusive lock on the sl_event table long enough to insert
the event into sl_event.  This is not normally an issue as <SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
>
should be the only program using sl_event.   However this means that
any non-slony transactions that read from sl_event can cause replication
to pause.   If you pg_dump your database  avoid dumping
your Slony schemas or else pg_dump's locking will compete with Slony's own
locking which could stop Slony replication for the duration of the
pg_dump.  Exclude the Slony schemas from pg_dump with
--exclude-schema=schemaname to specifically exclude your Slony schema.&#13;</P
></LI
></UL
><P
>When <SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
> locks a table that a running application later tries
to access the application will be blocked waiting for the lock.  It is
also possible for a running application to create a deadlock situation
with <SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
> when they each have obtained locks that the other is
waiting for.</P
><P
> Several possible solutions to this are: </P
><P
></P
><UL
><LI
><P
> Announce an application outage to avoid deadlocks</P
><P
> If you can temporarily block applications from using the
database, that will provide a window of time during which there is
nothing running against the database other than administrative
processes under your control. </P
></LI
><LI
><P
> Try the operation, hoping for things to work </P
><P
> Since nothing prevents applications from leaving access locks
in your way, you may find yourself deadlocked.  But if the number of
remaining locks are small, you may be able to negotiate with users to
<SPAN
CLASS="QUOTE"
>"get in edgewise."</SPAN
> </P
></LI
><LI
><P
> Use pgpool </P
><P
> If you can use this or some similar <SPAN
CLASS="QUOTE"
>"connection
broker"</SPAN
>, you may be able to tell the connection manager to stop
using the database for a little while, thereby letting it
<SPAN
CLASS="QUOTE"
>"block"</SPAN
> the applications for you.  What would be ideal
would be for the connection manager to hold up user queries for a
little while so that the brief database outage looks, to them, like a
period where things were running slowly.  </P
></LI
><LI
><P
> Rapid Outage Management </P
><P
> The following procedure may minimize the period of the outage:

<P
></P
></P><UL
><LI
><P
> Modify <TT
CLASS="FILENAME"
>pg_hba.conf</TT
> so that only
the  <TT
CLASS="COMMAND"
>slony</TT
> user
will have access to the database. </P
></LI
><LI
><P
> Issue a <TT
CLASS="COMMAND"
>kill -SIGHUP</TT
> to the
<SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> postmaster.</P
><P
> This will not kill off existing possibly-long-running queries,
but will prevent new ones from coming in.  There is an application
impact in that incoming queries will be rejected until the end of the
process.</P
></LI
><LI
><P
> If <SPAN
CLASS="QUOTE"
>"all looks good,"</SPAN
> then it should be
safe to proceed with the <SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
> operation. </P
></LI
><LI
><P
> If some old query is lingering around, you may need
to <TT
CLASS="COMMAND"
>kill -SIGQUIT</TT
> one of the <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> processes.
This will restart the backend and kill off any lingering queries.  You
probably need to restart the <A
HREF="slon.html"
><SPAN
CLASS="APPLICATION"
>slon</SPAN
></A
> processes that
attach to the node. </P
><P
> At that point, it will be safe to proceed with the <SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
>
operation; there will be no competing processes.</P
></LI
><LI
><P
> Reset <TT
CLASS="FILENAME"
>pg_hba.conf</TT
> to allow other
users in, and <TT
CLASS="COMMAND"
>kill -SIGHUP</TT
> the postmaster to make
it reload the security configuration. </P
></LI
></UL
><P>&#13;</P
></LI
></UL
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="triggers.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="security.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><SPAN
CLASS="PRODUCTNAME"
>Slony-I</SPAN
> Trigger Handling</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="advanced.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Security Considerations</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>