<p><b>@StyXman</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/612#discussion_r161099672">middle-pgsql.cpp</a>:</p>
<pre style='color:#555'>> @@ -1072,7 +1072,10 @@ void middle_pgsql_t::pgsql_stop_one(table_desc *table)
void middle_pgsql_t::stop(void)
{
cache.reset();
- if (out_options->flat_node_cache_enabled) persistent_cache.reset();
+ if (out_options->flat_node_cache_enabled) {
+ persistent_cache->clean_up();
+ persistent_cache.reset();
+ }
</pre>
<p>From what I understand, there are 5 modes of import:</p>
<ol>
<li>Normal mode, where intermediate data is created in RAM. It's not clear to me from the doc if this mode is updatable or not, but I guess the answer is yes.</li>
<li><code>--slim</code> mode, where that data is written in the database. This mode is updatable.</li>
<li><code>--slim</code> + <code>--flat-nodes</code>, where par of the data if written in a spaces file and <code>mmap()</code>'ed, so no db queries. This mode is also updatable.</li>
<li><code>--slim --drop</code> and</li>
<li><code>--slim --flat-nodes --drop</code>, were the intermediate data is erased. With this flag, the database is not upgradable anymore.</li>
</ol>
<p>There are two problems with <code>--slim --drop</code>:</p>
<ul>
<li>The flat nodes file, if used (mode 5), is not erased. This PR fixes this.</li>
<li>The intermediate data is removed at the end, even when they're not longer used way before that moment (mainly, just before indexing). This PR fixes this only for <code>--flat-nodes</code>, mode 5.</li>
</ul>
<p>So what you mean is that we should do the second item for both modes 5 and 3. I think it makes sense, and it seems that what you mention about splitting <code>stop()</code> is actually making this slower to run: I'm getting 500s+ with this patch vs 230s+ without for importing Argentina in my machine.</p>
<p>I'll give the <code>stop()</code> splitting a try tomorrow, but you will have to explain a little bit more about the last paragraph. Can I drop by any IRC channel to discuss it? I think I'll be faster than just ping-pong through GitHub.</p>
<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/612#discussion_r161099672">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AD2-7ol5g0H43Vz3fEQefKPNJOzBv6NUks5tJpHMgaJpZM4JRzeA">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AD2-7nuod6zyg-VerHv1_SA-umfMf97Iks5tJpHMgaJpZM4JRzeA.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/openstreetmap/osm2pgsql/pull/612#discussion_r161099672"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/openstreetmap/osm2pgsql","title":"openstreetmap/osm2pgsql","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/openstreetmap/osm2pgsql"}},"updates":{"snippets":[{"icon":"PERSON","message":"@StyXman commented on #612"}],"action":{"name":"View Pull Request","url":"https://github.com/openstreetmap/osm2pgsql/pull/612#discussion_r161099672"}}}</script>