flyway-awslambda icon indicating copy to clipboard operation
flyway-awslambda copied to clipboard

limit of number of files the flyway lambda can execute

Open lokesha02 opened this issue 6 years ago • 1 comments

I have around 2000 DB schema files. But flyway lambda fails with error saying cannot find flyway.conf file. But when i reduce the file count to below 200 in the S3, it successfully deploys.

so what should we do if more files present. Any suggestions on running the scripts in batches

lokesha02 avatar Jun 08 '19 01:06 lokesha02

I was able to resolve the above issue. Limitation was with S3Client object, listObjects method will only first 1000 objects. To fetch remaining object, listNextBatchOfObjects method need to be invoked till all objects are fetched based on the isTrucated method. I modified the code which fetch objectsummary as below:

val objectSummaries = { var objects = s3Client.listObjects(srcBucketName, srcPrefix) val objectSummaryList = objects.getObjectSummaries()

  while(objects.isTruncated()){
	objects = s3Client.listNextBatchOfObjects(objects)
	objectSummaryList.addAll(objects.getObjectSummaries())
	logger.log(s"GetSummaries ${objectSummaryList.size()}")
  }
  objectSummaryList.asScala.toList.sortWith { (x, y) =>
    x.getKey.compareTo(y.getKey) < 1
  }
}

lokesha02 avatar Jun 16 '19 19:06 lokesha02