haiku / haikudepotserver

Haiku Depot Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception adding a mirror

kallisti5 opened this issue · comments

Adding a mirror for a repository results in an exception:

Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "repository_source_mirror_idx02"
  Detail: Key (base_url, repository_source_id)=(https://cdn.haiku.nz/haikuports/x86_64/current, 7631) already exists.
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:460)
	at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:793)
	at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1659)
	at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
	at org.apache.cayenne.access.jdbc.BatchAction.runAsBatch(BatchAction.java:120)
	at org.apache.cayenne.access.jdbc.BatchAction.performAction(BatchAction.java:85)
	at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:97)
	at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:293)
	at org.apache.cayenne.access.DataDomainFlushAction.runQueries(DataDomainFlushAction.java:233)
	at org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:153)
	at org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:633)
	at org.apache.cayenne.access.DataDomain.onSyncNoFilters(DataDomain.java:603)
	at org.apache.cayenne.access.DataDomain$DataDomainSyncFilterChain.onSync(DataDomain.java:764)
	at org.apache.cayenne.tx.TransactionFilter$1.perform(TransactionFilter.java:73)
	at org.apache.cayenne.tx.TransactionFilter$1.perform(TransactionFilter.java:70)
	at org.apache.cayenne.tx.DefaultTransactionManager.performInTransaction(DefaultTransactionManager.java:87)
	at org.apache.cayenne.tx.DefaultTransactionManager.performInLocalTransaction(DefaultTransactionManager.java:59)
	at org.apache.cayenne.tx.DefaultTransactionManager.performInTransaction(DefaultTransactionManager.java:52)
	at org.apache.cayenne.tx.DefaultTransactionManager.performInTransaction(DefaultTransactionManager.java:40)
	at org.apache.cayenne.tx.TransactionFilter.onSync(TransactionFilter.java:70)
	at org.apache.cayenne.access.DataDomain$DataDomainSyncFilterChain.onSync(DataDomain.java:764)
	at org.haiku.haikudepotserver.support.cayenne.QueryCacheRemoveGroupDataChannelFilter.onSync(QueryCacheRemoveGroupDataChannelFilter.java:55)
	at org.apache.cayenne.access.DataDomain$DataDomainSyncFilterChain.onSync(DataDomain.java:764)
	at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:590)
	at org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:742)
	... 77 common frames omitted
2018-12-26 22:38:41,157 -/chr [qtp1160264930-52] ERROR org.haiku.haikudepotserver.js - json-rpc error; code:-32001, msg:[v.4.0 Aug 06 2018 12:11:43] Commit Exception

I've done this a few times. The only option I get is to "deactivate" a repository mirror. It then disappears from the list. Is there a way to fully "delete" a mirror?

Ah.. at the bottom there's a "Show any inactive mirrors"
Any way to delete these?

At the moment there is no possibility from the GUI to completely delete a mirror, but as it is clearly needed, I will introduce a "delete" function soon. The exception above is because it is not possible at the database level to add two mirrors (active or inactive) with the same "base URL" on the same repository source. I will adjust the system to provide better feedback on that when it happens.

I've added logic to check for somebody attempting to add the same base URL twice now and I have also added a delete function for mirrors. This will be included in the next release.