Skip to content

Commit 44d8046

Browse files
committed
Remove unused ways_pending/done_tracker from pgsql/flex outputs
1 parent d68ae6e commit 44d8046

File tree

4 files changed

+7
-83
lines changed

4 files changed

+7
-83
lines changed

src/output-flex.cpp

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,44 +1005,10 @@ void output_flex_t::call_process_function(int index,
10051005
void output_flex_t::enqueue_ways(pending_queue_t &job_queue, osmid_t id,
10061006
std::size_t output_id, std::size_t &added)
10071007
{
1008-
osmid_t const prev = m_ways_pending_tracker.last_returned();
1009-
if (id_tracker::is_valid(prev) && prev >= id) {
1010-
if (prev > id) {
1011-
job_queue.push(pending_job_t(id, output_id));
1012-
}
1013-
// already done the job
1014-
return;
1015-
}
1016-
1017-
//make sure we get the one passed in
1018-
if (!m_ways_done_tracker->is_marked(id) && id_tracker::is_valid(id)) {
1019-
job_queue.push(pending_job_t(id, output_id));
1008+
if (id_tracker::is_valid(id)) {
1009+
job_queue.emplace(id, output_id);
10201010
++added;
10211011
}
1022-
1023-
//grab the first one or bail if its not valid
1024-
osmid_t popped = m_ways_pending_tracker.pop_mark();
1025-
if (!id_tracker::is_valid(popped)) {
1026-
return;
1027-
}
1028-
1029-
//get all the ones up to the id that was passed in
1030-
while (popped < id) {
1031-
if (!m_ways_done_tracker->is_marked(popped)) {
1032-
job_queue.push(pending_job_t(popped, output_id));
1033-
++added;
1034-
}
1035-
popped = m_ways_pending_tracker.pop_mark();
1036-
}
1037-
1038-
//make sure to get this one as well and move to the next
1039-
if (popped > id) {
1040-
if (!m_ways_done_tracker->is_marked(popped) &&
1041-
id_tracker::is_valid(popped)) {
1042-
job_queue.push(pending_job_t(popped, output_id));
1043-
++added;
1044-
}
1045-
}
10461012
}
10471013

10481014
void output_flex_t::pending_way(osmid_t id, int exists)
@@ -1292,7 +1258,6 @@ output_flex_t::output_flex_t(
12921258
std::shared_ptr<id_tracker> ways_tracker,
12931259
std::shared_ptr<id_tracker> rels_tracker)
12941260
: output_t(mid, o), m_tables(std::move(tables)),
1295-
m_ways_done_tracker(new id_tracker{}),
12961261
m_stage2_ways_tracker(std::move(ways_tracker)),
12971262
m_stage2_rels_tracker(std::move(rels_tracker)), m_copy_thread(copy_thread),
12981263
m_lua_state(std::move(lua_state)), m_builder(o.projection),
@@ -1414,7 +1379,7 @@ void output_flex_t::init_lua(std::string const &filename)
14141379

14151380
bool output_flex_t::has_pending() const
14161381
{
1417-
return !m_ways_pending_tracker.empty() || !m_rels_pending_tracker.empty();
1382+
return !m_rels_pending_tracker.empty();
14181383
}
14191384

14201385
void output_flex_t::stage2_proc()

src/output-flex.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ class output_flex_t : public output_t
139139
std::shared_ptr<std::vector<flex_table_t>> m_tables;
140140
std::vector<table_connection_t> m_table_connections;
141141

142-
id_tracker m_ways_pending_tracker;
143142
id_tracker m_rels_pending_tracker;
144-
std::shared_ptr<id_tracker> m_ways_done_tracker;
145143

146144
std::shared_ptr<id_tracker> m_stage2_ways_tracker;
147145
std::shared_ptr<id_tracker> m_stage2_rels_tracker;

src/output-pgsql.cpp

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -69,44 +69,10 @@ void output_pgsql_t::pgsql_out_way(osmium::Way const &way, taglist_t *tags,
6969
void output_pgsql_t::enqueue_ways(pending_queue_t &job_queue, osmid_t id,
7070
size_t output_id, size_t &added)
7171
{
72-
osmid_t const prev = ways_pending_tracker.last_returned();
73-
if (id_tracker::is_valid(prev) && prev >= id) {
74-
if (prev > id) {
75-
job_queue.push(pending_job_t(id, output_id));
76-
}
77-
// already done the job
78-
return;
79-
}
80-
81-
//make sure we get the one passed in
82-
if (!ways_done_tracker->is_marked(id) && id_tracker::is_valid(id)) {
83-
job_queue.push(pending_job_t(id, output_id));
72+
if (id_tracker::is_valid(id)) {
73+
job_queue.emplace(id, output_id);
8474
++added;
8575
}
86-
87-
//grab the first one or bail if its not valid
88-
osmid_t popped = ways_pending_tracker.pop_mark();
89-
if (!id_tracker::is_valid(popped)) {
90-
return;
91-
}
92-
93-
//get all the ones up to the id that was passed in
94-
while (popped < id) {
95-
if (!ways_done_tracker->is_marked(popped)) {
96-
job_queue.push(pending_job_t(popped, output_id));
97-
++added;
98-
}
99-
popped = ways_pending_tracker.pop_mark();
100-
}
101-
102-
//make sure to get this one as well and move to the next
103-
if (popped > id) {
104-
if (!ways_done_tracker->is_marked(popped) &&
105-
id_tracker::is_valid(popped)) {
106-
job_queue.push(pending_job_t(popped, output_id));
107-
++added;
108-
}
109-
}
11076
}
11177

11278
void output_pgsql_t::pending_way(osmid_t id, int exists)
@@ -436,7 +402,6 @@ output_pgsql_t::output_pgsql_t(
436402
std::shared_ptr<db_copy_thread_t> const &copy_thread)
437403
: output_t(mid, o), m_builder(o.projection),
438404
expire(o.expire_tiles_zoom, o.expire_tiles_max_bbox, o.projection),
439-
ways_done_tracker(new id_tracker{}),
440405
buffer(32768, osmium::memory::Buffer::auto_grow::yes),
441406
rels_buffer(1024, osmium::memory::Buffer::auto_grow::yes)
442407
{
@@ -495,9 +460,6 @@ output_pgsql_t::output_pgsql_t(
495460
m_builder(m_options.projection),
496461
expire(m_options.expire_tiles_zoom, m_options.expire_tiles_max_bbox,
497462
m_options.projection),
498-
//NOTE: we need to know which ways were used by relations so each thread
499-
//must have a copy of the original marked done ways, its read only so its ok
500-
ways_done_tracker(other->ways_done_tracker),
501463
buffer(1024, osmium::memory::Buffer::auto_grow::yes),
502464
rels_buffer(1024, osmium::memory::Buffer::auto_grow::yes)
503465
{
@@ -512,7 +474,7 @@ output_pgsql_t::~output_pgsql_t() = default;
512474

513475
bool output_pgsql_t::has_pending() const
514476
{
515-
return !ways_pending_tracker.empty() || !rels_pending_tracker.empty();
477+
return !rels_pending_tracker.empty();
516478
}
517479

518480
void output_pgsql_t::merge_pending_relations(output_t *other)

src/output-pgsql.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ class output_pgsql_t : public output_t
8888
geom::osmium_builder_t m_builder;
8989
expire_tiles expire;
9090

91-
id_tracker ways_pending_tracker, rels_pending_tracker;
92-
std::shared_ptr<id_tracker> ways_done_tracker;
91+
id_tracker rels_pending_tracker;
9392
osmium::memory::Buffer buffer;
9493
osmium::memory::Buffer rels_buffer;
9594
};

0 commit comments

Comments
 (0)