It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JiraPluginSettings with Data Center

Is it safe to use JiraPluginSettings in clustered environment? 

If not, how to store plugin settings (changed infrequently) in a safe way?

@Chris Fuller, you are probably the best person to ask.

Thank you,
Gebsun 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
crf Atlassian Team Dec 30, 2015

No.  And it's such a terrible interface, I'm not sure why you would want to, anyway. smile

The list of what's wrong with PluginSettings is a long one, but here's a small taste:

  1. There is no way to ask it what keys exist.  Plugins generally work around this by using a known key that contains a list of all of the other keys.  That list and the entries cannot be updated atomically, which can lead to data corruption even without a cluster.  (Applinks suffers from this, for example)
  2. The namespacing strategy is embarrassing.  You can say your plugin data belongs to a project (saying it belongs to anything else, per spec, should throw an IllegalArgumentException), or you can stick it in the global settings with a prefix.  This global namespace is exactly the same one that ApplicationProperties uses, but the encoding of the data is slightly different, so they pollute each other's namespaces with differently encoded information.  Awesome.
  3. The backend storage that it uses is just PropertySet, which you could use directly if you wanted to.  Of course, that itself is a rather nasty beast that splits its information across multiple tables.  It has the main table for entries and each data type (number, string, text = strings greater than 255 chars, date, etc.) goes to a different table. This has its advantages, but efficiency and atomic updates aren't on that list.  You can't do updates to that safely without a cluster lock, so the same is true of PluginSettings.

I could go on, but look, please just no.

PluginSettings really has no point in existing at all except that Cloud (called Studio at the time) needed some storage mechanism that cross-product plugins like Applinks could use before we had Active Objects available to answer that question.  Even though it has its own set of problems, AO is at least an improvement over PluginSettings.

The strategy that Atlassian's own JIRA plugins are using for this is to use AO to describe the schema management, but the more flexible PocketKnife QueryDSL library to do the actual data manipulation, as it can do all the things like optimistic updates that you really need to achieve cluster safety and still keep your sanity.  It isn't perfect (for example, AO can't declare multi-column indexes and blows up trying to remove any that you added yourself), but I think that this is the best answer we currently have available to us.

 

You are guru and that's not flattery :-).

Excellent and clear answer. Thank you. I believe Atlassian should invest into documentation more. PluginSettings are still marketed all around in docs, e.g.: https://developer.atlassian.com/docs/common-coding-tasks/storing-plugin-settings https://developer.atlassian.com/docs/getting-started/learn-the-development-platform-by-example/store-and-retrieve-plugin-data

crf Atlassian Team Dec 30, 2015

Fair cop. Unfortunately, these search-and-destroy missions are always a bit difficult and our first line of defense as developers is always to mark the old way as deprecated. Nobody has actually gotten around to doing that to PluginSettings, yet. Also, those tutorials aren't aimed at JIRA Data Center compatibility in particular; they're just a quick and dirty getting started guide. There are more comprehensive instructions for JDC here: https://developer.atlassian.com/jiradev/jira-platform/jira-data-center/plugin-guide-to-jira-high-availability-and-clustering (although, sadly, they don't talk about plugin data storage in particular, either)

Community showcase
Posted in Jira Software

Metrics Fun: 2019 in Review

Hello, Atlassian Community!  I thought it would be fun to do something different for my teams' last retrospective of 2019 so I'm planning to do a "year in review" with info-graphics.  Wha...

219 views 4 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you