Projects tigase _server server-core Issues #825
Add parameter to SchemaManager to destroy repository (#825)
wojciech.kapcia@tigase.net opened 8 years ago
Due Date
2017-05-29

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.

Andrzej Wójcik (Tigase) commented 8 years ago

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.

wojciech.kapcia@tigase.net commented 8 years ago

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
  =============================================================================
wojciech.kapcia@tigase.net commented 8 years ago

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

Andrzej Wójcik (Tigase) commented 8 years ago

Issues partially fixed or will be fixed within #5484

issue 1 of 1
Type
New Feature
Priority
Normal
Assignee
RedmineID
5496
Version
tigase-server-8.0.0
Spent time
12h 30m
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#825
Please wait...
Page is in error, reload to recover