<p>Objects so far have been deleted directly from the main thread in gazetteer. This may lead to deadlock as the updates in the copy thread trigger SQL triggers which may touch an object currently being deleted.</p>
<p>Gazetteer objects are now deleted in the copy thread in a batch just like we do for all other tables. For this we need a different kind of deleter as the primary key is different for gazetteer's place table. For this, delete lists become first class objects and the copy manager becomes responsible for adding the right deleter to the copy buffer object.</p>
<p><span class="issue-keyword tooltipped tooltipped-se" aria-label="This pull request closes issue #964.">Fixes</span> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="513167673" data-permission-text="Issue title is private" data-url="https://github.com/openstreetmap/osm2pgsql/issues/964" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/osm2pgsql/issues/964/hovercard" href="https://github.com/openstreetmap/osm2pgsql/issues/964">#964</a>.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/osm2pgsql/pull/1008'>https://github.com/openstreetmap/osm2pgsql/pull/1008</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>move object deletion into its own class</li>
  <li>make object deleter replacable in the copy manager</li>
  <li>introduce special object deleter for gazetteer</li>
  <li>gazetteer: simplify deletion of unused</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-0">src/db-copy-mgr.hpp</a>
    (350)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-1">src/db-copy.cpp</a>
    (77)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-2">src/db-copy.hpp</a>
    (353)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-3">src/gazetteer-style.cpp</a>
    (48)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-4">src/gazetteer-style.hpp</a>
    (56)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-5">src/middle-pgsql.cpp</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-6">src/middle-pgsql.hpp</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-7">src/output-gazetteer.cpp</a>
    (83)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-8">src/output-gazetteer.hpp</a>
    (17)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-9">src/table.cpp</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-10">src/table.hpp</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-11">tests/test-db-copy-mgr.cpp</a>
    (14)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008/files#diff-12">tests/test-db-copy-thread.cpp</a>
    (19)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/osm2pgsql/pull/1008.patch'>https://github.com/openstreetmap/osm2pgsql/pull/1008.patch</a></li>
  <li><a href='https://github.com/openstreetmap/osm2pgsql/pull/1008.diff'>https://github.com/openstreetmap/osm2pgsql/pull/1008.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/pull/1008?email_source=notifications&email_token=AA6353W3T2YAOWUPRAAWVIDQWLPOXA5CNFSM4JTIQX4KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5A3NZA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353SN4LVBDTFAZVUREKLQWLPOXANCNFSM4JTIQX4A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AA6353XZZY3TTQ2EJE3STULQWLPOXA5CNFSM4JTIQX4KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5A3NZA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/pull/1008?email_source=notifications\u0026email_token=AA6353W3T2YAOWUPRAAWVIDQWLPOXA5CNFSM4JTIQX4KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5A3NZA",
"url": "https://github.com/openstreetmap/osm2pgsql/pull/1008?email_source=notifications\u0026email_token=AA6353W3T2YAOWUPRAAWVIDQWLPOXA5CNFSM4JTIQX4KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5A3NZA",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>