Repository: sentry Updated Branches: refs/heads/master 5b8cec9cd -> 5aea068eb
SENTRY-2028: Avoid datanucleus to create/update database schema (Kalyan Kumar Kalvagadda, reviewed by Na li and Sergio Pena) Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/5aea068e Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/5aea068e Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/5aea068e Branch: refs/heads/master Commit: 5aea068eb7bddd9343b66b9242123c8a31ea1f18 Parents: 5b8cec9 Author: Kalyan Kumar Kalvagadda <[email protected]> Authored: Mon Nov 6 09:59:52 2017 -0600 Committer: Kalyan Kumar Kalvagadda <[email protected]> Committed: Mon Nov 6 09:59:52 2017 -0600 ---------------------------------------------------------------------- .../sentry/provider/db/service/persistent/SentryStore.java | 6 ++++++ .../org/apache/sentry/service/thrift/ServiceConstants.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/5aea068e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java index 0cd6e48..7217dea 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java @@ -263,6 +263,12 @@ public class SentryStore { ServerConfig.SENTRY_VERIFY_SCHEM_VERSION, ServerConfig.SENTRY_VERIFY_SCHEM_VERSION_DEFAULT).equalsIgnoreCase( "true"); + + // Schema verification should be set to false only for testing. + // If it is set to false, appropriate datanucleus properties will be set so that + // database schema is automatically created. This is desirable only for running tests. + // Sentry uses <code>SentrySchemaTool</code> to create schema with the help of sql scripts. + if (!checkSchemaVersion) { prop.setProperty("datanucleus.schema.autoCreateAll", "true"); prop.setProperty("datanucleus.autoCreateSchema", "true"); http://git-wip-us.apache.org/repos/asf/sentry/blob/5aea068e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java index 0a1e0ae..7e02874 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java @@ -152,7 +152,7 @@ public class ServiceConstants { .put("datanucleus.validateColumns", "false") .put("datanucleus.validateConstraints", "false") .put("datanucleus.storeManagerType", "rdbms") - .put("datanucleus.schema.autoCreateAll", "true") + .put("datanucleus.schema.autoCreateAll", "false") .put("datanucleus.autoCreateSchema", "false") .put("datanucleus.fixedDatastore", "true") .put("datanucleus.autoStartMechanismMode", "checked")
