Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

osmosis does not truncate and crashes on index #2364

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 2 comments
Closed

osmosis does not truncate and crashes on index #2364

openstreetmap-trac opened this issue Jul 23, 2021 · 2 comments

Comments

@openstreetmap-trac
Copy link

Reporter: stephankn
[Submitted to the original trac issue database at 2.06pm, Thursday, 8th October 2009]

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(DatabaseContext.java:106)
        at org.openstreetmap.osmosis.core.pgsql.v0_6.PostgreSqlWriter.complete(PostgreSqlWriter.java:862)
        at org.openstreetmap.osmosis.core.buffer.v0_6.EntityBuffer.run(EntityBuffer.java:77)
        at java.lang.Thread.run(Unknown 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(QueryExecutorImpl.java:1592)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:328)
        at org.openstreetmap.osmosis.core.pgsql.common.DatabaseContext.executeStatement(DatabaseContext.java:103)
        ... 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(Pipeline.java:146)
        at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:85)
        at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:30)
        
@openstreetmap-trac
Copy link
Author

Author: brett[at]bretth.com
[Added to the original trac issue at 6.49am, Sunday, 14th March 2010]

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.

@openstreetmap-trac
Copy link
Author

Author: brett[at]bretth.com
[Added to the original trac issue at 6.50am, Sunday, 14th March 2010]

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant