[
https://issues.apache.org/jira/browse/SENTRY-2342?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Na Li updated SENTRY-2342:
--------------------------
Description:
Right now, sentry software has the schema version it supports hard-coded, and
before starting its service, it gets schema version from DB and compare these
two values. If they are not equal, exception will be thrown and sentry service
won't start.
To support sentry services with different versions that connect to the same DB
at the same time, the schema version checking behavior has to be changed to
allow sentry software with older version to work with DB with newer schema
version.
There are two places that verifies schema version
1) In SentrySchemaTool when schema is created in DB or upgraded in DB. The
schema verification should be strict, i.e., ensure the Sentry Server version is
exactly the same as the DB schema version.
2) SentryStore when Sentry service is started after creating schema or
upgrading schema in DB. The schema verification should be loose, i.e., ensure
the Sentry Server schema version is compatible with the DB schema version.
When checking compatible in isSchemaVersionCompatible,
1) If DB version is based on schema version used by Sentry Server (DB version
string starts with Sentry Server schema version), then it is compatible with
Sentry server
2) DB version is shorter than the schema version used by Sentry Server, not
compatible
3) major version number not equal, not compatible
4) sentry server has same major version but newer minor version than DB, not
compatible.
5) sentry server has same major version but equal or smaller minor version than
DB, compatible.
The call stack when schema verification fails in SentryStore.
{code}
Exception in thread "main" java.lang.IllegalStateException: Could not create
org.apache.sentry.provider.db.service.persistent.SentryStore
at
org.apache.sentry.service.thrift.SentryService.getSentryStore(SentryService.java:210)
at
org.apache.sentry.service.thrift.SentryService.<init>(SentryService.java:168)
at
org.apache.sentry.service.thrift.SentryService$CommandImpl.run(SentryService.java:601)
at org.apache.sentry.SentryMain.main(SentryMain.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:226)
at org.apache.hadoop.util.RunJar.main(RunJar.java:141)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at
org.apache.sentry.service.thrift.SentryService.getSentryStore(SentryService.java:194)
... 9 more
Caused by: org.apache.sentry.provider.db.SentryAccessDeniedException: The
Sentry store schema version <DB_version> is different from distribution version
<Sentry_Server_Version>
at
org.apache.sentry.provider.db.service.persistent.SentryStore.verifySentryStoreSchema(SentryStore.java:280)
at
org.apache.sentry.provider.db.service.persistent.SentryStore.<init>(SentryStore.java:253)
... 14 more
{code}
was:
Right now, sentry software has the schema version it supports hard-coded, and
before starting its service, it gets schema version from DB and compare these
two values. If they are not equal, exception will be thrown and sentry service
won't start.
To support sentry services with different versions that connect to the same DB
at the same time, the schema version checking behavior has to be changed to
allow sentry software with older version to work with DB with newer schema
version.
> Update schema version verification to support multi-version clusters share
> same DB
> ----------------------------------------------------------------------------------
>
> Key: SENTRY-2342
> URL: https://issues.apache.org/jira/browse/SENTRY-2342
> Project: Sentry
> Issue Type: New Feature
> Components: Sentry
> Affects Versions: 2.1.0
> Reporter: Na Li
> Assignee: Na Li
> Priority: Critical
> Attachments: SENTRY-2342.001.patch, SENTRY-2342.001.patch
>
>
> Right now, sentry software has the schema version it supports hard-coded, and
> before starting its service, it gets schema version from DB and compare these
> two values. If they are not equal, exception will be thrown and sentry
> service won't start.
> To support sentry services with different versions that connect to the same
> DB at the same time, the schema version checking behavior has to be changed
> to allow sentry software with older version to work with DB with newer schema
> version.
> There are two places that verifies schema version
> 1) In SentrySchemaTool when schema is created in DB or upgraded in DB. The
> schema verification should be strict, i.e., ensure the Sentry Server version
> is exactly the same as the DB schema version.
> 2) SentryStore when Sentry service is started after creating schema or
> upgrading schema in DB. The schema verification should be loose, i.e., ensure
> the Sentry Server schema version is compatible with the DB schema version.
> When checking compatible in isSchemaVersionCompatible,
> 1) If DB version is based on schema version used by Sentry Server (DB version
> string starts with Sentry Server schema version), then it is compatible with
> Sentry server
> 2) DB version is shorter than the schema version used by Sentry Server, not
> compatible
> 3) major version number not equal, not compatible
> 4) sentry server has same major version but newer minor version than DB, not
> compatible.
> 5) sentry server has same major version but equal or smaller minor version
> than DB, compatible.
> The call stack when schema verification fails in SentryStore.
> {code}
> Exception in thread "main" java.lang.IllegalStateException: Could not create
> org.apache.sentry.provider.db.service.persistent.SentryStore
> at
> org.apache.sentry.service.thrift.SentryService.getSentryStore(SentryService.java:210)
> at
> org.apache.sentry.service.thrift.SentryService.<init>(SentryService.java:168)
> at
> org.apache.sentry.service.thrift.SentryService$CommandImpl.run(SentryService.java:601)
> at org.apache.sentry.SentryMain.main(SentryMain.java:117)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.hadoop.util.RunJar.run(RunJar.java:226)
> at org.apache.hadoop.util.RunJar.main(RunJar.java:141)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> at
> org.apache.sentry.service.thrift.SentryService.getSentryStore(SentryService.java:194)
> ... 9 more
> Caused by: org.apache.sentry.provider.db.SentryAccessDeniedException: The
> Sentry store schema version <DB_version> is different from distribution
> version <Sentry_Server_Version>
> at
> org.apache.sentry.provider.db.service.persistent.SentryStore.verifySentryStoreSchema(SentryStore.java:280)
> at
> org.apache.sentry.provider.db.service.persistent.SentryStore.<init>(SentryStore.java:253)
> ... 14 more
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)