patka / cassandra-migration

Schema migration library for Cassandra
MIT License
152 stars 47 forks source link

Default Migration Path is not Found #54

Closed dnsbtchr closed 3 years ago

dnsbtchr commented 3 years ago

Hi, I started using your library in this setup:

During startup it logs this: 2020-10-19 08:53:19.234 DEBUG 1 --- [ main] o.c.c.migration.MigrationRepository : Scanning for cql migration scripts in cassandra/migration/ 2020-10-19 08:53:19.234 DEBUG 1 --- [ main] o.c.c.migration.MigrationRepository : Potential script folder: jar:file:/app/application.jar!/BOOT-INF/classes!/cassandra/migration/ 2020-10-19 08:53:19.235 DEBUG 1 --- [ main] o.c.c.m.scanner.JarLocationScanner : Scanning in jar jar:file:/app/application.jar!/BOOT-INF/classes!/cassandra/migration/ in location cassandra/migration/ 2020-10-19 08:53:19.235 DEBUG 1 --- [ main] o.c.c.m.scanner.JarLocationScanner : Trying to get existing filesystem for jar:file:/app/application.jar!/BOOT-INF/classes!/cassandra/migration/ 2020-10-19 08:53:19.244 DEBUG 1 --- [ main] o.c.c.m.scanner.JarLocationScanner : Creating new filesystem for jar:file:/app/application.jar!/BOOT-INF/classes!/cassandra/migration/

Eventually it fails with: Caused by: java.nio.file.NoSuchFileException: cassandra/migration at jdk.zipfs/jdk.nio.zipfs.ZipPath.getAttributes(ZipPath.java:742) at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.readAttributes(ZipFileSystemProvider.java:292) at java.base/java.nio.file.Files.readAttributes(Files.java:1763) at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219) at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276) at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322) at java.base/java.nio.file.FileTreeIterator.<init>(FileTreeIterator.java:71) at java.base/java.nio.file.Files.walk(Files.java:3822) at java.base/java.nio.file.Files.walk(Files.java:3876) at org.cognitor.cassandra.migration.scanner.JarLocationScanner.findResourceNames(JarLocationScanner.java:34) at org.cognitor.cassandra.migration.MigrationRepository.scanForScripts(MigrationRepository.java:189) at org.cognitor.cassandra.migration.MigrationRepository.<init>(MigrationRepository.java:135) ... 72 common frames omitted

I checked the docker container and can see the folder there: root@mycontainer-7cbd86969d-lkwd9:/app# jar -tf application.jar ... BOOT-INF/classes/cassandra/ BOOT-INF/classes/cassandra/migration/ BOOT-INF/classes/cassandra/migration/01_create-ad-table.cql

The permissions of the file are set to read by everyone, also I would expect another error if the permissions were there problem. I'm really looking forward to get some help here.

Thanks Dennis

dnsbtchr commented 3 years ago

What makes me wonder is the file path containing 2 exclamation marks: jar:file:/app/application.jar!/BOOT-INF/classes!/cassandra/migration/ The application uses the spring-boot-maven-plugin with repackage. Maybe that's the reason. Is there an example of this library being working in a Spring Boot app using this pluign?

patka commented 3 years ago

Hi Dennis,

yes, there was an issue addressing the spring boot jar: https://github.com/patka/cassandra-migration/issues/18 Can you check if you are able to run the application by just running the jar file outside of docker and kubernetes? Did you try stepping through the code while it executes to see what is executed and try to get a glimpse on how the JVM sees the filesystem?

I unfortunately have no experience in using Kubernetes clusters with Docker, nor do I currently have the capacity to set this up in my spare time, so any details you can provide would be of great help.

Cheers Patrick

dnsbtchr commented 3 years ago

Hi @patka ,

thanks for the quick response. Since the issue you mentioned is exactly my problem, I'll check out if I can get it running with what was recommended there.

Thanks! Dennis