Skip to content

Commit

Permalink
Use syntax more likely to suggest templating / replacement in 'shardi…
Browse files Browse the repository at this point in the history
…ng' over osm_id for perform-sql-updates.sh.
  • Loading branch information
zerebubuth committed Feb 22, 2019
1 parent dbebede commit a061e45
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion data/apply-planet_osm_line.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ UPDATE planet_osm_line SET
-- NOTE: the following line isn't SQL syntax, it's replaced in the
-- perform-sql-updates.sh script with a range over osm_id when we're
-- sharding the query to make use of all CPUs, or TRUE if we're not.
SHARDING;
{{SHARDING}};

END $$;
2 changes: 1 addition & 1 deletion data/apply-planet_osm_point.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ UPDATE planet_osm_point SET
-- NOTE: the following line isn't SQL syntax, it's replaced in the
-- perform-sql-updates.sh script with a range over osm_id when we're
-- sharding the query to make use of all CPUs, or TRUE if we're not.
SHARDING;
{{SHARDING}};

END $$;
8 changes: 4 additions & 4 deletions data/apply-planet_osm_polygon.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ UPDATE planet_osm_polygon SET
mz_water_min_zoom = mz_calculate_min_zoom_water(planet_osm_polygon.*),
mz_label_placement = ST_PointOnSurface(way)
WHERE
-- NOTE: the following line isn't SQL syntax, it's replaced in the
-- perform-sql-updates.sh script with a range over osm_id when we're
-- sharding the query to make use of all CPUs, or TRUE if we're not.
SHARDING;
-- NOTE: the following line isn't SQL syntax, it's replaced in the
-- perform-sql-updates.sh script with a range over osm_id when we're
-- sharding the query to make use of all CPUs, or TRUE if we're not.
{{SHARDING}};


END $$;
10 changes: 5 additions & 5 deletions data/perform-sql-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ for tbl in polygon line point; do

# try to paralellise across 4 processors.
if [ -n "${breaks[25]}" ] && [ -n "${breaks[50]}" ] && [ -n "${breaks[75]}" ]; then
sed "s/SHARDING/osm_id < ${breaks[25]}/" "${sql_script}" | psql $PSQLOPTS $@ &
sed "s/SHARDING/osm_id >= ${breaks[25]} AND osm_id < ${breaks[50]}/" "${sql_script}" | psql $PSQLOPTS $@ &
sed "s/SHARDING/osm_id >= ${breaks[50]} AND osm_id < ${breaks[75]}/" "${sql_script}" | psql $PSQLOPTS $@ &
sed "s/SHARDING/osm_id >= ${breaks[75]}/" "${sql_script}" | psql $PSQLOPTS $@ &
sed "s/{{SHARDING}}/osm_id < ${breaks[25]}/" "${sql_script}" | psql $PSQLOPTS $@ &
sed "s/{{SHARDING}}/osm_id >= ${breaks[25]} AND osm_id < ${breaks[50]}/" "${sql_script}" | psql $PSQLOPTS $@ &
sed "s/{{SHARDING}}/osm_id >= ${breaks[50]} AND osm_id < ${breaks[75]}/" "${sql_script}" | psql $PSQLOPTS $@ &
sed "s/{{SHARDING}}/osm_id >= ${breaks[75]}/" "${sql_script}" | psql $PSQLOPTS $@ &

else
# if no breaks, just use the serial version
echo "Serial build for planet_osm_${tbl} - this might be slower."
sed "s/SHARDING/TRUE/" "${sql_script}" | psql $PSQLOPTS $@ &
sed "s/{{SHARDING}}/TRUE/" "${sql_script}" | psql $PSQLOPTS $@ &
fi
done
wait
Expand Down

0 comments on commit a061e45

Please sign in to comment.