Hello,
First of all, thanks for a great product! I have used to save all the settings and data in a H2 database file and now decided to migrate everything to PostgreSQL database.
First, I have downloaded last version of metabase (v0.16.1) and completed all the migrations pending on a H2 database file. After completing this step successfully I did shutdown metabase process and started migration process.
Next, I have created an empty database in postgres and configured ENV MB_DB_* variables accordingly.
Finally, I started migration with this command: “java -jar metabase.jar load-from-h2” and it was completed with all OK’s.
Now, I am trying to run metabase on a migratied postgresql database with all information transferred from H2 db file, but I have a lot of issues with it.
- This happen when I am trying to access any of my dashboards:
04-09 03:58:18 DEBUG metabase.middleware :: GET /api/dashboard/1 200 (9 ms) 04-09 03:58:18 WARN events.view-log :: Failed to process activity event. :dashboard-read #error { :cause ERROR: duplicate key value violates unique constraint "pk_view_log" Detail: Key (id)=(7) already exists. :via [{:type org.postgresql.util.PSQLException :message ERROR: duplicate key value violates unique constraint "pk_view_log" Detail: Key (id)=(7) already exists. :at [org.postgresql.core.v3.QueryExecutorImpl receiveErrorResponse QueryExecutorImpl.java 2198]}]
- While trying to access pulses:
04-09 03:59:44 WARN server.HttpChannel :: /api/pulse java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IPersistentMap
- While trying to access any of my saved questions:
04-09 04:00:23 DEBUG metabase.middleware :: GET /api/card/135 200 (4 ms) 04-09 04:00:23 WARN events.view-log :: Failed to process activity event. :card-read #error { :cause ERROR: duplicate key value violates unique constraint "pk_view_log" Detail: Key (id)=(8) already exists. :via [{:type org.postgresql.util.PSQLException :message ERROR: duplicate key value violates unique constraint "pk_view_log" Detail: Key (id)=(8) already exists. :at [org.postgresql.core.v3.QueryExecutorImpl receiveErrorResponse QueryExecutorImpl.java 2198]}] :trace
- Trying to run “SELECT 1” sql query manually:
04-09 04:00:57 DEBUG db.internal :: DB CALL: Database [:id :engine :details] (where (limit (select* ENTITY32256) 1) {:id database-id}) 04-09 04:00:57 DEBUG driver.generic-sql :: Creating new connection pool for database 14 ... 04-09 04:00:57 ERROR metabase.driver :: {:status :failed, :class java.lang.ClassCastException, :error "java.lang.ClassCastException", :stacktrace [], :query {:type "native", :native {:query "select 1"}, :constraints {:max-results 10000, :max-results-bare-rows 2000}}, :expanded-query nil} 04-09 04:00:57 ERROR metabase.driver :: Query failure: java.lang.ClassCastException 04-09 04:00:57 DEBUG common.internal :: ERROR: duplicate key value violates unique constraint "pk_query_queryexecution" Detail: Key (id)=(7) already exists.
Additionally I would like to mention that postgresql database was virgin clean before I have started migration via load-from-h2.
I was tried to run metabase on a clean postgresql database and it works okay: dashboards, pulses, questions, test manual query – everything works okay. So this is not server/database issue – something related to migration of data from H2.
Please advice!
Best Regards,
Max