perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6057 - in trunk: perfsonar-java-sql-ma perfsonar-java-sql-ma/sr c/main perfsonar-java-sql-ma/src/main/java/org/perfsonar/s ervice/measurementArchive/sqlType perfsonar-java-sql-ma/sr c/main/resources perfsonar-java-sql-ma/src/main/resources/ db perfsonar-java-sql-ma/src/main/resources/db/migration p erfsonar-java-sql-ma/src/main/resources/db/migration/mysql perfsonar-java-sql-ma/src/main/resources/db/migration/pos tgresql perfsonar-java-sql-ma/src/main/resources/perfsonar /conf perfsonar-java-sql-ma/src/main/sbin perfsonar-java-s ql-ma/src/main/webapp/WEB-INF perfsonar_base/src/main/ja va/org/perfsonar/base/auxiliary/components/jdbc
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r6057 - in trunk: perfsonar-java-sql-ma perfsonar-java-sql-ma/sr c/main perfsonar-java-sql-ma/src/main/java/org/perfsonar/s ervice/measurementArchive/sqlType perfsonar-java-sql-ma/sr c/main/resources perfsonar-java-sql-ma/src/main/resources/ db perfsonar-java-sql-ma/src/main/resources/db/migration p erfsonar-java-sql-ma/src/main/resources/db/migration/mysql perfsonar-java-sql-ma/src/main/resources/db/migration/pos tgresql perfsonar-java-sql-ma/src/main/resources/perfsonar /conf perfsonar-java-sql-ma/src/main/sbin perfsonar-java-s ql-ma/src/main/webapp/WEB-INF perfsonar_base/src/main/ja va/org/perfsonar/base/auxiliary/components/jdbc
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6057 - in trunk: perfsonar-java-sql-ma perfsonar-java-sql-ma/sr c/main perfsonar-java-sql-ma/src/main/java/org/perfsonar/s ervice/measurementArchive/sqlType perfsonar-java-sql-ma/sr c/main/resources perfsonar-java-sql-ma/src/main/resources/ db perfsonar-java-sql-ma/src/main/resources/db/migration p erfsonar-java-sql-ma/src/main/resources/db/migration/mysql perfsonar-java-sql-ma/src/main/resources/db/migration/pos tgresql perfsonar-java-sql-ma/src/main/resources/perfsonar /conf perfsonar-java-sql-ma/src/main/sbin perfsonar-java-s ql-ma/src/main/webapp/WEB-INF perfsonar_base/src/main/ja va/org/perfsonar/base/auxiliary/components/jdbc
- Date: Thu, 6 Dec 2012 11:29:49 +0000 (GMT)
Author: nordunet.behrmann
Date: 2012-12-06 11:29:49 +0000 (Thu, 06 Dec 2012)
New Revision: 6057
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/FlywayCommandLine.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/FlywayServletListener.java
trunk/perfsonar-java-sql-ma/src/main/resources/db/
trunk/perfsonar-java-sql-ma/src/main/resources/db/migration/
trunk/perfsonar-java-sql-ma/src/main/resources/db/migration/mysql/
trunk/perfsonar-java-sql-ma/src/main/resources/db/migration/mysql/V1__Initial_structure.sql
trunk/perfsonar-java-sql-ma/src/main/resources/db/migration/postgresql/
trunk/perfsonar-java-sql-ma/src/main/resources/db/migration/postgresql/V1__Initial_structure.sql
trunk/perfsonar-java-sql-ma/src/main/sbin/
trunk/perfsonar-java-sql-ma/src/main/sbin/perfsonar-sql-ma-db
Removed:
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbremove.sql
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbupdate.sql
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/psql-sqlma-dbremove.sql
Modified:
trunk/perfsonar-java-sql-ma/pom.xml
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BoneCPJdbcComponent.java
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbsetup.sql
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/psql-sqlma-dbsetup.sql
trunk/perfsonar-java-sql-ma/src/main/webapp/WEB-INF/web.xml
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/jdbc/JdbcComponent.java
Log:
perfsonar_base, perfsonar-java-sql-ma: Added Flyway schema management
Flyway manages database schemas and automatically applies schema migration
scripts when upgrading SQL MA. See http://flywaydb.org/ for details.
The migration runs automatically when the SQL MA webapp is loaded. On first
startup, Flyway will add a tracking table and apply all migration scripts.
Flyway will refuse to run if any existing database objects are found in the
database. This is to protect existing databases from being corrupted. When
upgrading an existing SQL MA, it is paramount to manually initialize the
Flyway tracking table to record the version of the current schema. I have
added a script for doing this:
/usr/sbin/perfsonar-sql-ma-db init -initialVersion=1
This will create the tracking table and record that tables corresponding
to schema version 1 already exist. The script can also me used to manually
apply any outstanding migrations, and more.
Note: As before the admin must manually create a database user account and
an empty database. Otherwise SQL MA has no place in which it can create its
tables. I have left the *-sql-dbsetup.sql scripts to do this, although system
specific scripts like createuser and createdb may be more convenient.
Migration scripts are defined for each type of RDBMS. I added migrations for
mysql and postgresql.
Modified: trunk/perfsonar-java-sql-ma/pom.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/pom.xml 2012-12-06 11:29:47 UTC (rev 6056)
+++ trunk/perfsonar-java-sql-ma/pom.xml 2012-12-06 11:29:49 UTC (rev 6057)
@@ -139,6 +139,15 @@
<prefix>/usr/share/doc/perfsonar-java-sql-ma</prefix>
</mapper>
</data>
+ <data>
+ <src>src/main/sbin</src>
+ <type>directory</type>
+ <mapper>
+ <type>perm</type>
+ <filemode>755</filemode>
+ <prefix>/usr/sbin</prefix>
+ </mapper>
+ </data>
</dataSet>
</configuration>
</execution>
@@ -247,6 +256,12 @@
</exclusion>
</exclusions>
</dependency>
+
+ <dependency>
+ <groupId>com.googlecode.flyway</groupId>
+ <artifactId>flyway-core</artifactId>
+ <version>2.0.3</version>
+ </dependency>
</dependencies>
<reporting>
<excludeDefaults>true</excludeDefaults>
Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BoneCPJdbcComponent.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BoneCPJdbcComponent.java
2012-12-06 11:29:47 UTC (rev 6056)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BoneCPJdbcComponent.java
2012-12-06 11:29:49 UTC (rev 6057)
@@ -10,10 +10,10 @@
import javax.sql.DataSource;
-import static com.google.common.base.Strings.nullToEmpty;
-
public class BoneCPJdbcComponent implements AuxiliaryThreadedComponent,
JdbcComponent
{
+ public static final String JDBC_PREFIX = "jdbc:";
+
private static final String SERVICE_MA_JDBC_DRIVER =
"service.ma.jdbc.driver";
private static final String SERVICE_MA_JDBC_URL = "service.ma.jdbc.url";
private static final String SERVICE_MA_JDBC_USERNAME =
"service.ma.jdbc.username";
@@ -21,6 +21,7 @@
private String componentName;
private BoneCPDataSource dataSource;
+ private String dialect;
@Override
public synchronized void initComponent() throws PerfSONARException
@@ -29,11 +30,18 @@
getInstance().
getComponent(ComponentNames.CONFIG);
+ String url = config.getProperty(SERVICE_MA_JDBC_URL);
+ String driver = config.getProperty(SERVICE_MA_JDBC_DRIVER);
+ String user = config.getProperty(SERVICE_MA_JDBC_USERNAME);
+ String password = config.getProperty(SERVICE_MA_JDBC_PASSWORD);
+
+ dialect = getDialectFromUrl(url);
+
BoneCPDataSource ds = new BoneCPDataSource();
-
ds.setDriverClass(nullToEmpty(config.getProperty(SERVICE_MA_JDBC_DRIVER)));
- ds.setJdbcUrl(nullToEmpty(config.getProperty(SERVICE_MA_JDBC_URL)));
-
ds.setUsername(nullToEmpty(config.getProperty(SERVICE_MA_JDBC_USERNAME)));
-
ds.setPassword(nullToEmpty(config.getProperty(SERVICE_MA_JDBC_PASSWORD)));
+ ds.setDriverClass(driver);
+ ds.setJdbcUrl(url);
+ ds.setUsername(user);
+ ds.setPassword(password);
dataSource = ds;
}
@@ -68,4 +76,19 @@
}
return ds;
}
+
+ @Override
+ public String getDialect()
+ {
+ return dialect;
+ }
+
+
+ public static String getDialectFromUrl(String url) throws
PerfSONARException
+ {
+ if (!url.startsWith(JDBC_PREFIX)) {
+ throw new PerfSONARException("Invalid JDBC URI: " + url);
+ }
+ return url.substring(JDBC_PREFIX.length(), url.indexOf(':',
JDBC_PREFIX.length() + 1));
+ }
}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/FlywayCommandLine.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/FlywayCommandLine.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/FlywayCommandLine.java
2012-12-06 11:29:49 UTC (rev 6057)
@@ -0,0 +1,241 @@
+package org.perfsonar.service.measurementArchive.sqlType;
+
+import com.googlecode.flyway.core.Flyway;
+import com.googlecode.flyway.core.api.FlywayException;
+import com.googlecode.flyway.core.info.MigrationInfoDumper;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import
org.perfsonar.base.auxiliary.components.configuration.properties.PropertiesConfigurationComponent;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import org.slf4j.bridge.SLF4JBridgeHandler;
+
+import java.util.Properties;
+
+import static
org.perfsonar.service.measurementArchive.sqlType.BoneCPJdbcComponent.getDialectFromUrl;
+
+public final class FlywayCommandLine
+{
+ private FlywayCommandLine()
+ {
+ }
+
+ /**
+ * Main method.
+ *
+ * @param args The command-line arguments.
+ */
+ public static void main(String[] args)
+ {
+ try {
+ boolean debug = isDebug(args);
+ initLogging(debug);
+
+ String operation = determineOperation(args);
+ if (operation == null) {
+ printUsage();
+ return;
+ }
+
+ Properties properties = readConfiguration(args);
+
+ Flyway flyway = new Flyway();
+ flyway.configure(properties);
+
+ if ("clean".equals(operation)) {
+ if
(!properties.stringPropertyNames().contains("flyway.force")) {
+ System.err.println("WARNING: This will delete all SQL MA
as well as all non-SQL MA data in");
+ System.err.println();
+ System.err.println(" " +
properties.getProperty("flyway.url"));
+ System.err.println();
+ System.err.println(" Proceed by adding the
-force option.");
+ System.exit(1);
+ }
+ flyway.clean();
+ } else if ("init".equals(operation)) {
+ flyway.init();
+ } else if ("migrate".equals(operation)) {
+ flyway.migrate();
+ } else if ("validate".equals(operation)) {
+ flyway.validate();
+ } else if ("info".equals(operation)) {
+
System.out.println(MigrationInfoDumper.dumpToAsciiTable(flyway.info().all()));
+ } else if ("repair".equals(operation)) {
+ flyway.repair();
+ } else {
+ printUsage();
+ }
+ } catch (PerfSONARException e) {
+ System.err.println("ERROR: " + e.getMessage());
+ System.exit(1);
+ } catch (FlywayException e) {
+ System.err.println("ERROR: " + e.getMessage());
+ System.exit(1);
+ }
+ }
+
+ private static Properties readConfiguration(String[] args) throws
PerfSONARException
+ {
+ PropertiesConfigurationComponent config = new
PropertiesConfigurationComponent();
+ config.initComponent();
+
+ String driver = config.getProperty("service.ma.jdbc.driver");
+ String url = config.getProperty("service.ma.jdbc.url");
+ String user = config.getProperty("service.ma.jdbc.username");
+ String password = config.getProperty("service.ma.jdbc.password");
+ String dialect = getDialectFromUrl(url);
+
+ /* We cannot use JdbcComponent without instantiating
AuxilaryComponentManager, and
+ * we don't want that in a CLI tool as it loads all components.
+ */
+ Properties properties = new Properties();
+ properties.setProperty("flyway.driver", driver);
+ properties.setProperty("flyway.url", url);
+ properties.setProperty("flyway.user", user);
+ properties.setProperty("flyway.password", password);
+ properties.setProperty("flyway.locations", "db/migration/" +
dialect);
+ properties.setProperty("flyway.basePackage", "db/migration/" +
dialect);
+ properties.setProperty("flyway.baseDir", "db/migration/" + dialect);
+
+ overrideConfiguration(properties, args);
+ return properties;
+ }
+
+ private static void initLogging(boolean debug)
+ {
+ Logger root = Logger.getRootLogger();
+ root.removeAllAppenders();
+ root.addAppender(new ConsoleAppender(
+ new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN)));
+ root.setLevel(debug ? Level.DEBUG : Level.WARN);
+
+ SLF4JBridgeHandler.removeHandlersForRootLogger();
+ SLF4JBridgeHandler.install();
+ }
+
+ /**
+ * Checks whether we are in debug mode or not.
+ *
+ * @param args The command-line arguments.
+ * @return
{@code
true} if we are in debug mode,
{@code
false} if not.
+ */
+ private static boolean isDebug(String[] args)
+ {
+ for (String arg : args) {
+ if ("-X".equals(arg)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Prints the usage instructions on the console.
+ */
+ private static void printUsage()
+ {
+ System.out.println("Usage: perfsonar-sql-ma-db [OPTION]... COMMAND");
+ System.out.println("");
+ System.out.println("Commands");
+ System.out.println("========");
+ System.out.println("clean : Drops all objects in the schema
without dropping the schema itself");
+ System.out.println("init : Creates and initializes the metadata
table in the schema");
+ System.out.println("migrate : Migrates the schema to the latest
version");
+ System.out.println("validate : Validates the applied migrations
against the ones on the classpath");
+ System.out.println("info : Prints the information about applied,
current and pending migrations");
+ System.out.println("repair : Repairs the metadata table after a
failed migration");
+ System.out.println("");
+ System.out.println("Options (Format: -key=value)");
+ System.out.println("=======");
+ System.out.println("target : Target version up to
which Flyway should migrate");
+ System.out.println("outOfOrder : Allows migrations to be
run \"out of order\"");
+ System.out.println("validateOnMigrate : Validate when running
migrate");
+ System.out.println("cleanOnValidationError : Automatically clean on
a validation error");
+ System.out.println("initialVersion : Initial version to put
in the database");
+ System.out.println("initialDescription : Description of the
initial version");
+ System.out.println("initOnMigrate : Init on migrate against
uninitialized non-empty schema");
+ System.out.println("");
+
+ }
+
+ /**
+ * Overrides the configuration from the config file with the properties
passed in directly from the command-line.
+ *
+ * @param properties The properties to override.
+ * @param args The command-line arguments that were passed in.
+ */
+ /* private -> for testing*/
+ static void overrideConfiguration(Properties properties, String[] args)
+ {
+ for (String arg : args) {
+ if (isPropertyArgument(arg)) {
+ properties.put("flyway." + getArgumentProperty(arg),
getArgumentValue(arg));
+ }
+ }
+ }
+
+ /**
+ * Checks whether this command-line argument tries to set a property.
+ *
+ * @param arg The command-line argument to check.
+ * @return
{@code
true} if it does,
{@code
false} if not.
+ */
+ /* private -> for testing*/
+ static boolean isPropertyArgument(String arg)
+ {
+ return arg.startsWith("-") && arg.contains("=");
+ }
+
+ /**
+ * Retrieves the property this command-line argument tries to assign.
+ *
+ * @param arg The command-line argument to check, typically in the form
-key=value.
+ * @return The property.
+ */
+ /* private -> for testing*/
+ static String getArgumentProperty(String arg)
+ {
+ int index = arg.indexOf("=");
+
+ return arg.substring(1, index);
+ }
+
+ /**
+ * Retrieves the value this command-line argument tries to assign.
+ *
+ * @param arg The command-line argument to check, typically in the form
-key=value.
+ * @return The value or an empty string if no value is assigned.
+ */
+ /* private -> for testing*/
+ static String getArgumentValue(String arg)
+ {
+ int index = arg.indexOf("=");
+
+ if ((index < 0) || (index == arg.length())) {
+ return "";
+ }
+
+ return arg.substring(index + 1);
+ }
+
+ /**
+ * Determine the operation Flyway should execute.
+ *
+ * @param args The command-line arguments passed in.
+ * @return The operation.
{@code
null} if it could not be determined.
+ */
+ private static String determineOperation(String[] args)
+ {
+ for (String arg : args) {
+ if (!arg.startsWith("-")) {
+ return arg;
+ }
+ }
+
+ return null;
+ }
+}
+
+
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/FlywayServletListener.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/FlywayServletListener.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/FlywayServletListener.java
2012-12-06 11:29:49 UTC (rev 6057)
@@ -0,0 +1,41 @@
+package org.perfsonar.service.measurementArchive.sqlType;
+
+import com.googlecode.flyway.core.Flyway;
+import com.googlecode.flyway.core.api.FlywayException;
+import org.perfsonar.base.auxiliary.AuxiliaryComponentManager;
+import org.perfsonar.base.auxiliary.ComponentNames;
+import org.perfsonar.base.auxiliary.components.jdbc.JdbcComponent;
+import org.perfsonar.base.exceptions.PerfSONARException;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+public class FlywayServletListener implements ServletContextListener
+{
+ @Override
+ public void contextInitialized(ServletContextEvent servletContextEvent)
+ {
+ try {
+ AuxiliaryComponentManager components =
AuxiliaryComponentManager.getInstance();
+ JdbcComponent jdbc = (JdbcComponent)
components.getComponent(ComponentNames.JDBC);
+
+ Flyway flyway = new Flyway();
+ flyway.setDataSource(jdbc.getDataSource());
+ flyway.setBaseDir("db/migration/" + jdbc.getDialect());
+ flyway.setBasePackage("db/migration/" + jdbc.getDialect());
+ flyway.setLocations("db/migration/" + jdbc.getDialect());
+ flyway.migrate();
+ } catch (FlywayException e) {
+ System.err.println("Failed to initialize database: " +
e.getMessage());
+ throw new RuntimeException("Failed to initialize database: " +
e.getMessage(), e);
+ } catch (PerfSONARException e) {
+ System.err.println("Failed to initialize database: " +
e.getMessage());
+ throw new RuntimeException("Failed to initialize database: " +
e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent servletContextEvent)
+ {
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/resources/db/migration/mysql/V1__Initial_structure.sql
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/resources/db/migration/mysql/V1__Initial_structure.sql
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/resources/db/migration/mysql/V1__Initial_structure.sql
2012-12-06 11:29:49 UTC (rev 6057)
@@ -0,0 +1,92 @@
+CREATE TABLE
+ perfsonar_utilization
+ (metadataId VARCHAR(30) NOT NULL, -- id of metadata which
is stored in xml database
+ value FLOAT (16,4) NOT NULL, -- measurement value
+ valueUnits VARCHAR(30) NULL, -- unit of value
+ timeValue INT NOT NULL, -- seconds since
`00:00:00 1970-01-01 UTC'
+ ts TIMESTAMP DEFAULT NOW()); -- time of inserting
+
+
+CREATE TABLE
+ perfsonar_errors
+ (metadataId VARCHAR(30) NOT NULL,
+ value FLOAT (16,4) NOT NULL,
+ valueUnits VARCHAR(30) NULL,
+ timeValue INT NOT NULL,
+ ts TIMESTAMP DEFAULT NOW());
+
+
+CREATE TABLE
+ perfsonar_discards
+ (metadataId VARCHAR(30) NOT NULL,
+ value FLOAT (16,4) NOT NULL,
+ valueUnits VARCHAR(30) NULL,
+ timeValue INT NOT NULL,
+ ts TIMESTAMP DEFAULT NOW());
+
+
+CREATE TABLE
+ domain_link
+ (id VARCHAR(255) NOT NULL,
+ time TIMESTAMP DEFAULT NOW(),
+ status_oper VARCHAR(255) DEFAULT 'UNKNOWN',
+ status_admin VARCHAR(255) DEFAULT 'UNKNOWN',
+ alarm_id_set VARCHAR(255),
+ comments VARCHAR(255));
+
+
+CREATE TABLE
+ interdomain_link
+ (id VARCHAR(255) NOT NULL,
+ time TIMESTAMP DEFAULT NOW(),
+ status_oper VARCHAR(255) DEFAULT 'UNKNOWN',
+ status_admin VARCHAR(255) DEFAULT 'UNKNOWN',
+ alarm_id_set VARCHAR(255),
+ comments VARCHAR(255));
+
+
+CREATE TABLE
+ perfsonar_links
+ (id VARCHAR(255) NOT NULL,
+ time TIMESTAMP DEFAULT NOW(),
+ status_oper VARCHAR(255) DEFAULT 'UNKNOWN',
+ status_admin VARCHAR(255) DEFAULT 'UNKNOWN',
+ alarm_id_set VARCHAR(255),
+ comments VARCHAR(255));
+
+
+CREATE TABLE
+ perfsonar_iperf
+ (metadataId VARCHAR(30) NOT NULL,
+ value FLOAT (16,4) NULL,
+ valueUnits VARCHAR(30) NULL,
+ throughput FLOAT (16,4) NULL,
+ jitter FLOAT (16,4) NULL,
+ loss VARCHAR(15) NULL,
+ numBytes NUMERIC(40) NULL,
+ numBytesUnits VARCHAR(15) NULL,
+ interv VARCHAR(30) NULL,
+ time INT NOT NULL,
+ format VARCHAR(30) NULL,
+ protocol VARCHAR(10) NULL,
+ bufferLength INT NULL,
+ windowSize INT NULL,
+ windowSizeRequest VARCHAR(30) NULL,
+ timeDuration VARCHAR(30) NULL,
+ arguments VARCHAR(50) NULL,
+ test_session_id VARCHAR(30) NULL,
+ ts TIMESTAMP DEFAULT NOW());
+
+
+CREATE TABLE
+ clmp_ping
+ (metadataId VARCHAR(255) NOT NULL,
+ seqNum INT UNSIGNED NULL DEFAULT 0,
+ value FLOAT (16,4) NOT NULL,
+ valueUnits VARCHAR(4) NULL,
+ ttl TINYINT UNSIGNED NULL DEFAULT 0,
+ numBytes INT NULL DEFAULT 0,
+ numBytesUnits VARCHAR(10) NULL,
+ timeValue LONG NOT NULL,
+ timeType VARCHAR(4) NULL,
+ ts TIMESTAMP DEFAULT NOW());
Added:
trunk/perfsonar-java-sql-ma/src/main/resources/db/migration/postgresql/V1__Initial_structure.sql
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/resources/db/migration/postgresql/V1__Initial_structure.sql
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/resources/db/migration/postgresql/V1__Initial_structure.sql
2012-12-06 11:29:49 UTC (rev 6057)
@@ -0,0 +1,93 @@
+create table
+ perfsonar_utilization
+ (metadataId varchar(30) not null, -- id of metadata which is
stored in xml database
+ value double precision not null, -- measurement value
+ valueUnits varchar(30) null, -- unit of value
+ timeValue integer not null, -- seconds since `00:00:00
1970-01-01 UTC'
+ ts timestamp default now() -- time of inserting
+ );
+
+create table
+ perfsonar_errors
+ (metadataId varchar(30) not null,
+ value double precision not null,
+ valueUnits varchar(30) null,
+ timeValue integer not null,
+ ts timestamp default now()
+ );
+
+create table
+ perfsonar_discards
+ (metadataId varchar(30) not null,
+ value double precision not null,
+ valueUnits varchar(30) null,
+ timeValue integer not null,
+ ts timestamp default now()
+ );
+
+create table
+ domain_link
+ (id varchar(255) not null,
+ time timestamp default now(),
+ status_oper varchar(255) default 'unknown',
+ status_admin varchar(255) default 'unknown',
+ alarm_id_set varchar(255),
+ comments varchar(255)
+ );
+
+create table
+ interdomain_link
+ (id varchar(255) not null,
+ time timestamp default now(),
+ status_oper varchar(255) default 'unknown',
+ status_admin varchar(255) default 'unknown',
+ alarm_id_set varchar(255),
+ comments varchar(255)
+ );
+
+create table
+ perfsonar_links
+ (id varchar(255) not null,
+ time timestamp default now(),
+ status_oper varchar(255) default 'unknown',
+ status_admin varchar(255) default 'unknown',
+ alarm_id_set varchar(255),
+ comments varchar(255)
+ );
+
+create table
+ perfsonar_iperf
+ (metadataId varchar(30) not null,
+ value double precision null,
+ valueUnits varchar(30) null,
+ throughput double precision null,
+ jitter double precision null,
+ loss varchar(15) null,
+ numBytes NUMERIC(40) null,
+ numBytesUnits varchar(15) null,
+ interv varchar(30) null,
+ time integer not null,
+ format varchar(30) null,
+ protocol varchar(10) null,
+ bufferLength integer null,
+ windowSize integer null,
+ windowSizeRequest varchar(30) null,
+ timeDuration varchar(30) null,
+ arguments varchar(50) null,
+ test_session_id varchar(30) null,
+ ts timestamp default now()
+ );
+
+create table
+ clmp_ping
+ (metadataId varchar(255) not null,
+ seqNum integer null default 0,
+ value double precision not null,
+ valueUnits varchar(4) null,
+ ttl smallint null default 0,
+ numBytes integer null default 0,
+ numBytesUnits varchar(10) null,
+ timeValue integer not null,
+ timeType varchar(4) null,
+ ts timestamp default now()
+ );
Deleted:
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbremove.sql
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbremove.sql
2012-12-06 11:29:47 UTC (rev 6056)
+++
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbremove.sql
2012-12-06 11:29:49 UTC (rev 6057)
@@ -1,64 +0,0 @@
-
-# $Id: mysql-sqlma-dbremove.sql 1540 2006-08-11 10:19:44Z roman $
-# project: perfSONAR
-# author: romradz
-
-
-# SQL Measurement Archive (MA)
-# sql script for mysql db
-
-
-# running:
-# mysql -u root -p < /opt/sonar/perfsonar/conf/mysql-sqlma-dbremove.sql
-
-
-
-
-USE perfsonar_ma
-
-
-DROP TABLE
- perfsonar_utilization;
-
-
-DROP TABLE
- perfsonar_errors;
-
-
-DROP TABLE
- perfsonar_discards;
-
-
-DROP TABLE
- domain_link;
-
-
-DROP TABLE
- interdomain_link;
-
-
-DROP TABLE
- perfsonar_links;
-
-
-DROP TABLE
- perfsonar_iperf;
-
-
-#DROP TABLE
-# clmp_owamp;
-
-
-#DROP TABLE
-# clmp_bwctl;
-
-
-DROP TABLE
- clmp_ping;
-
-
-DROP USER
- perfsonar_ma;
-
-
-
Modified:
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbsetup.sql
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbsetup.sql
2012-12-06 11:29:47 UTC (rev 6056)
+++
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbsetup.sql
2012-12-06 11:29:49 UTC (rev 6057)
@@ -1,26 +1,16 @@
-
-# $Id: mysql-sqlma-dbsetup.sql 1592 2006-09-01 18:37:40Z fernandes $
-# project: perfSONAR
-# author: romradz
-
-
# SQL Measurement Archive (MA)
# sql script for mysql db
# running:
-# mysql -u root -p < /opt/sonar/perfsonar/conf/mysql-sqlma-dbsetup.sql
+# mysql -u root -p < /etc/geant2-java-sql-ma/mysql-sqlma-dbsetup.sql
-
-
CREATE DATABASE
perfsonar_ma;
-USE perfsonar_ma
-
CREATE USER
perfsonar_ma;
@@ -29,270 +19,3 @@
SELECT, INSERT, UPDATE, DELETE ON
perfsonar_ma.* TO 'perfsonar_ma'@'localhost'
IDENTIFIED BY 'testpass';
-
-
-CREATE TABLE
- perfsonar_utilization
- (metadataId VARCHAR(30) NOT NULL, # id of metadata which
is stored in xml database
- value FLOAT (16,4) NOT NULL, # measurement value
- valueUnits VARCHAR(30) NULL, # unit of value
- timeValue INT NOT NULL, # seconds since
`00:00:00 1970-01-01 UTC'
- ts TIMESTAMP DEFAULT NOW()); # time of inserting
-
-
-CREATE TABLE
- perfsonar_errors
- (metadataId VARCHAR(30) NOT NULL,
- value FLOAT (16,4) NOT NULL,
- valueUnits VARCHAR(30) NULL,
- timeValue INT NOT NULL,
- ts TIMESTAMP DEFAULT NOW());
-
-
-CREATE TABLE
- perfsonar_discards
- (metadataId VARCHAR(30) NOT NULL,
- value FLOAT (16,4) NOT NULL,
- valueUnits VARCHAR(30) NULL,
- timeValue INT NOT NULL,
- ts TIMESTAMP DEFAULT NOW());
-
-
-CREATE TABLE
- domain_link
- (id VARCHAR(255) NOT NULL,
- time TIMESTAMP DEFAULT NOW(),
- status_oper VARCHAR(255) DEFAULT 'UNKNOWN',
- status_admin VARCHAR(255) DEFAULT 'UNKNOWN',
- alarm_id_set VARCHAR(255),
- comments VARCHAR(255));
-
-
-CREATE TABLE
- interdomain_link
- (id VARCHAR(255) NOT NULL,
- time TIMESTAMP DEFAULT NOW(),
- status_oper VARCHAR(255) DEFAULT 'UNKNOWN',
- status_admin VARCHAR(255) DEFAULT 'UNKNOWN',
- alarm_id_set VARCHAR(255),
- comments VARCHAR(255));
-
-
-CREATE TABLE
- perfsonar_links
- (id VARCHAR(255) NOT NULL,
- time TIMESTAMP DEFAULT NOW(),
- status_oper VARCHAR(255) DEFAULT 'UNKNOWN',
- status_admin VARCHAR(255) DEFAULT 'UNKNOWN',
- alarm_id_set VARCHAR(255),
- comments VARCHAR(255));
-
-CREATE TABLE
- perfsonar_iperf
- (metadataId VARCHAR(30) NOT NULL,
- value FLOAT (16,4) NULL,
- valueUnits VARCHAR(30) NULL,
- throughput FLOAT (16,4) NULL,
- jitter FLOAT (16,4) NULL,
- loss VARCHAR(15) NULL,
- numBytes NUMERIC(40) NULL,
- numBytesUnits VARCHAR(15) NULL,
- interv VARCHAR(30) NULL,
- time INT NOT NULL,
- format VARCHAR(30) NULL,
- protocol VARCHAR(10) NULL,
- bufferLength INT NULL,
- windowSize INT NULL,
- windowSizeRequest VARCHAR(30) NULL,
- timeDuration VARCHAR(30) NULL,
- arguments VARCHAR(50) NULL,
- test_session_id VARCHAR(30) NULL,
- ts TIMESTAMP DEFAULT NOW());
-
-
-
-
-#INSERT
-# INTO owamp_agg
-# VALUES ('owamp-meta2', 'host1', 'host2', 1, 1, '10.0', 2, '1.0',
'2.0', '1.5', 'ms', '1.0', 'ms', '0.1', 'ms', 12, default);
-
-
-
-############### Create table for BWCTL data ################
-#CREATE TABLE `clmp_bwctl` (
-# `metadataId` varchar(255) NOT NULL,
-# `intervalEnd` varchar(30) default NULL,
-# `intervalStart` varchar(30) default NULL,
-# `intervalUnit` varchar(30) default NULL,
-# `numBytes` varchar(30) default NULL,
-# `numBytesUnits` varchar(30) default NULL,
-# `tcpAdapterType` varchar(30) default NULL,
-# `tcpMSSSize` varchar(30) default NULL,
-# `timeType` varchar(30) default NULL,
-# `timeValue` mediumtext NOT NULL,
-# `value` mediumtext NOT NULL,
-# `valueUnits` varchar(30) default NULL,
-# `tcpMSSUnit` varchar(30) default NULL,
-# `tcpMTUSize` varchar(30) default NULL,
-# `tcpMTUUnit` varchar(30) default NULL,
-# `tcpWindowSize` varchar(30) default NULL,
-# `tcpWindowUnit` varchar(30) default NULL,
-# `udpBufferSize` varchar(30) default NULL,
-# `udpBufferUnit` varchar(30) default NULL,
-# `udpJitter` varchar(30) default NULL,
-# `udpJitterUnit` varchar(30) default NULL,
-# `udpPacketLoss` varchar(30) default NULL,
-# `udpPacketLossPercentage` varchar(30) default NULL,
-# `udpPacketSent` varchar(30) default NULL,
-# `ts` timestamp NOT NULL default CURRENT_TIMESTAMP);
-###########################################################
-
-############### Create table for ping data ################
-CREATE TABLE
- clmp_ping
- (metadataId VARCHAR(255) NOT NULL,
- seqNum INT UNSIGNED NULL DEFAULT 0,
- value FLOAT (16,4) NOT NULL,
- valueUnits VARCHAR(4) NULL,
- ttl TINYINT UNSIGNED NULL DEFAULT 0,
- numBytes INT NULL DEFAULT 0,
- numBytesUnits VARCHAR(10) NULL,
- timeValue LONG NOT NULL,
- timeType VARCHAR(4) NULL,
- ts TIMESTAMP DEFAULT NOW());
-############################################################
-
-# insert statements for testing perfsonar_utilization table
-
-INSERT
- INTO perfsonar_utilization
- VALUES ('meta1-test', 2, 'Bps', 1143034705, default);
-
-INSERT
- INTO
- perfsonar_utilization
- VALUES ('meta2-test', 3, 'Bps', 1143034706, default);
-
-INSERT
- INTO
- perfsonar_utilization
- VALUES ('meta3-test', 4, 'Bps', 1143034707, default);
-
-INSERT
- INTO
- perfsonar_utilization
- VALUES ('meta4-test', 5, 'Bps', 1143034709, default);
-
-
-
-# insert statements for testing perfsonar_errors table
-
-INSERT
- INTO perfsonar_errors
- VALUES ('meta1-errors-test', 1, 'Eps', 1187948870, default);
-
-INSERT
- INTO
- perfsonar_errors
- VALUES ('meta1-errors-test', 0, 'Eps', 1187948875, default);
-
-INSERT
- INTO
- perfsonar_errors
- VALUES ('meta1-errors-test', 4, 'Eps', 1187948882, default);
-
-INSERT
- INTO
- perfsonar_errors
- VALUES ('meta1-errors-test', 2, 'Eps', 1187948888, default);
-
-
-
-# insert statements for testing perfsonar_discards table
-
-INSERT
- INTO perfsonar_discards
- VALUES ('meta1-discards-test', 1, 'Dps', 1187948870, default);
-
-INSERT
- INTO
- perfsonar_discards
- VALUES ('meta1-discards-test', 0, 'Dps', 1187948875, default);
-
-INSERT
- INTO
- perfsonar_discards
- VALUES ('meta1-discards-test', 4, 'Dps', 1187948882, default);
-
-INSERT
- INTO
- perfsonar_discards
- VALUES ('meta1-discards-test', 2, 'Dps', 1187948888, default);
-
-
-# insert statements for testing domain_link table
-
-INSERT
- INTO domain_link (id, status_oper, time)
- VALUES ('DFN-link-1234', 'down', '2006-04-06 12:15:23');
-
-INSERT
- INTO domain_link (id, status_oper, time)
- VALUES ('DFN-Surfnet-Link-5678', 'up', '2006-04-06 12:15:24');
-
-INSERT
- INTO domain_link (id, status_oper, time)
- VALUES ('PSNC-DFN-MUE-Link-1001', 'down', '2006-04-06 12:15:25');
-
-
-
-# insert statements for testing domain_link table
-
-INSERT
- INTO interdomain_link (id, status_oper, time)
- VALUES ('PSNC-2-DFN-MUE-Link-1002', 'up', '2006-04-06 12:17:33');
-
-
-
-# insert statements for testing perfsonar_links table
-
-INSERT
- INTO perfsonar_links (id, status_oper, time)
- VALUES ('PSNC-2-DFN-MUE-Link-1002', 'up', '2006-04-06 12:17:33');
-
-
-
-# insert statements for testing perfsonar_iperf table
-INSERT
-INTO perfsonar_iperf
-VALUES ('meta1-iperf-test', 165214869, 'bits/sec', 1.00, 1.830, '0/837',
123911152, 'Bytes', '0.0- 6.0', 1332320400, NULL, 'TCP', NULL, NULL, NULL,
NULL, NULL, NULL, default);
-
-INSERT
-INTO perfsonar_iperf
-VALUES ('meta1-iperf-test', 49782240, 'bits/sec', 1.50, 1.830, '0/837',
37336680, 'Bytes', '6.0-12.0', 1332320400, NULL, 'TCP', NULL, NULL, NULL,
NULL, NULL, NULL, default);
-
-INSERT
-INTO perfsonar_iperf
-VALUES ('meta1-iperf-test', 28124021, 'bits/sec', 2.00, 1.830, '0/837',
21093016, 'Bytes', '12.0-18.0', 1332320400, NULL, 'TCP', NULL, NULL, NULL,
NULL, NULL, NULL, default);
-
-INSERT
-INTO perfsonar_iperf
-VALUES ('meta1-iperf-test', 34060821, 'bits/sec', 2.50, 1.830, '0/837',
25545616, 'Bytes', '18.0-24.0', 1332320400, NULL, 'TCP', NULL, NULL, NULL,
NULL, NULL, NULL, default);
-
-INSERT
-INTO perfsonar_iperf
-VALUES ('meta1-iperf-test', 34946997, 'bits/sec', 3.00, 1.830, '0/837',
26210248, 'Bytes', '24.0-30.0', 1332320400, NULL, 'TCP', NULL, NULL, NULL,
NULL, NULL, NULL, default);
-
-INSERT
-INTO perfsonar_iperf
-VALUES ('meta1-iperf-test', 61428990, 'bits/sec', 3.50, 1.830, '0/837',
239779840, 'Bytes', '0.0-30.3', 1332320400, NULL, 'TCP', NULL, NULL, NULL,
NULL, NULL, NULL, default);
-
-# insert statements for testing clmp_ping table
-
-INSERT
- INTO clmp_ping
- VALUES ('ping-meta1', 1, 5.3, 'ms', 253, 8, 'Bytes', 1233655716, 'unix',
default);
-
-INSERT
- INTO clmp_ping
- VALUES ('ping-meta1', 2, 2.5, 'ms', 253, 8, 'Bytes', 1233655718, 'unix',
default);
Deleted:
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbupdate.sql
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbupdate.sql
2012-12-06 11:29:47 UTC (rev 6056)
+++
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/mysql-sqlma-dbupdate.sql
2012-12-06 11:29:49 UTC (rev 6057)
@@ -1,71 +0,0 @@
-#$Id : mysql-sqlma-dbupdate.sql
-#project: perfsonar
-#author: Piotr Pikusa
-
-# SQL Measurement Archive (MA)
-# sql script for upgrading mysql db. It updates db schema from the last
stable version (not rc) to the db schema for current version
-
-# running:
-# mysql -u root -p < /etc/mysql-sqlma-dbupdate.sql
-
-
-USE perfsonar_ma
-
-CREATE TABLE
- perfsonar_iperf
- (metadataId VARCHAR(30) NOT NULL,
- value FLOAT (16,4) NULL,
- valueUnits VARCHAR(30) NULL,
- throughput FLOAT (16,4) NULL,
- jitter FLOAT (16,4) NULL,
- loss VARCHAR(15) NULL,
- numBytes NUMERIC(40) NULL,
- numBytesUnits VARCHAR(15) NULL,
- interv VARCHAR(30) NULL,
- time INT NOT NULL,
- format VARCHAR(30) NULL,
- protocol VARCHAR(10) NULL,
- bufferLength INT NULL,
- windowSize INT NULL,
- windowSizeRequest VARCHAR(30) NULL,
- timeDuration VARCHAR(30) NULL,
- arguments VARCHAR(50) NULL,
- test_session_id VARCHAR(30) NULL,
- ts TIMESTAMP DEFAULT NOW());
-
-
-CREATE TABLE
- clmp_ping
- (metadataId VARCHAR(255) NOT NULL,
- seqNum INT UNSIGNED NULL DEFAULT 0,
- value FLOAT (16,4) NOT NULL,
- valueUnits VARCHAR(4) NULL,
- ttl TINYINT UNSIGNED NULL DEFAULT 0,
- numBytes INT NULL DEFAULT 0,
- numBytesUnits VARCHAR(10) NULL,
- timeValue LONG NOT NULL,
- timeType VARCHAR(4) NULL,
- ts TIMESTAMP DEFAULT NOW());
-
-
-# insert statements for testing perfsonar_iperf table
-
-INSERT
- INTO perfsonar_iperf
- VALUES ('meta1-iperf-test', NULL, 'bits/sec', 2.88, 1.830, '0/837',
23484640, 'Bytes', NULL, 1197642642, NULL, 'TCP', NULL, NULL, NULL, NULL,
NULL, NULL, default);
-
-INSERT
- INTO perfsonar_iperf
- VALUES ('meta2-iperf-test', NULL, 'bits/sec', 1.45, 1.806, '5/851',
23484640, 'Bytes', NULL, 1197642662, NULL, 'UDP', NULL, NULL, NULL, NULL,
NULL, NULL, default);
-
-
-
-# insert statements for testing clmp_ping table
-
-INSERT
- INTO clmp_ping
- VALUES ('ping-meta1', 1, 5.3, 'ms', 253, 8, 'Bytes', 1233655716, 'unix',
default);
-
-INSERT
- INTO clmp_ping
- VALUES ('ping-meta1', 2, 2.5, 'ms', 253, 8, 'Bytes', 1233655718, 'unix',
default);
Deleted:
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/psql-sqlma-dbremove.sql
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/psql-sqlma-dbremove.sql
2012-12-06 11:29:47 UTC (rev 6056)
+++
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/psql-sqlma-dbremove.sql
2012-12-06 11:29:49 UTC (rev 6057)
@@ -1,53 +0,0 @@
-
--- $Id: psql-sqlma-dbremove.sql 1540 2006-08-11 10:19:44Z roman $
--- project: perfSONAR
--- author: romradz
-
--- SQL Measurement Archive (MA)
--- sql script for postgresql db
-
-
--- running:
--- psql -f psql-sqlma-dbremove.conf
-
-
--- perfsonar_ma user
-
-\c perfsonar_ma perfsonar_ma
-
-drop trigger trigger1 on perfsonar_utilization;
-
-drop table perfsonar_utilization;
-
-drop table perfsonar_errors;
-
-drop table perfsonar_discards;
-
-drop table domain_link;
-
-drop table interdomain_link;
-
-drop table perfsonar_links;
-
-drop table perfsonar_iperf;
-
-drop table clmp_ping;
-
-
--- root (postgres) user
-
-\c perfsonar_ma postgres
-
-drop function fun1();
-
-drop language plpgsql;
-
-\c postgres postgres
-
-drop database perfsonar_ma;
-
-drop role perfsonar_ma;
-
-
-
-
Modified:
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/psql-sqlma-dbsetup.sql
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/psql-sqlma-dbsetup.sql
2012-12-06 11:29:47 UTC (rev 6056)
+++
trunk/perfsonar-java-sql-ma/src/main/resources/perfsonar/conf/psql-sqlma-dbsetup.sql
2012-12-06 11:29:49 UTC (rev 6057)
@@ -1,251 +1,6 @@
-
--- $Id: psql-sqlma-dbsetup.sql 1545 2006-08-11 12:12:24Z roman $
--- project: perfSONAR
--- author: romradz
-
-- SQL Measurement Archive (MA)
-- sql script for postgresql db
-
--- running:
--- psql -f psql-sqlma-dbsetup.conf
-
-
--- root (postgres) user
-
-
create user perfsonar_ma login password 'testpass';
create database perfsonar_ma owner perfsonar_ma;
-
-\c perfsonar_ma
-
-create language plpgsql;
-
-create function fun1() returns trigger AS '
- declare
- nr integer;
- mintm integer;
- begin
- select into nr count(metadataId) from perfsonar_utilization;
- select into mintm min(timeValue) from perfsonar_utilization;
- delete from perfsonar_utilization
- where
- metadataId =
- (select metadataId from perfsonar_utilization
- where timeValue = mintm limit 1)
- and nr > 10000;
- return OLD;
- end;
- ' language plpgsql;
-
-
-
--- perfsonar_ma user
-
-\c perfsonar_ma perfsonar_ma
-
-create table
- perfsonar_utilization
- (metadataId varchar(30) not null, -- id of metadata which is
stored in xml database
- value double precision not null, -- measurement value
- valueUnits varchar(30) null, -- unit of value
- timeValue integer not null, -- seconds since `00:00:00
1970-01-01 UTC'
- ts timestamp default now() -- time of inserting
- );
-
-create table
- perfsonar_errors
- (metadataId varchar(30) not null,
- value double precision not null,
- valueUnits varchar(30) null,
- timeValue integer not null,
- ts timestamp default now()
- );
-
-create table
- perfsonar_discards
- (metadataId varchar(30) not null,
- value double precision not null,
- valueUnits varchar(30) null,
- timeValue integer not null,
- ts timestamp default now()
- );
-
-create table
- domain_link
- (id varchar(255) not null,
- time timestamp default now(),
- status_oper varchar(255) default 'unknown',
- status_admin varchar(255) default 'unknown',
- alarm_id_set varchar(255),
- comments varchar(255)
- );
-
-create table
- interdomain_link
- (id varchar(255) not null,
- time timestamp default now(),
- status_oper varchar(255) default 'unknown',
- status_admin varchar(255) default 'unknown',
- alarm_id_set varchar(255),
- comments varchar(255)
- );
-
-create table
- perfsonar_links
- (id varchar(255) not null,
- time timestamp default now(),
- status_oper varchar(255) default 'unknown',
- status_admin varchar(255) default 'unknown',
- alarm_id_set varchar(255),
- comments varchar(255)
- );
-
-create table
- perfsonar_iperf
- (metadataId varchar(30) not null,
- value double precision null,
- valueUnits varchar(30) null,
- throughput double precision null,
- jitter double precision null,
- loss varchar(15) null,
- numBytes NUMERIC(40) null,
- numBytesUnits varchar(15) null,
- interv varchar(30) null,
- time integer not null,
- format varchar(30) null,
- protocol varchar(10) null,
- bufferLength integer null,
- windowSize integer null,
- windowSizeRequest varchar(30) null,
- timeDuration varchar(30) null,
- arguments varchar(50) null,
- test_session_id varchar(30) null,
- ts timestamp default now()
- );
-
-create table
- clmp_ping
- (metadataId varchar(255) not null,
- seqNum integer null default 0,
- value double precision not null,
- valueUnits varchar(4) null,
- ttl smallint null default 0,
- numBytes integer null default 0,
- numBytesUnits varchar(10) null,
- timeValue integer not null,
- timeType varchar(4) null,
- ts timestamp default now()
- );
-
-
--- insert statements for testing perfsonar_utilization table
-
-insert
- into perfsonar_utilization
- values ('meta1-test', 2, 'Bps', 1143034705);
-
-insert
- into perfsonar_utilization
- values ('meta2-test', 3, 'Bps', 1143034706);
-
-insert
- into perfsonar_utilization
- values ('meta3-test', 4, 'Bps', 1143034707);
-
-insert
- into perfsonar_utilization
- values ('meta4-test', 5, 'Bps', 1143034709);
-
-
--- insert statements for testing perfsonar_errors table
-
-insert
- into perfsonar_errors
- values ('meta1-errors-test', 1, 'Eps', 1187948870);
-
-insert
- into perfsonar_errors
- values ('meta1-errors-test', 0, 'Eps', 1187948875);
-
-insert
- into perfsonar_errors
- values ('meta1-errors-test', 4, 'Eps', 1187948882);
-
-insert
- into perfsonar_errors
- values ('meta1-errors-test', 2, 'Eps', 1187948888);
-
-
--- insert statements for testing perfsonar_discards table
-
-insert
- into perfsonar_discards
- values ('meta1-discards-test', 1, 'Dps', 1187948870);
-
-insert
- into perfsonar_discards
- values ('meta1-discards-test', 0, 'Dps', 1187948875);
-
-insert
- into perfsonar_discards
- values ('meta1-discards-test', 4, 'Dps', 1187948882);
-
-insert
- into perfsonar_discards
- values ('meta1-discards-test', 2, 'Dps', 1187948888);
-
-
--- insert statements for testing domain_link table
-
-insert
- into domain_link (id, status_oper, time)
- values ('DFN-link-1234', 'down', '2006-04-06 12:15:23');
-
-insert
- into domain_link (id, status_oper, time)
- values ('DFN-Surfnet-Link-5678', 'up', '2006-04-06 12:15:24');
-
-insert
- into domain_link (id, status_oper, time)
- values ('PSNC-DFN-MUE-Link-1001', 'down', '2006-04-06 12:15:25');
-
-
--- insert statements for testing interdomain_link table
-
-insert
- into interdomain_link (id, status_oper, time)
- values ('PSNC-2-DFN-MUE-Link-1002', 'up', '2006-04-06 12:17:33');
-
-
--- insert statements for testing perfsonar_iperf table
-
-insert
- into perfsonar_iperf
- values ('meta1-iperf-test', null, 'bits/sec', 2.88, 1.830, '0/837',
23484640, 'Bytes', null, 1197642642, null, 'TCP', null, null, null, null,
null, null, default);
-
-insert
- into perfsonar_iperf
- values ('meta2-iperf-test', null, 'bits/sec', 1.45, 1.806, '5/851',
23484640, 'Bytes', null, 1197642662, null, 'UDP', null, null, null, null,
null, null, default);
-
-
--- insert statements for testing clmp_ping table
-
-insert
- into clmp_ping
- values ('ping-meta1', 1, 5.3, 'ms', 253, 8, 'Bytes', 1233655716, 'unix',
default);
-
-insert
- into clmp_ping
- values ('ping-meta1', 2, 2.5, 'ms', 253, 8, 'Bytes', 1233655718, 'unix',
default);
-
-
-
--- trigger
-
-create trigger trigger1
- after insert on perfsonar_utilization
- for each row
- execute procedure fun1();
-
Added: trunk/perfsonar-java-sql-ma/src/main/sbin/perfsonar-sql-ma-db
===================================================================
--- trunk/perfsonar-java-sql-ma/src/main/sbin/perfsonar-sql-ma-db
(rev 0)
+++ trunk/perfsonar-java-sql-ma/src/main/sbin/perfsonar-sql-ma-db
2012-12-06 11:29:49 UTC (rev 6057)
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# Use JAVA_HOME if it is set
+if [ -z "$JAVA_HOME" ]; then
+ JAVA_CMD=java
+else
+ JAVA_CMD="$JAVA_HOME/bin/java"
+fi
+
+SQLMA_HOME=/usr/lib/perfsonar/services/geant2-java-sql-ma/WEB-INF
+MAIN=org.perfsonar.service.measurementArchive.sqlType.FlywayCommandLine
+
+"$JAVA_CMD" -cp "$SQLMA_HOME/lib/*:$SQLMA_HOME/classes" $MAIN "$@"
+
Modified: trunk/perfsonar-java-sql-ma/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/src/main/webapp/WEB-INF/web.xml 2012-12-06
11:29:47 UTC (rev 6056)
+++ trunk/perfsonar-java-sql-ma/src/main/webapp/WEB-INF/web.xml 2012-12-06
11:29:49 UTC (rev 6057)
@@ -5,11 +5,15 @@
<web-app>
<display-name>PerfSONAR SQL MA</display-name>
-
+
<listener>
<listener-class>org.perfsonar.service.base.container.listeners.StartupInitializer</listener-class>
</listener>
+ <listener>
+
<listener-class>org.perfsonar.service.measurementArchive.sqlType.FlywayServletListener</listener-class>
+ </listener>
+
<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/jdbc/JdbcComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/jdbc/JdbcComponent.java
2012-12-06 11:29:47 UTC (rev 6056)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/jdbc/JdbcComponent.java
2012-12-06 11:29:49 UTC (rev 6057)
@@ -5,4 +5,5 @@
public interface JdbcComponent
{
DataSource getDataSource();
+ String getDialect();
}
- [pS-dev] [GEANT/SA2/ps-java-services] r6057 - in trunk: perfsonar-java-sql-ma perfsonar-java-sql-ma/sr c/main perfsonar-java-sql-ma/src/main/java/org/perfsonar/s ervice/measurementArchive/sqlType perfsonar-java-sql-ma/sr c/main/resources perfsonar-java-sql-ma/src/main/resources/ db perfsonar-java-sql-ma/src/main/resources/db/migration p erfsonar-java-sql-ma/src/main/resources/db/migration/mysql perfsonar-java-sql-ma/src/main/resources/db/migration/pos tgresql perfsonar-java-sql-ma/src/main/resources/perfsonar /conf perfsonar-java-sql-ma/src/main/sbin perfsonar-java-s ql-ma/src/main/webapp/WEB-INF perfsonar_base/src/main/ja va/org/perfsonar/base/auxiliary/components/jdbc, svn-noreply, 12/06/2012
Archive powered by MHonArc 2.6.16.