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

Unique Index Violation Error #6

Open
stanshillis opened this issue Feb 28, 2018 · 1 comment
Open

Unique Index Violation Error #6

stanshillis opened this issue Feb 28, 2018 · 1 comment

Comments

@stanshillis
Copy link

stanshillis commented Feb 28, 2018

Trying to use the plugin and i'm getting error/warning on the log related to plugin writing settings.
Error is a SQL index violation error for plugin settings insert statement.

It appears that this line is causing the error:
pluginSettingsFactory.createSettingsForKey(PLUGIN_KEY).put(pluginSettingsId, newSha);

PR i'm trying this on has multiple commits, if that makes a difference. I also created and deleted PR from this branch multiple times. First few attempts plugin was disabled.
BitBucket Server version 5.7.0

Error log entry:

o.h.e.jdbc.spi.SqlExceptionHelper Unique index or primary key violation: "UQ_PLUG_SETTING_NS_KEY_INDEX_4 ON PUBLIC.PLUGIN_SETTING(KEY_NAME, NAMESPACE) VALUES ( /* key:690 */ 'com.parallels.bitbucket.plugins.defaultreviewers', '112.275', null, null)"; SQL statement:
insert into plugin_setting (key_name, namespace, key_value, id) values (?, ?, ?, ?) [23505-176]

@atikhono
Copy link
Owner

atikhono commented May 3, 2018

Hi

pluginSettingsId is composed of the two values: repository id and pull request id, '112.275' in the error message. The pluginSettings put method should override the value. Looks like it's null in your case (see newSha). newSha is the pull request source branch top commit hash retrieved by https://docs.atlassian.com/bitbucket-server/javadoc/5.1.2/api/reference/com/atlassian/bitbucket/repository/Ref.html#getLatestCommit() which is nonnull. No idea what's going on. I cannot reproduce the issue. Could you please provide steps to reproduce it from scratch?

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

No branches or pull requests

2 participants