Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push stops after Channel Groups fail to be imported #39

Open
cerny opened this issue Apr 27, 2022 · 4 comments
Open

Push stops after Channel Groups fail to be imported #39

cerny opened this issue Apr 27, 2022 · 4 comments

Comments

@cerny
Copy link

cerny commented Apr 27, 2022

It seems that during a push there are multiple attempts to create the Channel Groups. An underlying DB primary key violation is being thrown. This occurs using the force option too.

←[39mDEBUG←[0;39m: posting xml to: /channelgroups/_bulkUpdate
clojure.lang.ExceptionInfo: clj-http: status 500 {:cached nil, :request-time 125, :repeatable? false, :protocol-version {:name "HTTP", :major 1, :minor 1}, :streaming? true, :http-client #object[org.apache.http.impl.client.InternalHttpClient 0x5a237731 "org.apache.http.impl.client.InternalHttpClient@5a237731"], :chunked? true, :type :clj-http.client/unexceptional-status, :reason-phrase "Internal Server Error", :headers {"Access-Control-Allow-Headers" "Content-Type", "Server" "nginx", "Content-Type" "application/xml", "Access-Control-Allow-Origin" "*", "X-Frame-Options" "DENY", "Strict-Transport-Security" ["max-age=31536000; includeSubDomains" "max-age=31536000; includeSubDomains"], "Connection" "close", "Transfer-Encoding" "chunked", "Access-Control-Allow-Methods" "GET, POST, DELETE, PUT", "Date" "Wed, 27 Apr 2022 15:27:01 GMT", "Access-Control-Allow-Credentials" "false", "Content-Security-Policy" ["frame-ancestors 'none'" "upgrade-insecure-requests"]}, :orig-content-encoding nil, :status 500, :length -1, :body "<com.mirth.connect.client.core.ControllerException>\n org.apache.ibatis.exceptions.PersistenceException: \n### Error updating database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'PK__CHANNEL___3214EC27E4615C0E'. Cannot insert duplicate key in object 'dbo.CHANNEL_GROUP'. The duplicate key value is (3e807410-ed18-4217-a4e7-d924df8cc5d4). \n### The error may involve Channel.insertChannelGroup-Inline \n### The error occurred while setting parameters \n### SQL: INSERT INTO CHANNEL_GROUP (ID, NAME, REVISION, CHANNEL_GROUP) VALUES (?, ?, ?, ?) \n### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'PK__CHANNEL___3214EC27E4615C0E'. Cannot insert duplicate key in object 'dbo.CHANNEL_GROUP'. The duplicate key value is (3e807410-ed18-4217-a4e7-d924df8cc5d4).\n <cause class="com.mirth.connect.client.core.api.PersistenceException">\n \n### Error updating database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'PK__CHANNEL___3214EC27E4615C0E'. Cannot insert duplicate key in object 'dbo.CHANNEL_GROUP'. The duplicate key value is (3e807410-ed18-4217-a4e7-d924df8cc5d4). \n### The error may involve Channel.insertChannelGroup-Inline \n### The error occurred while setting parameters \n### SQL: INSERT INTO CHANNEL_GROUP (ID, NAME, REVISION, CHANNEL_GROUP) VALUES (?, ?, ?, ?) \n### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'PK__CHANNEL___3214EC27E4615C0E'. Cannot insert duplicate key in object 'dbo.CHANNEL_GROUP'. The duplicate key value is (3e807410-ed18-4217-a4e7-d924df8cc5d4).\n <cause class="com.microsoft.sqlserver.jdbc.SQLServerException">\n Violation of PRIMARY KEY constraint 'PK__CHANNEL___3214EC27E4615C0E'. Cannot insert duplicate key in object 'dbo.CHANNEL_GROUP'. The duplicate key value is (3e807410-ed18-4217-a4e7-d924df8cc5d4).\n \n com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)\n com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1632)\n com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:602)\n com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:524)

@jessesaga
Copy link
Contributor

This sounds to me like an issue with renames and deletions as described in #26 and the workaround described there may fix the issue.

@cerny
Copy link
Author

cerny commented Apr 27, 2022

I did a fresh pull, deleted all the old channels in the target Mirth server, and then confirmed that the appropriate DB table was empty. I also grepped all the pulled files and both the channel GUID and channel name and they only appeared once. Also looked at issues #26 and #33.

@jessesaga
Copy link
Contributor

Can you create some minimal target directory that reproduces this push issue and attach it so that I can try and replicate the issue?

@cerny
Copy link
Author

cerny commented May 25, 2022

Circling back on this now that I have a free environment to play around in. I tried creating a small working example that reproduces the issue, but I'm currently unable to successfully do so after having deleted all the channels and channel groups and starting from scratch. I did see that there is an "override" query string parameter for /channelgroups/_bulkUpdate POST method, which may have solved the problem. I did see that this is already referenced in the MirthSync project as a TODO here: apis.clj. If I run into this issue again I will provide a minimal example.

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

No branches or pull requests

2 participants