Opened 9 years ago

Closed 9 years ago

#2364 closed defect (invalid)

osmosis does not truncate and crashes on index

Reported by: stephankn Owned by: brett@…
Priority: major Milestone:
Component: osmosis Version:
Keywords: Cc: stephankn


I have a small dataset to update. A new import is faster than a update. I use the following line to first truncate the DB then re-import the data.

Osmosis fails in about every third call with the following exception. For some reason the database seams not to be correctly truncated and the index having duplicate values.

Happens with 0.31.2 as well as with the latest version from svn. Environment: PostgreSQL 8.3, Java 1.6.0_16, running Windows Vista x64.

call osmosis --truncate-pgsql database=db user=pg --fast-read-xml-0.6 file=f.osm --buffer --write-pgsql user=pg database=db
09.10.2009 07:28:18 org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager waitForCompletion
SCHWERWIEGEND: Thread for task 3-buffer failed
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to execute statement.
        at org.openstreetmap.osmosis.core.pgsql.common.DatabaseContext.executeStatement(
        at org.openstreetmap.osmosis.core.pgsql.v0_6.PostgreSqlWriter.complete(
        at Source)
Caused by: org.postgresql.util.PSQLException: ERROR: could not create unique index "pk_users"
  Detail: Table contains duplicated values.
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(
        at org.postgresql.core.v3.QueryExecutorImpl.execute(
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(
        at org.openstreetmap.osmosis.core.pgsql.common.DatabaseContext.executeStatement(
        ... 3 more
09.10.2009 07:28:18 org.openstreetmap.osmosis.core.Osmosis main
SCHWERWIEGEND: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed.
        at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(
        at org.openstreetmap.osmosis.core.Osmosis.main(

Change History (3)

comment:1 Changed 9 years ago by brett@…

  • Resolution set to invalid
  • Status changed from new to closed

Both the --truncate-pgsql and the --write-pgsql will run in parallel which will cause race conditions. Osmosis must be run twice, once for --truncate-pgsql, and once for --write-pgsql.

comment:2 Changed 9 years ago by brett@…

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:3 Changed 9 years ago by brett@…

  • Resolution set to invalid
  • Status changed from reopened to closed

Didn't mean to re-open defect. Closing it again.

Note: See TracTickets for help on using tickets.