flyway outOfOrder is not working as expected - flyway

I am trying to apply an outOfOrder migration using maven on a "production support" branch (i.e. V3.1). The 3.1 branch has 12 migrations 3.1.0.1 through 3.1.0.12. The first 11 have been applied and in my development environment I have two migrations from the next release 3.3 already applied. the info looks like this:
+----------------+----------------------------+---------------------+---------+
| Version | Description | Installed on | State |
+----------------+----------------------------+---------------------+---------+
| 1 | > | 2013-08-16 16:35:22 | Success |
| 3.1.0.1 | CCI DDL | 2013-08-16 16:41:04 | Success |
| 3.1.0.2 | Update 1 | 2013-08-19 12:17:43 | Success |
| 3.1.0.3 | Add SVT ITEM HISTORY | 2013-08-21 16:24:28 | Success |
| 3.1.0.4 | Drop Col Event Key From ED | 2013-08-27 14:15:36 | Success |
| 3.1.0.5 | Add Job Begin Time COL | 2013-10-10 14:59:14 | Success |
| 3.1.0.6 | Update SVT Column Lengths | 2013-10-23 10:25:33 | Success |
| 3.1.0.7 | Add Seq Number to EDC ECRF | 2013-12-03 14:59:31 | Success |
| 3.1.0.8 | Set EDC ECRF ITEM Seq Numb | 2013-12-03 15:27:08 | Success |
| 3.1.0.9 | Add Table EDC USV FORM | 2013-12-03 15:37:47 | Success |
| 3.1.0.10 | Add Table SVT USV FORM MAP | 2013-12-03 15:52:24 | Success |
| 3.1.0.11 | Add Tables SUBJECT VISIT Q | 2014-04-29 17:09:13 | OutOrde |
| 3.1.0.12 | Add Table BOGUS ERIC TEST | | Ignored |
| 3.3.0.1 | Insert iMedidata CRS Info | 2014-04-24 10:50:38 | Future |
| 3.3.0.2 | Insert Study OBJECT TYPE | 2014-04-24 11:14:37 | Future |
+----------------+----------------------------+---------------------+---------+
I run the following command in my mvn build output folder in the V3.1 branch:
mvn flyway:migrate -Dflyway.outOfOrder=true -P
and I get the following output:
[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:3.0:migrate (default-cli) on project mdmws: org.flywaydb.core.api.FlywayException: Validate failed. Found differences between applied migrations and available migrations: Detected applied migration missing on the classpath: 3.3.0.1 -> [Help 1]
It seems to want to find the 3.3 migrations that have already been applied to the database in the same classpath target/db/migrations folder, but of course these files exist in a later release branch. Either I am missing some configuration setting or I do not understand the way the outOfOrder works. I do not want to pull these files back from the V3.3 branch to the V3.1 branch.
Can somebody please help explain?
My pom inherits the following from a parent pom and most of the configuration values are passed in from the profile:
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>3.0</version>
<configuration>
<driver>${flyway.driver}</driver>
<url>${flyway.url}</url>
<user>${flyway.user}</user>
<password>${flyway.password}</password>
<outOfOrder>${flyway.outOfOrder}</outOfOrder>
</configuration>
<dependencies>
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
</dependencies>
</plugin>

Set validateOnMigrate to false and you should be OK. By default it will check whether the resolved and the applied migrations match. In your specific situation this won't work, so you have to disable it.

That's my solution. I configured flyway in Java code. Yes, I set validateOnMigrate - false.
#Bean(name = "flyway")
#Lazy(false)
public Flyway buildConfiguredFlyway() {
Flyway flyway = configure();
if (!validate(flyway)) {
migrate(flyway);
}
return flyway;
}
private Flyway configure() {
Flyway flyway = new Flyway();
flyway.setDataSource(datasource);
flyway.setBaselineOnMigrate(true);//Create meta-data table if it did not exist.
flyway.setValidateOnMigrate(false);
return flyway;
}
private boolean validate(Flyway flyway) {
try {
flyway.validate();
return true;
} catch (FlywayException o) {
return false;
}
}
private void migrate(Flyway flyway) {
try {
int result = flyway.migrate();
LOGGER.info("Number of DB mirgations successfully applied: " + result);
} catch (FlywayException e) {
LOGGER.error(e.getMessage(), e);
((ConfigurableApplicationContext) applicationContext).stop();
}
}

Related

OpenStack Mistral workflow error while executing using GUI

I am getting error while executing OpenStack simple mistral workflow on OpenStack(wallaby) devstack environment. While I can execute the workflow from CLI command and got success But it fails if I try the same thing with GUI
root#openstack:~# openstack workflow definition show test_get
---
version: '2.0'
test_get:
description: Test Get.
tasks:
my_task:
action: std.http
input:
url: http://www.google.com
root#openstack:~# openstack workflow execution create test_get
+--------------------+--------------------------------------+
| Field | Value |
+--------------------+--------------------------------------+
| ID | 482e3803-45ef-411e-a0f4-1427abfc8649 |
| Workflow ID | 9dc0d4a4-8c5b-4288-8126-e1147da3bd02 |
| Workflow name | test_get |
| Workflow namespace | |
| Description | |
| Task Execution ID | <none> |
| Root Execution ID | <none> |
| State | RUNNING |
| State info | None |
| Created at | 2021-06-21 16:58:54 |
| Updated at | 2021-06-21 16:58:54 |
| Duration | ... |
+--------------------+--------------------------------------+
But while executing in GUI I get **
Execution is missing field "workflow_identifier"
**
Faced the same issue in Yoga release. Spent a few hours to investigate it and found interesting thing:
/usr/local/lib/python3.8/dist-packages/mistralclient/api/v2/executions.py
class ExecutionManager(base.ResourceManager):
resource_class = Execution
def create(self, wf_identifier='', namespace='',
workflow_input=None, description='', source_execution_id=None,
**params):
self._ensure_not_empty(
workflow_identifier=wf_identifier or source_execution_id
)
But! in the webform we are using workflow_identifier instead of wf_identifier
/usr/local/lib/python3.8/dist-packages/mistraldashboard/workflows/forms.py
def handle(self, request, data):
try:
data['workflow_identifier'] = data.pop('workflow_name')
data['workflow_input'] = {}
for param in self.workflow_parameters:
value = data.pop(param)
if value == "":
value = None
data['workflow_input'][param] = value
ex = api.execution_create(request, **data)
FIX is to rename workflow_identifier to wf_identifier in the form like
data['wf_identifier'] = data.pop('workflow_name')
After that mistral-dashboard works fine with execution creating.

Centos7.8 install openstack mitaka version, control the node to install mirror service glance, the mirror contains problems

Centos7.8 install openstack mitaka version, control the node to install mirror service glance, the mirror contains problems
According to the official documentation Mitaka official documentation operations, Step 3 Upload the image to the image service using the QCOW2 disk format, bare container format, and public visibility so all projects can access it:
I execute the following command
openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
The size of the image in the output is zero. How should I check this problem
[root#controller ~]# openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | d41d8cd98f00b204e9800998ecf8427e |
| container_format | bare |
| created_at | 2020-05-24T14:45:54Z |
| disk_format | qcow2 |
| file | /v2/images/c89f6866-0c48-4ee5-84f1-bf7fa0998edf/file |
| id | c89f6866-0c48-4ee5-84f1-bf7fa0998edf |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | a9629b19eb9348adbf02a5432dd79411 |
| protected | False |
| schema | /v2/schemas/image |
| size | 0 |
| status | active |
| tags | |
| updated_at | 2020-05-24T14:45:54Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+

docker - multiple projects on one Dockerfile and docker-compose.yml

I'm starting with Docker and in my opinion is great! Now I'm looking solution for this organization:
Now I have this structure:
Applications
| +--app1
| | +--node_modules
| | +--package.json
| | +--...
| +--app2
| | +--node_modules
| | +--package.json
| | +--...
| ....
| docker-compose.app1.yml
| docker-compose.app2.yml
| ....
| Dockerfile //my personalized image for all projects
But I want reach this:
Applications
| +--app1
| | +--node_modules //empty in host
| | +--package.json
| | +--docker-compose.app1.yml //override compose
| | +--...
| +--app2
| | +--node_modules //empty in host
| | +--package.json
| | +--...
| ....
| +--node_modules //global node_modules folder (linked to projects)
| docker-compose.yml //principal compose
| Dockerfile //my personalized image for all projects
I thinking too about create one global "server" and link all projects on VHosts but how I'll get access to each of project?
You are looking for docker-comopose extends. Thas permits you override previus configurations.
web:
extends: file: common-services.yml
service: webapp
See full documentation in : https://docs.docker.com/compose/extends/#extending-services

MariaDB InnoDB table: how to find statement causing "waiting for table metadata lock"

How do I determine what the SQL statement is of the thread ID showing up in a metadata lock info row (SELECT * FROM information_schema.metadata_lock_info) on MariaDB?
Server version: 10.0.15-MariaDB MariaDB Server
All of the related questions dive into the "Waiting for table metadata lock" from a MySQL perspective, but that does not help with MariaDB since their introspection is implemented differently from what I can tell. Googling around does not turn up a whole lot.
A "show full processlist" gives rows like:
| 57295 | main | localhost | joints | Execute | 50 | Waiting for table metadata lock | select ...
Which does show the statement, but does not show that it has the lock either. So, I turned on metadata lock info as explained here [0]. This only provides the thread ID of the lock holder, but not the statement:
MariaDB [joints]> SELECT * FROM information_schema.metadata_lock_info;
+-----------+--------------------------+-----------------+----------------------+--------------+----------------+
| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE | TABLE_SCHEMA | TABLE_NAME |
+-----------+--------------------------+-----------------+----------------------+--------------+----------------+
| 57322 | MDL_INTENTION_EXCLUSIVE | MDL_EXPLICIT | Global read lock | | |
| 57322 | MDL_SHARED_NO_READ_WRITE | MDL_EXPLICIT | Table metadata lock | joints | 16_study |
| 57322 | MDL_INTENTION_EXCLUSIVE | MDL_EXPLICIT | Schema metadata lock | joints | |
| 57269 | MDL_SHARED_READ | MDL_TRANSACTION | Table metadata lock | joints | authentication |
| 57301 | MDL_SHARED_READ | MDL_TRANSACTION | Table metadata lock | joints | authentication |
| 57280 | MDL_SHARED_READ | MDL_TRANSACTION | Table metadata lock | joints | authentication |
| 57317 | MDL_SHARED_READ | MDL_TRANSACTION | Table metadata lock | joints | ship |
| 57271 | MDL_SHARED_READ | MDL_TRANSACTION | Table metadata lock | joints | administration |
| 57264 | MDL_SHARED_READ | MDL_TRANSACTION | Table metadata lock | joints | server |
+-----------+--------------------------+-----------------+----------------------+--------------+----------------+
What I really want is to see the "join" of both of those outputs at the moment the locking is happening. I do not see a way to join the data from these two "tables" since the former does not appear to be a table. I'd like to avoid getting:
ERROR 1933 (HY000): Target is not running an EXPLAINable command
while attempting to do it in real-time, due to the thread ending while being inspected.
[0] https://mariadb.com/kb/en/mariadb/metadata_lock_info/
THREAD_ID maps to information_schema.PROCESSLIST.ID (the first column in show
[full] processlist;. ie:
SELECT * FROM information_schema.METADATA_LOCK_INFO AS mli
JOIN information_schema.PROCESSLIST AS pl ON mli.THREAD_ID = pl.ID
I am preferential towards something like the following to make it easier to see the what is happening (the newlines don't work well with the cli though):
SELECT
mli.THREAD_ID, mli.LOCK_MODE, mli.LOCK_TYPE,
CAST(GROUP_CONCAT(DISTINCT CONCAT(mli.TABLE_SCHEMA, '.', mli.TABLE_NAME) ORDER BY mli.TABLE_SCHEMA, mli.TABLE_NAME SEPARATOR '\n') AS CHAR) AS locked_tables,
pl.USER, pl.HOST, pl.DB, pl.COMMAND, pl.TIME, pl.STATE, pl.INFO, pl.QUERY_ID, pl.TID
FROM information_schema.METADATA_LOCK_INFO AS mli
JOIN information_schema.PROCESSLIST AS pl ON mli.THREAD_ID = pl.ID
GROUP BY mli.THREAD_ID, mli.LOCK_MODE, mli.LOCK_TYPE
ORDER BY time DESC, pl.ID;
Especially interesting is when pl.COMMAND = 'Sleep' as that indicates some connection pool or other (mostly read-only) program is holding open connections that have locks on them.

How do I get a list of bundles in symfony2/symfony3?

I've just started using symfony and I'd like to get a list of bundles from a particular vendor, iterate through them and call a $bundle->renderSomething() function on each default controller.
Firstly, I need to get the list of bundles to iterate, or iterate through each object. Any ideas on the best way to do that?
The easiest way to do it in console and that outputs bundle names correctly is:
Symfony 2
php app/console config:dump-reference
Symfony 3
php bin/console config:dump-reference
The key here is not to provide any options or arguments. In this case, the command simply outputs all available bundles:
Available registered bundles with their extension alias if available:
+------------------------------------+-----------------------------------+
| Bundle name | Extension alias |
+------------------------------------+-----------------------------------+
| FrameworkBundle | framework |
| SecurityBundle | security |
| TwigBundle | twig |
| MonologBundle | monolog |
| SwiftmailerBundle | swiftmailer |
| DoctrineBundle | doctrine |
| AsseticBundle | assetic |
| GearmanBundle | gearman |
| SMMemcacheBundle | sm_memcache |
| PrestaSitemapBundle | presta_sitemap |
| DoctrineCacheBundle | doctrine_cache |
| CybernoxAmazonWebServicesBundle | cybernox_amazon_web_services |
| FOSFacebookBundle | fos_facebook |
| HWIOAuthBundle | hwi_oauth |
| FkrSimplePieBundle | fkr_simple_pie |
| RMSPushNotificationsBundle | rms_push_notifications |
| RobertoTruToInlineStyleEmailBundle | roberto_tru_to_inline_style_email |
| InsomniaMaxMindGeoIpBundle | insomnia_max_mind_geo_ip |
| EWZRecaptchaBundle | ewz_recaptcha |
| MopaBootstrapBundle | mopa_bootstrap |
| JanThomas89MailSafeBundle | jan_thomas89_mail_safe |
| WebProfilerBundle | web_profiler |
| SensioDistributionBundle | sensio_distribution |
| SensioGeneratorBundle | |
+------------------------------------+-----------------------------------+
If you have container object available then you can get array of the enabled bundles by $this->container->getParameter('kernel.bundles');
You can define a static function in each bundle. Ex: YourBundle::yourStaticFunction();
Use $this->container->getParameter('kernel.bundles') to get the list of bundles. This only returns the bundle class names instead of the Bundle object. Go through each bundle, check if the bundle has the function yourStaticFunction(), Hint: Use method_exists(). If the method exists, then call ::yourStaticFunction();
In console you can use php app/console container:debug --parameter=kernel.bundles
If you want to call a non static method of registered bundle object (not class) then you can do the following:
$kernel = $this->container->get('kernel');
$bundles = $kernel->getBundles();
$bundles['YourBundleName']->someMethod();
Where 'YourBundleName' is the name of your bundle, which you can get by calling from console:
php app/console config:dump-reference

Resources