Repository: incubator-sentry Updated Branches: refs/heads/master 3cec83721 -> 58efe72a1
SENTRY-564: Sentry metastore upgrade order is computed incorrectly (Sravya Tirukkovalur via Lenni Kuff) Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/58efe72a Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/58efe72a Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/58efe72a Branch: refs/heads/master Commit: 58efe72a1bbd7706ffa470a6b084ec96f1916925 Parents: 3cec837 Author: Lenni Kuff <[email protected]> Authored: Thu Dec 4 16:59:37 2014 -0800 Committer: Lenni Kuff <[email protected]> Committed: Thu Dec 4 16:59:47 2014 -0800 ---------------------------------------------------------------------- .../provider/db/service/persistent/SentryStoreSchemaInfo.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/58efe72a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStoreSchemaInfo.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStoreSchemaInfo.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStoreSchemaInfo.java index 46c14f4..983e792 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStoreSchemaInfo.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStoreSchemaInfo.java @@ -55,7 +55,7 @@ public class SentryStoreSchemaInfo { upgradeOrderList.add(currSchemaVersion.trim()); } } catch (FileNotFoundException e) { - throw new SentryUserException("File " + upgradeListFile + "not found ", e); + throw new SentryUserException("File " + upgradeListFile + " not found ", e); } catch (IOException e) { throw new SentryUserException("Error reading " + upgradeListFile, e); } @@ -78,8 +78,10 @@ public class SentryStoreSchemaInfo { // Find the list of scripts to execute for this upgrade int firstScript = sentrySchemaVersions.length; for (int i = 0; i < sentrySchemaVersions.length; i++) { - if (sentrySchemaVersions[i].startsWith(fromSchemaVer)) { + String fromVersion = sentrySchemaVersions[i].split("-to-")[0]; + if (fromVersion.equals(fromSchemaVer)) { firstScript = i; + break; } } if (firstScript == sentrySchemaVersions.length) {
