Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.DataSourceUtils;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;

Expand Down Expand Up @@ -47,6 +48,12 @@ public DatabaseContext2(DatabaseLoginCredentials loginCredentials) {
dataSource = DataSourceFactory.createDataSource(loginCredentials);
txnManager = new DataSourceTransactionManager(dataSource);
txnTemplate = new TransactionTemplate(txnManager);
// Use REPEATABLE READ so that all sequential reads within one osmosis dump
// (way_nodes read, then nodes geometry read, then relations read) share a
// single MVCC snapshot. Without this, READ COMMITTED lets a concurrent
// cgimap edit delete nodes between the two reads, producing ways with
// missing node references ("Way with less than two nodes" in osmium).
txnTemplate.setIsolationLevel(TransactionDefinition.ISOLATION_REPEATABLE_READ);
jdbcTemplate = new JdbcTemplate(dataSource);
this.dbType = loginCredentials.getDbType();

Expand Down