Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apache Phoenix Support #929

Closed
jmahonin opened this issue Jan 14, 2015 · 13 comments
Closed

Apache Phoenix Support #929

jmahonin opened this issue Jan 14, 2015 · 13 comments

Comments

@jmahonin
Copy link
Contributor

@jmahonin jmahonin commented Jan 14, 2015

Phoenix (http://phoenix.apache.org/) is an open source relational DB over HBase that exposes a JDBC driver.

I've got a working implementation as well as unit tests that I'll be putting in a pull request. It works against a stand-alone Phoenix cluster, but the tests run against an in-memory HBase cluster. Some comments from the commit message below:

It has been set up as an EmbeddedDB, although the Phoenix tests
should be disabled by default unless run in the new 'PhoenixDBTest'
profile.

Notable changes to core classes:

  • MetaDataTableImpl:

Due to Phoenix's peculiar syntax, the hardcoded statements in
addAppliedMigration() and updateChecksum() won't work. It now
attempts to load a .sql template and run that, if it exists.

  • MigrationTestCase:

Added checks for applied migrations of type MigrationType.SCHEMA
and adjusted asserts accordingly. Also added a 'getBaseDir()'
method, and replaced direct calls to BASEDIR with this. Several of
the tests in MigrationTestCase can then be used in the Phoenix
tests by overriding that method.

@anirudha13
Copy link

@anirudha13 anirudha13 commented Mar 24, 2015

@jmahonin I have ulterior motives in seeing this work merged with the mainline. Please let me know how I can help.

@jmahonin
Copy link
Contributor Author

@jmahonin jmahonin commented Mar 24, 2015

@anirudha13 Me too!

If you could do some quick testing with it and let me know how it goes, that'd be appreciated. We're using it internally already, and it passes the migration test suite, but having some assurance from another party would be appreciated.

@anirudha13
Copy link

@anirudha13 anirudha13 commented May 1, 2015

@jmahonin ran some very basic tests using the flyway command line utility from this pull request. Things work like a charm. Will keep you updated if something breaks.

@jmahonin
Copy link
Contributor Author

@jmahonin jmahonin commented May 1, 2015

Fantastic. Out of curious its, what version of Phoenix were you using?

@jmahonin
Copy link
Contributor Author

@jmahonin jmahonin commented May 1, 2015

sigh On mobile, excuse the typos. "Out of curiosity" :)

@anirudha13
Copy link

@anirudha13 anirudha13 commented May 1, 2015

v4.3.1 with HBase - 0.98.6 CDH 5.3.2

@chiastic-security
Copy link

@chiastic-security chiastic-security commented May 11, 2015

Good work, guys!

Is this likely to make it into a release in the near future? I'm wanting to use flyway with Phoenix, and not sure whether to wait for it to be pulled in, or find another way.

@anirudha13
Copy link

@anirudha13 anirudha13 commented May 11, 2015

@jmahonin while running the unit tests I get this failure,

Running org.flywaydb.core.internal.dbsupport.phoenix.PhoenixMigrationMediumTest
Tests run: 29, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1,054.234 sec <<< FAILURE! - in org.flywaydb.core.internal.dbsupport.phoenix.PhoenixMigrationMediumTest
validateClean(org.flywaydb.core.internal.dbsupport.phoenix.PhoenixMigrationMediumTest)  Time elapsed: 22.929 sec  <<< FAILURE!
java.lang.AssertionError: expected:<1> but was:<0>
    at org.junit.Assert.fail(Assert.java:88)
    at org.junit.Assert.failNotEquals(Assert.java:743)
    at org.junit.Assert.assertEquals(Assert.java:118)
    at org.junit.Assert.assertEquals(Assert.java:555)
    at org.junit.Assert.assertEquals(Assert.java:542)
    at org.flywaydb.core.migration.MigrationTestCase.validateClean(MigrationTestCase.java:267)

Any idea why this is failing?

@jmahonin
Copy link
Contributor Author

@jmahonin jmahonin commented May 11, 2015

Hmm, very strange, I'm getting the same. I must have pushed a wrong branch, or missed a commit. Will investigate further.

@jmahonin
Copy link
Contributor Author

@jmahonin jmahonin commented May 11, 2015

I got myself in a tangle with my personal repo and the company repos it looks like. I've closed that PR and updated a new one here. The unit tests pass for me.

#1012

@axelfontaine axelfontaine added this to the Flyway 4.0 milestone Dec 23, 2015
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Dec 23, 2015
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 18, 2016

@jmahonin Is there a reason why the metadata table creation statement lacks the not null constraints it should have?

@jmahonin
Copy link
Contributor Author

@jmahonin jmahonin commented Jan 18, 2016

In Phoenix, you can only specify 'NOT NULL' constraints on columns which are part of the primary key. Since the primary key in this case is 'installed_rank', it's the only column which gets that constraint.

Is this causing any issues or side-effects?

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 18, 2016

No, just wanted to make sure it wasn't an accidental omission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants