<p></p>
<p><b>@lonvia</b> commented on this pull request.</p>

<p>The code needs to go through clang-format.</p><hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1168#discussion_r424707323">src/dependency-manager.hpp</a>:</p>
<pre style='color:#555'>> + * This base class doesn't actually do the dependency management but is a
+ * dummy for cases where no dependency management is needed. See the
+ * full_dependency_manager_t class for the real dependency manager.
+ */
+class dependency_manager_t
+{
+public:
+    virtual ~dependency_manager_t() = default;
+
+    /**
+     * Mark a node as changed to trigger the propagation of this change to
+     * ways and relations.
+     *
+     * This has to be called *after* the object was stored in the object store.
+     */
+    virtual void node_changed(osmid_t) {};
</pre>
<p>remove semicolon, also below</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1168#discussion_r424711171">src/dependency-manager.cpp</a>:</p>
<pre style='color:#555'>> +    }
+}
+
+void full_dependency_manager_t::way_changed(osmid_t id) {
+    if (m_ways_pending_tracker.is_marked(id)) {
+        return;
+    }
+
+    for (auto const rel_id : m_object_store->get_rels_by_way(id)) {
+        m_rels_pending_tracker.mark(rel_id);
+    }
+}
+
+void full_dependency_manager_t::relation_changed(osmid_t id) {
+    if (m_rels_pending_tracker.is_marked(id)) {
+        return;
</pre>
<p>This is not true. A marked relation has not necessarily marked its dependencies. That would only be true if we called relation_changed in lines 11, 21 and 31.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1168#discussion_r424713786">src/osm2pgsql.cpp</a>:</p>
<pre style='color:#555'>> @@ -63,7 +63,17 @@ int main(int argc, char *argv[])
         auto const outputs =
             output_t::create_outputs(middle->get_query_instance(), options);
 
-        osmdata_t osmdata{middle, outputs};
+        bool const need_dependencies =
+            std::any_of(outputs.cbegin(), outputs.cend(),
+                        [](std::shared_ptr<output_t> const &output) {
+                            return output->need_forward_dependencies();
+                        });
+
+        auto dependency_manager = std::unique_ptr<dependency_manager_t>(
+            need_dependencies ? new full_dependency_manager_t{middle.get()}
+                              : new dependency_manager_t{});
+
+        osmdata_t osmdata{dependency_manager.get(), middle, outputs};
</pre>
<p>Any particular reason not to hand ownership over to osmdata? Or rather move the code into the osmdata constructor?</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1168#discussion_r424716274">src/dependency-manager.hpp</a>:</p>
<pre style='color:#555'>> +     *
+     * \tparam TOutputIterator Some output iterator type, for instance
+     *         created with std::back_inserter(some vector).
+     * \param it output iterator to which all ids should be written. *it
+     *        must be of type osmid_t.
+     */
+    template <typename TOutputIterator>
+    void get_pending_relation_ids(TOutputIterator &&it) {
+        osmid_t id;
+        while (id_tracker::is_valid(id = m_rels_pending_tracker.pop_mark())) {
+            *it++ = id;
+        }
+    }
+
+private:
+    middle_t* m_object_store;
</pre>
<p>make that a shared ptr?</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/1168#pullrequestreview-411269193">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353TL6IPZSP4JZEX2SP3RRMAL5ANCNFSM4M7BTDNQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AA6353TUPBDMWRUS4IWUVTTRRMAL5A5CNFSM4M7BTDN2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGODCBXQSI.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/1168#pullrequestreview-411269193",
"url": "https://github.com/openstreetmap/osm2pgsql/pull/1168#pullrequestreview-411269193",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>