Uploaded image for project: 'Sentry'
  1. Sentry
  2. SENTRY-2200

Migrate 3.x Datanucleus unsupported configurations to 4.1 Datanucleus

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.1.0
    • Component/s: Sentry
    • Labels:
      None

      Description

      Since 2.0, the datanucleus version in Sentry changed from 3.2 to 4.1.

      Based on the datanucleus documentation following config names are renamed. Sentry has several places use those configuration names. We should update the config names to reflect the correct names.

      Migration from 3.3.7 to 4.0.0.M1
      Migrating will require the following changes
      
      Persistence property datanucleus.allowAttachOfTransient now defaults to true for JPA usage; set it explicitly to get old behaviour
      Persistence property datanucleus.metadata.validate was removed (replaced by datanucleus.metadata.xml.validate some time back)
      Persistence property datanucleus.defaultInheritanceStrategy is renamed to datanucleus.metadata.defaultInheritanceStrategy
      Persistence property datanucleus.autoCreateSchema is renamed to datanucleus.schema.autoCreateAll
      Persistence property datanucleus.autoCreateTables is renamed to datanucleus.schema.autoCreateTables
      Persistence property datanucleus.autoCreateColumns is renamed to datanucleus.schema.autoCreateColumns
      Persistence property datanucleus.autoCreateConstraints is renamed to datanucleus.schema.autoCreateConstraints
      Persistence property datanucleus.validateSchema is renamed to datanucleus.schema.validateAll
      Persistence property datanucleus.validateTables is renamed to datanucleus.schema.validateTables
      Persistence property datanucleus.validateColumns is renamed to datanucleus.schema.validateColumns
      Persistence property datanucleus.validateConstraints is renamed to datanucleus.schema.validateConstraints
      Persistence property datanucleus.fixedDatastore is now removed, since it only equated to setting the "autoCreate" properties to false.

      One example in SentryStore

        public SentryStore(Configuration conf) throws Exception {
          this.conf = conf;
          Properties prop = getDataNucleusProperties(conf);
          boolean checkSchemaVersion = conf.get(
              ServerConfig.SENTRY_VERIFY_SCHEM_VERSION,
              ServerConfig.SENTRY_VERIFY_SCHEM_VERSION_DEFAULT).equalsIgnoreCase(
              "true");
          if (!checkSchemaVersion) {
            prop.setProperty("datanucleus.autoCreateSchema", "true");
            prop.setProperty("datanucleus.fixedDatastore", "false");
          }
      

      In ServiceConstants

          public static final ImmutableMap<String, String> SENTRY_STORE_DEFAULTS =
              ImmutableMap.<String, String>builder()
              .put("datanucleus.connectionPoolingType", "BoneCP")
              .put("datanucleus.validateTables", "false")
              .put("datanucleus.validateColumns", "false")
              .put("datanucleus.validateConstraints", "false")
              .put("datanucleus.storeManagerType", "rdbms")
              .put("datanucleus.autoCreateSchema", "false")
              .put("datanucleus.fixedDatastore", "true")
              .put("datanucleus.autoStartMechanismMode", "checked")
              .put(DATANUCLEUS_ISOLATION_LEVEL, DATANUCLEUS_REPEATABLE_READ)
              .put("datanucleus.cache.level2", "false")
              .put("datanucleus.cache.level2.type", "none")
              .put("datanucleus.query.sql.allowAll", "true")
              .put("datanucleus.identifierFactory", "datanucleus1")
              .put("datanucleus.rdbms.useLegacyNativeValueStrategy", "true")
              .put("datanucleus.plugin.pluginRegistryBundleCheck", "LOG")
              .put("javax.jdo.PersistenceManagerFactoryClass",
                  "org.datanucleus.api.jdo.JDOPersistenceManagerFactory")
                  .put("javax.jdo.option.DetachAllOnCommit", "true")
                  .put("javax.jdo.option.NonTransactionalRead", "false")
                  .put("javax.jdo.option.NonTransactionalWrite", "false")
                  .put("javax.jdo.option.Multithreaded", "true")
                  .build();
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                xyu2017 Xinran Tinney
                Reporter:
                LinaAtAustin Na Li
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: