Project

General

Profile

Feature #5496

Add parameter to SchemaManager to destroy repository

Added by Wojciech Kapcia TigaseTeam almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
Due date:
2017-05-30
% Done:

100%

Estimated time:
Database:
n/a
Source Code Disclaimer:

Description

For the automatic tests we should have ability to re-create the repository thus please add destroy-repository option -- I think it's not necessary to add it to list of available command options as it could be quite harmful.

Associated revisions

Revision 73bfc3f3 (diff)
Added by Andrzej Wójcik IoT 1 CloudTigaseTeam almost 2 years ago

#5496: added destroy-schema task

Revision 264a2d74 (diff)
Added by Andrzej Wójcik IoT 1 CloudTigaseTeam almost 2 years ago

#5496: implementation of database removal for destroy-schema task

History

#1 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam almost 2 years ago

  • Status changed from New to In Progress

#2 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam almost 2 years ago

  • Status changed from In Progress to In QA
  • Assignee changed from Andrzej Wójcik to Wojciech Kapcia
  • % Done changed from 0 to 100

I've added new task named destroy-schema as I wanted to keep naming convention, as we already have install-schema and @upgrade-schema@. By default, this new task drops all databases defined within config file (@etc/init.properties@), so please be careful.

If -T parameter is added (database type is specified) it will switch to a mode in which all parameters needs to be passed in the command line to drop only this one specified database.

#3 Updated by Wojciech Kapcia TigaseTeam almost 2 years ago

  • Due date set to 2017-05-19
  • Status changed from In QA to Feedback

Andrzej Wójcik wrote:

If -T parameter is added (database type is specified) it will switch to a mode in which all parameters needs to be passed in the command line to drop only this one specified database.

  • what are the "all parameters"? is there any list?

  • will there be a warning if we fail to pass required argument?

Also - it looks like it doesn't follow that logic - simply adding -T drops particular database repository and looks like it's using default (i don't have derbydb defined anywhere - including @init.properties@):

wojtek@atlantiscity.local ~/dev/tigase/tigase-server/server $ ./scripts/tigase.sh  destroy-schema  etc/tigase.conf -T derby
Upgrading database schema: -T derby
Picked up JAVA_TOOL_OPTIONS: -Djava.awt.headless=true
may 16, 2017 12:19:02 PM tigase.sys.TigaseRuntime <init>
INFORMACIÓN: Using PS Eden Space memory pool for reporting eden memory usage.
may 16, 2017 12:19:02 PM tigase.sys.TigaseRuntime <init>
INFORMACIÓN: Using PS Survivor Space memory pool for reporting survivor memory usage.
may 16, 2017 12:19:02 PM tigase.sys.TigaseRuntime <init>
INFORMACIÓN: Using PS Old Gen memory pool for reporting (old) memory usage.
LogLevel: CONFIG
2017-05-16 12:19:02.787 [main]             DBSchemaLoader.init()                   CONFIG:   Parameters: tigase.db.util.DBSchemaLoader$Parameters@136fece2
may 16, 2017 12:19:02 PM tigase.util.DNSResolverDefault <init>
ADVERTENCIA: Resolving default host name: localhost took: 13
may 16, 2017 12:19:02 PM tigase.db.util.SchemaManager destroySchema
INFORMACIÓN: found 1 data sources to destroy...
LogLevel: CONFIG
2017-05-16 12:19:02.829 [main]             DBSchemaLoader.init()                   CONFIG:   Parameters: tigase.db.util.DBSchemaLoader$Parameters@56cd5d76
2017-05-16 12:19:02.829 [main]             DBSchemaLoader.init()                   CONFIG:   Parameters: tigase.db.util.DBSchemaLoader$Parameters@56cd5d76
2017-05-16 12:19:02.829 [main]             DBSchemaLoader.validateDBConnection()   INFO:     Validating DBConnection, URI: jdbc:derby:tigasedb;create=true
2017-05-16 12:19:02.829 [main]             DBSchemaLoader.validateDBConnection()   INFO:     Validating DBConnection, URI: jdbc:derby:tigasedb;create=true
2017-05-16 12:19:03.291 [main]             DBSchemaLoader.validateDBConnection()   CONFIG:   DriverManager (available drivers): [org.apache.derby.jdbc.AutoloadedDriver@6f68756d, jTDS 1.3.1, com.mysql.jdbc.Driver@37cf91d8, com.mysql.fabric.jdbc.FabricMySQLDriver@3fe8ad3f, org.postgresql.Driver@3a8fb023]
2017-05-16 12:19:03.291 [main]             DBSchemaLoader.validateDBConnection()   CONFIG:   DriverManager (available drivers): [org.apache.derby.jdbc.AutoloadedDriver@6f68756d, jTDS 1.3.1, com.mysql.jdbc.Driver@37cf91d8, com.mysql.fabric.jdbc.FabricMySQLDriver@3fe8ad3f, org.postgresql.Driver@3a8fb023]
2017-05-16 12:19:03.292 [main]             DBSchemaLoader.validateDBConnection()   INFO:     Connection OK
2017-05-16 12:19:03.292 [main]             DBSchemaLoader.validateDBConnection()   INFO:     Connection OK
2017-05-16 12:19:03.293 [main]             DBSchemaLoader.shutdownDerby()          INFO:     Validating DBConnection, URI: jdbc:derby:tigasedb;create=true
2017-05-16 12:19:03.293 [main]             DBSchemaLoader.shutdownDerby()          INFO:     Validating DBConnection, URI: jdbc:derby:tigasedb;create=true
2017-05-16 12:19:03.306 [main]             DBSchemaLoader.withConnection()         SEVERE:


=====
Failure: Database 'tigasedb' shutdown.
=====


2017-05-16 12:19:03.306 [main]             DBSchemaLoader.withConnection()         SEVERE:


=====
Failure: Database 'tigasedb' shutdown.
=====


2017-05-16 12:19:03.328 [main]             DBSchemaLoader.shutdownDerby()          INFO:     Validating DBConnection, URI: jdbc:derby:tigasedb;create=true
2017-05-16 12:19:03.328 [main]             DBSchemaLoader.shutdownDerby()          INFO:     Validating DBConnection, URI: jdbc:derby:tigasedb;create=true
2017-05-16 12:19:03.331 [main]             DBSchemaLoader.withConnection()         SEVERE:


=====
Failure: Database 'tigasedb' not found.
=====


2017-05-16 12:19:03.331 [main]             DBSchemaLoader.withConnection()         SEVERE:


=====
Failure: Database 'tigasedb' not found.
=====


may 16, 2017 12:19:03 PM tigase.db.util.SchemaManager destroySchema
INFORMACIÓN: data sources  destruction finished!




  =============================================================================
    Data source destruction finished

  Data source: default with uri jdbc:derby:tigasedb;create=true
    Checking connection to database ok
    Destroying data source  ok
  =============================================================================

Even in successful case it prints a bit confusing logs

Upgrading database schema: -T derby -D tigasederby2
Picked up JAVA_TOOL_OPTIONS: -Djava.awt.headless=true
may 16, 2017 12:17:42 PM tigase.sys.TigaseRuntime <init>
INFORMACIÓN: Using PS Eden Space memory pool for reporting eden memory usage.
may 16, 2017 12:17:42 PM tigase.sys.TigaseRuntime <init>
INFORMACIÓN: Using PS Survivor Space memory pool for reporting survivor memory usage.
may 16, 2017 12:17:42 PM tigase.sys.TigaseRuntime <init>
INFORMACIÓN: Using PS Old Gen memory pool for reporting (old) memory usage.
LogLevel: CONFIG
2017-05-16 12:17:42.290 [main]             DBSchemaLoader.init()                   CONFIG:   Parameters: tigase.db.util.DBSchemaLoader$Parameters@136fece2
may 16, 2017 12:17:42 PM tigase.util.DNSResolverDefault <init>
ADVERTENCIA: Resolving default host name: localhost took: 12
may 16, 2017 12:17:42 PM tigase.db.util.SchemaManager destroySchema
INFORMACIÓN: found 1 data sources to destroy...
LogLevel: CONFIG
2017-05-16 12:17:42.344 [main]             DBSchemaLoader.init()                   CONFIG:   Parameters: tigase.db.util.DBSchemaLoader$Parameters@56cd5d76
2017-05-16 12:17:42.344 [main]             DBSchemaLoader.init()                   CONFIG:   Parameters: tigase.db.util.DBSchemaLoader$Parameters@56cd5d76
2017-05-16 12:17:42.345 [main]             DBSchemaLoader.validateDBConnection()   INFO:     Validating DBConnection, URI: jdbc:derby:tigasederby2;create=true
2017-05-16 12:17:42.345 [main]             DBSchemaLoader.validateDBConnection()   INFO:     Validating DBConnection, URI: jdbc:derby:tigasederby2;create=true
2017-05-16 12:17:42.822 [main]             DBSchemaLoader.validateDBConnection()   CONFIG:   DriverManager (available drivers): [org.apache.derby.jdbc.AutoloadedDriver@6f68756d, jTDS 1.3.1, com.mysql.jdbc.Driver@37cf91d8, com.mysql.fabric.jdbc.FabricMySQLDriver@3fe8ad3f, org.postgresql.Driver@3a8fb023]
2017-05-16 12:17:42.822 [main]             DBSchemaLoader.validateDBConnection()   CONFIG:   DriverManager (available drivers): [org.apache.derby.jdbc.AutoloadedDriver@6f68756d, jTDS 1.3.1, com.mysql.jdbc.Driver@37cf91d8, com.mysql.fabric.jdbc.FabricMySQLDriver@3fe8ad3f, org.postgresql.Driver@3a8fb023]
2017-05-16 12:17:42.823 [main]             DBSchemaLoader.validateDBConnection()   INFO:     Connection OK
2017-05-16 12:17:42.823 [main]             DBSchemaLoader.validateDBConnection()   INFO:     Connection OK
2017-05-16 12:17:42.824 [main]             DBSchemaLoader.shutdownDerby()          INFO:     Validating DBConnection, URI: jdbc:derby:tigasederby2;create=true
2017-05-16 12:17:42.824 [main]             DBSchemaLoader.shutdownDerby()          INFO:     Validating DBConnection, URI: jdbc:derby:tigasederby2;create=true
2017-05-16 12:17:42.839 [main]             DBSchemaLoader.withConnection()         SEVERE:


=====
Failure: Database 'tigasederby2' shutdown.
=====


2017-05-16 12:17:42.839 [main]             DBSchemaLoader.withConnection()         SEVERE:


=====
Failure: Database 'tigasederby2' shutdown.
=====


2017-05-16 12:17:42.862 [main]             DBSchemaLoader.shutdownDerby()          INFO:     Validating DBConnection, URI: jdbc:derby:tigasederby2;create=true
2017-05-16 12:17:42.862 [main]             DBSchemaLoader.shutdownDerby()          INFO:     Validating DBConnection, URI: jdbc:derby:tigasederby2;create=true
2017-05-16 12:17:42.867 [main]             DBSchemaLoader.withConnection()         SEVERE:


=====
Failure: Database 'tigasederby2' not found.
=====


2017-05-16 12:17:42.867 [main]             DBSchemaLoader.withConnection()         SEVERE:


=====
Failure: Database 'tigasederby2' not found.
=====


may 16, 2017 12:17:42 PM tigase.db.util.SchemaManager destroySchema
INFORMACIÓN: data sources  destruction finished!




  =============================================================================
    Data source destruction finished

  Data source: default with uri jdbc:derby:tigasederby2;create=true
    Checking connection to database ok
    Destroying data source  ok
  =============================================================================

#4 Updated by Wojciech Kapcia TigaseTeam almost 2 years ago

  • Assignee changed from Wojciech Kapcia to Andrzej Wójcik

#5 Updated by Wojciech Kapcia TigaseTeam almost 2 years ago

  • Due date deleted (2017-05-19)
  • Assignee changed from Andrzej Wójcik to Wojciech Kapcia

Confusing log:

wojtek@atlantiscity.local ~/dev/tigase/tigase-server/server $ ./scripts/tigase.sh  destroy-schema  etc/tigase.conf -T derby -D somedatabase
Upgrading database schema: -T derby -D somedatabase

destroy-schema -> Upgrading database schema

#6 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam almost 2 years ago

Issues partially fixed or will be fixed within #5484

#7 Updated by Wojciech Kapcia TigaseTeam almost 2 years ago

  • Due date set to 2017-05-30
  • Status changed from Feedback to Closed

Also available in: Atom PDF