Closed Ignas closed 6 years ago
Thanks for your contribution @Ignas ! Before I can merge it, can you please write some test to check this condition?
Hi @Ignas , can you elaborate the steps to reproduce the issue (i.e. triggering the NoSuchElementException
)?
I've tried adding an empty migrations directory and no exceptions are thrown. The for-loop at for (versionRow in versionRows) { ... }
and for (i in migrationVersions.indices) { ... }
are skipped if no prior migrations exists or versionRows
is empty.
Issue #65 is resolved by the change. This can be easily reproduced with newer cassandra drivers.
Ok, strike that, this does not resolve the issue, it seems that even when versions table is populated empty batch still gets executed. So the fix should instead check that batch is empty and skip it.
I just removed the batch generation code, as if batch has statements in it - it does not get executed ever.
Thank you for your PR, sorry it was left open for too long!
Summary
This works around java.util.NoSuchElementException being returned by cassandra server when executing an empty batch.
Pull Request (PR) Checklist
Documentation
README.md
or Wiki updatedCode Review
Tests