Skip to content
Snippets Groups Projects
Verified Commit f749bb65 authored by Martin Weise's avatar Martin Weise
Browse files

Removed date

parent 7f55a504
No related branches found
No related tags found
7 merge requests!345Updated docs and endpoints:,!341Fixed mapping problem where UK and FK share columns they are inserted,!339Fixed mapping problem where UK and FK share columns they are inserted,!338Fixed mapping problem where UK and FK share columns they are inserted,!334Fixed mapping problem where UK and FK share columns they are inserted,!333Fixed mapping problem where UK and FK share columns they are inserted,!328Hotfix/mapping
Showing
with 580 additions and 227 deletions
# This is required to proxy Grafana Live WebSocket connections.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
client_max_body_size 20G;
resolver 127.0.0.11 valid=30s; # docker dns
......@@ -34,19 +40,34 @@ upstream upload {
server upload-service:8080;
}
upstream dashboard-service {
server dashboard-service:3000;
}
server {
listen 80 default_server;
server_name _;
location /admin/broker {
location /dashboard {
rewrite ^/dashboard/(.*) /$1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://broker;
proxy_pass http://dashboard-service;
proxy_read_timeout 90;
}
# Proxy Grafana Live WebSocket connections.
location /dashboard/api/live {
rewrite ^/dashboard/(.*) /$1 break;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_pass http://dashboard-service;
}
location /api/search {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
......@@ -57,7 +78,7 @@ server {
}
location /api/broker {
rewrite /api/broker/(.*) /admin/broker/api/$1 break;
rewrite /api/broker/(.*) /api/$1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
......
......@@ -6,7 +6,6 @@ default_user_tags.administrator = false
listeners.tcp.1 = 0.0.0.0:5672
# management prefix (https://www.rabbitmq.com/management.html#path-prefix)
management.path_prefix = /admin/broker
management.load_definitions = /app/definitions.json
# logging
......
......@@ -8,6 +8,7 @@ volumes:
storage-service-data:
identity-service-data:
metric-db-data:
dashboard-service-data:
services:
dbrepo-metadata-db:
......@@ -473,7 +474,7 @@ services:
BROKER_HOST: "${BROKER_ENDPOINT:-broker-service}"
BROKER_PASSWORD: "${SYSTEM_PASSWORD:-admin}"
BROKER_PORT: ${BROKER_PORT:-5672}
BROKER_SERVICE_ENDPOINT: "${BROKER_SERVICE_ENDPOINT:-http://gateway-service/admin/broker}"
BROKER_SERVICE_ENDPOINT: "${BROKER_SERVICE_ENDPOINT:-http://broker-service:15672}"
BROKER_USERNAME: "${SYSTEM_USERNAME:-admin}"
BROKER_VIRTUALHOST: "${BROKER_VIRTUALHOST:-dbrepo}"
CONNECTION_TIMEOUT: ${CONNECTION_TIMEOUT:-60000}
......
......@@ -11,7 +11,7 @@ author: Martin Weise
* Ports: 5672/tcp, 15672/tcp, 15692/tcp
* AMQP: `amqp://<hostname>:5672`
* Prometheus: `http://<hostname>:15692/metrics`
* Management: `http://<hostname>/admin/broker`
* Management: `http://<hostname>:15672`
## Overview
......
......@@ -6,7 +6,6 @@ default_user_tags.administrator = false
listeners.tcp.1 = 0.0.0.0:5672
# management prefix (https://www.rabbitmq.com/management.html#path-prefix)
management.path_prefix = /admin/broker
management.load_definitions = /app/definitions.json
# logging
......
FROM docker.io/bitnami/grafana:10.4.9-debian-12-r0 AS runtime
FROM docker.io/grafana/grafana-oss:11.2.2 AS runtime
LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at"
WORKDIR /app
......
......@@ -18,7 +18,6 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 1,
"id": 3,
"links": [
{
"asDropdown": false,
......@@ -93,7 +92,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.9",
"pluginVersion": "11.2.2",
"targets": [
{
"datasource": {
......@@ -161,7 +160,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.9",
"pluginVersion": "11.2.2",
"targets": [
{
"datasource": {
......@@ -277,7 +276,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.9",
"pluginVersion": "11.2.2",
"targets": [
{
"datasource": {
......@@ -377,7 +376,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.9",
"pluginVersion": "11.2.2",
"targets": [
{
"datasource": {
......@@ -539,7 +538,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.9",
"pluginVersion": "11.2.2",
"targets": [
{
"datasource": {
......@@ -578,6 +577,7 @@
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 25,
"gradientMode": "none",
......@@ -588,7 +588,7 @@
},
"insertNulls": false,
"lineInterpolation": "smooth",
"lineWidth": 1,
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
......@@ -743,6 +743,7 @@
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 25,
"gradientMode": "none",
......@@ -752,8 +753,8 @@
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"lineInterpolation": "smooth",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
......@@ -884,6 +885,443 @@
],
"title": "JVM Memory Usage",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "P18F45E9DC7E75912"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 25,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "smooth",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "reqps"
},
"overrides": [
{
"matcher": {
"id": "byRegexp",
"options": "/.*search-service.*/"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "orange",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/.*analyse-service.*/"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "super-light-orange",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 20
},
"id": 18,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P18F45E9DC7E75912"
},
"editorMode": "code",
"expr": "rate(flask_http_request_duration_seconds_count{status=~\"200|201|202\",path!=\"/health\"}[$__rate_interval])",
"instant": false,
"legendFormat": "{{method}} {{instance}} {{path}} ({{status}})",
"range": true,
"refId": "A"
}
],
"title": "Successful API Requests",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "P18F45E9DC7E75912"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 25,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "smooth",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "reqps"
},
"overrides": [
{
"matcher": {
"id": "byRegexp",
"options": "/.*search-service.*/"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "orange",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/.*analyse-service.*/"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "super-light-orange",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 20
},
"id": 19,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P18F45E9DC7E75912"
},
"editorMode": "code",
"expr": "rate(flask_http_request_duration_seconds_count{status!~\"200|201|202\"}[$__rate_interval])",
"instant": false,
"legendFormat": "{{method}} {{instance}} ({{status}})",
"range": true,
"refId": "A"
}
],
"title": "Failed API Requests",
"type": "timeseries"
},
{
"datasource": {
"default": true,
"type": "prometheus",
"uid": "P18F45E9DC7E75912"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "DELETE"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "red",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "GET"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "blue",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "HEAD"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "purple",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "PATCH"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "orange",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "OPTIONS"
},
"properties": [
{
"id": "color",
"value": {
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "POST"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "green",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 27
},
"id": 20,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P18F45E9DC7E75912"
},
"disableTextWrap": false,
"editorMode": "builder",
"expr": "tusd_requests_total",
"fullMetaSearch": false,
"includeNullMetadata": true,
"instant": false,
"legendFormat": "{{method}}",
"range": true,
"refId": "A",
"useBackend": false
}
],
"title": "Storage Service Requests",
"type": "timeseries"
}
],
"refresh": "10s",
......@@ -903,6 +1341,6 @@
"timezone": "browser",
"title": "DBRepo - Overview",
"uid": "bdz20owu8zn5se",
"version": 20,
"version": 1,
"weekStart": ""
}
\ No newline at end of file
......@@ -250,12 +250,7 @@ public class SubsetEndpoint {
endpointValidator.validateDataParams(page, size);
endpointValidator.validateForbiddenStatements(data.getStatement());
/* parameters */
final UUID userId;
if (principal == null) {
userId = metadataServiceGateway.getSystemUserId();
} else {
userId = UserUtil.getId(principal);
}
final UUID userId = principal != null ? UserUtil.getId(principal) : null;
if (page == null) {
page = 0L;
log.debug("page not set: default to {}", page);
......
CREATE SEQUENCE `qs_queries_seq` NOCACHE;
CREATE TABLE `qs_queries` ( `id` bigint not null primary key default nextval(`qs_queries_seq`), `created` datetime not null default now(), `executed` datetime not null default now(), `created_by` varchar(36) not null, `query` text not null, `query_normalized` text not null, `is_persisted` boolean not null, `query_hash` varchar(255) not null, `result_hash` varchar(255), `result_number` bigint ) WITH SYSTEM VERSIONING;
CREATE TABLE `qs_queries` ( `id` bigint not null primary key default nextval(`qs_queries_seq`), `created` datetime not null default now(), `executed` datetime not null default now(), `created_by` varchar(36), `query` text not null, `query_normalized` text not null, `is_persisted` boolean not null, `query_hash` varchar(255) not null, `result_hash` varchar(255), `result_number` bigint ) WITH SYSTEM VERSIONING;
CREATE PROCEDURE hash_table(IN name VARCHAR(255), OUT hash VARCHAR(255), OUT count BIGINT) BEGIN DECLARE _sql TEXT; SELECT CONCAT('SELECT SHA2(GROUP_CONCAT(CONCAT_WS(\'\',', GROUP_CONCAT(CONCAT('`', column_name, '`') ORDER BY column_name), ') SEPARATOR \',\'), 256) AS hash, COUNT(*) AS count FROM `', name, '` INTO @hash, @count;') FROM `information_schema`.`columns` WHERE `table_schema` = DATABASE() AND `table_name` = name INTO _sql; PREPARE stmt FROM _sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET hash = @hash; SET count = @count; END;
CREATE PROCEDURE store_query(IN query TEXT, IN executed DATETIME, OUT queryId BIGINT) BEGIN DECLARE _queryhash varchar(255) DEFAULT SHA2(query, 256); DECLARE _username varchar(255) DEFAULT REGEXP_REPLACE(current_user(), '@.*', ''); DECLARE _query TEXT DEFAULT CONCAT('CREATE OR REPLACE TABLE _tmp AS (', query, ')'); PREPARE stmt FROM _query; EXECUTE stmt; DEALLOCATE PREPARE stmt; CALL hash_table('_tmp', @hash, @count); DROP TABLE IF EXISTS `_tmp`; IF @hash IS NULL THEN INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); ELSE INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); END IF; END;
CREATE DEFINER = 'root' PROCEDURE _store_query(IN _username VARCHAR(255), IN query TEXT, IN executed DATETIME, OUT queryId BIGINT) BEGIN DECLARE _queryhash varchar(255) DEFAULT SHA2(query, 256); DECLARE _query TEXT DEFAULT CONCAT('CREATE OR REPLACE TABLE _tmp AS (', query, ')'); PREPARE stmt FROM _query; EXECUTE stmt; DEALLOCATE PREPARE stmt; CALL hash_table('_tmp', @hash, @count); DROP TABLE IF EXISTS `_tmp`; IF @hash IS NULL THEN INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); ELSE INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); END IF; END;
\ No newline at end of file
CREATE SEQUENCE `qs_queries_seq` NOCACHE;
CREATE TABLE `qs_queries` ( `id` bigint not null primary key default nextval(`qs_queries_seq`), `created` datetime not null default now(), `executed` datetime not null default now(), `created_by` varchar(36) not null, `query` text not null, `query_normalized` text not null, `is_persisted` boolean not null, `query_hash` varchar(255) not null, `result_hash` varchar(255), `result_number` bigint ) WITH SYSTEM VERSIONING;
CREATE TABLE `qs_queries` ( `id` bigint not null primary key default nextval(`qs_queries_seq`), `created` datetime not null default now(), `executed` datetime not null default now(), `created_by` varchar(36), `query` text not null, `query_normalized` text not null, `is_persisted` boolean not null, `query_hash` varchar(255) not null, `result_hash` varchar(255), `result_number` bigint ) WITH SYSTEM VERSIONING;
CREATE PROCEDURE hash_table(IN name VARCHAR(255), OUT hash VARCHAR(255), OUT count BIGINT) BEGIN DECLARE _sql TEXT; SELECT CONCAT('SELECT SHA2(GROUP_CONCAT(CONCAT_WS(\'\',', GROUP_CONCAT(CONCAT('`', column_name, '`') ORDER BY column_name), ') SEPARATOR \',\'), 256) AS hash, COUNT(*) AS count FROM `', name, '` INTO @hash, @count;') FROM `information_schema`.`columns` WHERE `table_schema` = DATABASE() AND `table_name` = name INTO _sql; PREPARE stmt FROM _sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET hash = @hash; SET count = @count; END;
CREATE PROCEDURE store_query(IN query TEXT, IN executed DATETIME, OUT queryId BIGINT) BEGIN DECLARE _queryhash varchar(255) DEFAULT SHA2(query, 256); DECLARE _username varchar(255) DEFAULT REGEXP_REPLACE(current_user(), '@.*', ''); DECLARE _query TEXT DEFAULT CONCAT('CREATE OR REPLACE TABLE _tmp AS (', query, ')'); PREPARE stmt FROM _query; EXECUTE stmt; DEALLOCATE PREPARE stmt; CALL hash_table('_tmp', @hash, @count); DROP TABLE IF EXISTS `_tmp`; IF @hash IS NULL THEN INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); ELSE INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); END IF; END;
CREATE DEFINER = 'root' PROCEDURE _store_query(IN _username VARCHAR(255), IN query TEXT, IN executed DATETIME, OUT queryId BIGINT) BEGIN DECLARE _queryhash varchar(255) DEFAULT SHA2(query, 256); DECLARE _query TEXT DEFAULT CONCAT('CREATE OR REPLACE TABLE _tmp AS (', query, ')'); PREPARE stmt FROM _query; EXECUTE stmt; DEALLOCATE PREPARE stmt; CALL hash_table('_tmp', @hash, @count); DROP TABLE IF EXISTS `_tmp`; IF @hash IS NULL THEN INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); ELSE INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); END IF; END;
\ No newline at end of file
......@@ -17,8 +17,8 @@ import at.tuwien.gateway.MetadataServiceGateway;
import at.tuwien.mapper.DataMapper;
import at.tuwien.mapper.MariaDbMapper;
import at.tuwien.mapper.MetadataMapper;
import at.tuwien.service.SubsetService;
import at.tuwien.service.StorageService;
import at.tuwien.service.SubsetService;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import io.micrometer.core.instrument.Counter;
import lombok.extern.log4j.Log4j2;
......@@ -287,7 +287,11 @@ public class SubsetServiceMariaDbImpl extends HibernateConnector implements Subs
/* insert query into query store */
final long start = System.currentTimeMillis();
final CallableStatement callableStatement = connection.prepareCall(mariaDbMapper.queryStoreStoreQueryRawQuery());
if (userId != null) {
callableStatement.setString(1, String.valueOf(userId));
} else {
callableStatement.setNull(1, Types.VARCHAR);
}
callableStatement.setString(2, query);
callableStatement.setTimestamp(3, Timestamp.from(timestamp));
callableStatement.registerOutParameter(4, Types.BIGINT);
......
......@@ -48,17 +48,7 @@ server {
listen 80 default_server;
server_name _;
location /admin/broker {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://broker;
proxy_read_timeout 90;
}
location /dashboard {
rewrite ^/dashboard/(.*) /$1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
......@@ -69,7 +59,6 @@ server {
# Proxy Grafana Live WebSocket connections.
location /dashboard/api/live {
rewrite ^/dashboard/(.*) /$1 break;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
......@@ -87,7 +76,7 @@ server {
}
location /api/broker {
rewrite /api/broker/(.*) /admin/broker/api/$1 break;
rewrite /api/broker/(.*) /api/$1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
......
......@@ -53,8 +53,7 @@ CREATE TABLE IF NOT EXISTS `mdb_containers`
privileged_username character varying(255) NOT NULL,
privileged_password character varying(255) NOT NULL,
quota integer NOT NULL DEFAULT 50,
PRIMARY KEY (id),
FOREIGN KEY (image_id) REFERENCES mdb_images (id)
PRIMARY KEY (id)
) WITH SYSTEM VERSIONING;
CREATE TABLE IF NOT EXISTS `mdb_data`
......@@ -80,7 +79,7 @@ CREATE TABLE IF NOT EXISTS `mdb_licenses`
CREATE TABLE IF NOT EXISTS `mdb_databases`
(
id SERIAL,
cid bigint NOT NULL,
cid BIGINT UNSIGNED NOT NULL,
name character varying(255) NOT NULL,
internal_name character varying(255) NOT NULL,
exchange_name character varying(255) NOT NULL,
......@@ -94,7 +93,7 @@ CREATE TABLE IF NOT EXISTS `mdb_databases`
created timestamp NOT NULL DEFAULT NOW(),
last_modified timestamp,
PRIMARY KEY (id),
FOREIGN KEY (cid) REFERENCES mdb_containers (id) /* currently we only support one-to-one */,
FOREIGN KEY (cid) REFERENCES mdb_containers (id),
FOREIGN KEY (created_by) REFERENCES mdb_users (id),
FOREIGN KEY (owned_by) REFERENCES mdb_users (id),
FOREIGN KEY (contact_person) REFERENCES mdb_users (id)
......@@ -110,7 +109,7 @@ CREATE TABLE IF NOT EXISTS `mdb_databases_subjects`
CREATE TABLE IF NOT EXISTS `mdb_tables`
(
ID SERIAL,
tDBID bigint NOT NULL,
tDBID BIGINT UNSIGNED NOT NULL,
tName VARCHAR(64) NOT NULL,
internal_name VARCHAR(64) NOT NULL,
queue_name VARCHAR(255) NOT NULL,
......@@ -141,18 +140,17 @@ CREATE TABLE IF NOT EXISTS `mdb_tables`
CREATE TABLE IF NOT EXISTS `mdb_columns`
(
ID BIGINT NOT NULL AUTO_INCREMENT,
tID BIGINT NOT NULL,
dfID BIGINT,
ID SERIAL,
tID BIGINT UNSIGNED NOT NULL,
cName VARCHAR(64),
internal_name VARCHAR(64) NOT NULL,
Datatype ENUM ('CHAR','VARCHAR','BINARY','VARBINARY','TINYBLOB','TINYTEXT','TEXT','BLOB','MEDIUMTEXT','MEDIUMBLOB','LONGTEXT','LONGBLOB','ENUM','SET','BIT','TINYINT','BOOL','SMALLINT','MEDIUMINT','INT','BIGINT','FLOAT','DOUBLE','DECIMAL','DATE','DATETIME','TIMESTAMP','TIME','YEAR'),
length BIGINT NULL,
length BIGINT UNSIGNED NULL,
ordinal_position INTEGER NOT NULL,
index_length BIGINT NULL,
index_length BIGINT UNSIGNED NULL,
description VARCHAR(2048),
size BIGINT,
d BIGINT,
size BIGINT UNSIGNED,
d BIGINT UNSIGNED,
auto_generated BOOLEAN DEFAULT false,
is_null_allowed BOOLEAN NOT NULL DEFAULT true,
val_min NUMERIC NULL,
......@@ -170,7 +168,7 @@ CREATE TABLE IF NOT EXISTS `mdb_columns`
CREATE TABLE IF NOT EXISTS `mdb_columns_enums`
(
id SERIAL,
column_id bigint NOT NULL,
column_id BIGINT UNSIGNED NOT NULL,
value CHARACTER VARYING(255) NOT NULL,
FOREIGN KEY (column_id) REFERENCES mdb_columns (ID) ON DELETE CASCADE,
PRIMARY KEY (id)
......@@ -179,7 +177,7 @@ CREATE TABLE IF NOT EXISTS `mdb_columns_enums`
CREATE TABLE IF NOT EXISTS `mdb_columns_sets`
(
id SERIAL,
column_id bigint NOT NULL,
column_id BIGINT UNSIGNED NOT NULL,
value CHARACTER VARYING(255) NOT NULL,
FOREIGN KEY (column_id) REFERENCES mdb_columns (ID) ON DELETE CASCADE,
PRIMARY KEY (id)
......@@ -187,8 +185,8 @@ CREATE TABLE IF NOT EXISTS `mdb_columns_sets`
CREATE TABLE IF NOT EXISTS `mdb_columns_nom`
(
cID bigint,
tID bigint,
cID BIGINT UNSIGNED,
tID BIGINT UNSIGNED,
maxlength INTEGER,
last_modified timestamp,
created timestamp NOT NULL DEFAULT NOW(),
......@@ -198,8 +196,8 @@ CREATE TABLE IF NOT EXISTS `mdb_columns_nom`
CREATE TABLE IF NOT EXISTS `mdb_columns_cat`
(
cID bigint,
tID bigint,
cID BIGINT UNSIGNED,
tID BIGINT UNSIGNED,
num_cat INTEGER,
-- cat_array TEXT[],
last_modified timestamp,
......@@ -210,9 +208,9 @@ CREATE TABLE IF NOT EXISTS `mdb_columns_cat`
CREATE TABLE IF NOT EXISTS `mdb_constraints_foreign_key`
(
fkid BIGINT NOT NULL AUTO_INCREMENT,
tid BIGINT NOT NULL,
rtid BIGINT NOT NULL,
fkid BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
tid BIGINT UNSIGNED NOT NULL,
rtid BIGINT UNSIGNED NOT NULL,
name VARCHAR(255) NOT NULL,
on_update VARCHAR(50) NULL,
on_delete VARCHAR(50) NULL,
......@@ -224,9 +222,9 @@ CREATE TABLE IF NOT EXISTS `mdb_constraints_foreign_key`
CREATE TABLE IF NOT EXISTS `mdb_constraints_primary_key`
(
pkid BIGINT NOT NULL AUTO_INCREMENT,
tID BIGINT NOT NULL,
cid BIGINT NOT NULL,
pkid SERIAL,
tID BIGINT UNSIGNED NOT NULL,
cid BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (pkid),
FOREIGN KEY (tID) REFERENCES mdb_tables (id) ON DELETE CASCADE,
FOREIGN KEY (cid) REFERENCES mdb_columns (id) ON DELETE CASCADE
......@@ -234,10 +232,10 @@ CREATE TABLE IF NOT EXISTS `mdb_constraints_primary_key`
CREATE TABLE IF NOT EXISTS `mdb_constraints_foreign_key_reference`
(
id BIGINT NOT NULL AUTO_INCREMENT,
fkid BIGINT NOT NULL,
cid BIGINT NOT NULL,
rcid BIGINT NOT NULL,
id SERIAL,
fkid BIGINT UNSIGNED NOT NULL,
cid BIGINT UNSIGNED NOT NULL,
rcid BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (id),
UNIQUE (fkid, cid, rcid),
FOREIGN KEY (fkid) REFERENCES mdb_constraints_foreign_key (fkid) ON UPDATE CASCADE,
......@@ -247,9 +245,9 @@ CREATE TABLE IF NOT EXISTS `mdb_constraints_foreign_key_reference`
CREATE TABLE IF NOT EXISTS `mdb_constraints_unique`
(
uid BIGINT NOT NULL AUTO_INCREMENT,
uid BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
tid BIGINT NOT NULL,
tid BIGINT UNSIGNED NOT NULL,
position INT NULL,
PRIMARY KEY (uid),
FOREIGN KEY (tid) REFERENCES mdb_tables (id) ON DELETE CASCADE
......@@ -257,9 +255,9 @@ CREATE TABLE IF NOT EXISTS `mdb_constraints_unique`
CREATE TABLE IF NOT EXISTS `mdb_constraints_unique_columns`
(
id BIGINT NOT NULL AUTO_INCREMENT,
uid BIGINT NOT NULL,
cid BIGINT NOT NULL,
id SERIAL,
uid BIGINT UNSIGNED NOT NULL,
cid BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (uid) REFERENCES mdb_constraints_unique (uid),
FOREIGN KEY (cid) REFERENCES mdb_columns (id) ON DELETE CASCADE
......@@ -267,8 +265,8 @@ CREATE TABLE IF NOT EXISTS `mdb_constraints_unique_columns`
CREATE TABLE IF NOT EXISTS `mdb_constraints_checks`
(
id BIGINT NOT NULL AUTO_INCREMENT,
tid BIGINT NOT NULL,
id SERIAL,
tid BIGINT UNSIGNED NOT NULL,
checks VARCHAR(255) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (tid) REFERENCES mdb_tables (id) ON DELETE CASCADE
......@@ -299,8 +297,8 @@ CREATE TABLE IF NOT EXISTS `mdb_units`
CREATE TABLE IF NOT EXISTS `mdb_columns_concepts`
(
id bigint NOT NULL,
cID bigint NOT NULL,
id BIGINT UNSIGNED NOT NULL,
cID BIGINT UNSIGNED NOT NULL,
created timestamp NOT NULL DEFAULT NOW(),
PRIMARY KEY (id, cid),
FOREIGN KEY (cID) REFERENCES mdb_columns (ID)
......@@ -308,8 +306,8 @@ CREATE TABLE IF NOT EXISTS `mdb_columns_concepts`
CREATE TABLE IF NOT EXISTS `mdb_columns_units`
(
id bigint NOT NULL,
cID bigint NOT NULL,
id BIGINT UNSIGNED NOT NULL,
cID BIGINT UNSIGNED NOT NULL,
created timestamp NOT NULL DEFAULT NOW(),
PRIMARY KEY (id, cID),
FOREIGN KEY (cID) REFERENCES mdb_columns (ID)
......@@ -318,7 +316,7 @@ CREATE TABLE IF NOT EXISTS `mdb_columns_units`
CREATE TABLE IF NOT EXISTS `mdb_view`
(
id SERIAL,
vdbid bigint NOT NULL,
vdbid BIGINT UNSIGNED NOT NULL,
vName VARCHAR(64) NOT NULL,
internal_name VARCHAR(64) NOT NULL,
Query TEXT NOT NULL,
......@@ -362,15 +360,15 @@ CREATE TABLE IF NOT EXISTS `mdb_ontologies`
CREATE TABLE IF NOT EXISTS `mdb_view_columns`
(
id BIGINT NOT NULL AUTO_INCREMENT,
view_id BIGINT NOT NULL,
dfID BIGINT,
id SERIAL,
view_id BIGINT UNSIGNED NOT NULL,
dfID BIGINT UNSIGNED,
name VARCHAR(64),
internal_name VARCHAR(64) NOT NULL,
column_type ENUM ('CHAR','VARCHAR','BINARY','VARBINARY','TINYBLOB','TINYTEXT','TEXT','BLOB','MEDIUMTEXT','MEDIUMBLOB','LONGTEXT','LONGBLOB','ENUM','SET','BIT','TINYINT','BOOL','SMALLINT','MEDIUMINT','INT','BIGINT','FLOAT','DOUBLE','DECIMAL','DATE','DATETIME','TIMESTAMP','TIME','YEAR'),
ordinal_position INTEGER NOT NULL,
size BIGINT,
d BIGINT,
size BIGINT UNSIGNED,
d BIGINT UNSIGNED,
auto_generated BOOLEAN DEFAULT false,
is_null_allowed BOOLEAN NOT NULL DEFAULT true,
PRIMARY KEY (id),
......@@ -379,11 +377,11 @@ CREATE TABLE IF NOT EXISTS `mdb_view_columns`
CREATE TABLE IF NOT EXISTS `mdb_identifiers`
(
id BIGINT NOT NULL AUTO_INCREMENT,
dbid BIGINT NOT NULL,
qid BIGINT,
vid BIGINT,
tid BIGINT,
id SERIAL,
dbid BIGINT UNSIGNED NOT NULL,
qid BIGINT UNSIGNED,
vid BIGINT UNSIGNED,
tid BIGINT UNSIGNED,
publisher VARCHAR(255) NOT NULL,
language VARCHAR(2),
publication_year INTEGER NOT NULL,
......@@ -408,7 +406,7 @@ CREATE TABLE IF NOT EXISTS `mdb_identifiers`
CREATE TABLE IF NOT EXISTS `mdb_identifier_licenses`
(
pid bigint NOT NULL,
pid BIGINT UNSIGNED NOT NULL,
license_id VARCHAR(255) NOT NULL,
PRIMARY KEY (pid, license_id),
FOREIGN KEY (pid) REFERENCES mdb_identifiers (id),
......@@ -418,7 +416,7 @@ CREATE TABLE IF NOT EXISTS `mdb_identifier_licenses`
CREATE TABLE IF NOT EXISTS `mdb_identifier_titles`
(
id SERIAL,
pid bigint NOT NULL,
pid BIGINT UNSIGNED NOT NULL,
title text NOT NULL,
title_type ENUM ('ALTERNATIVE_TITLE', 'SUBTITLE', 'TRANSLATED_TITLE', 'OTHER'),
language VARCHAR(2),
......@@ -429,7 +427,7 @@ CREATE TABLE IF NOT EXISTS `mdb_identifier_titles`
CREATE TABLE IF NOT EXISTS `mdb_identifier_funders`
(
id SERIAL,
pid bigint NOT NULL,
pid BIGINT UNSIGNED NOT NULL,
funder_name VARCHAR(255) NOT NULL,
funder_identifier TEXT,
funder_identifier_type ENUM ('CROSSREF_FUNDER_ID', 'GRID', 'ISNI', 'ROR', 'OTHER'),
......@@ -444,7 +442,7 @@ CREATE TABLE IF NOT EXISTS `mdb_identifier_funders`
CREATE TABLE IF NOT EXISTS `mdb_identifier_descriptions`
(
id SERIAL,
pid bigint NOT NULL,
pid BIGINT UNSIGNED NOT NULL,
description text NOT NULL,
description_type ENUM ('ABSTRACT', 'METHODS', 'SERIES_INFORMATION', 'TABLE_OF_CONTENTS', 'TECHNICAL_INFO', 'OTHER'),
language VARCHAR(2),
......@@ -455,7 +453,7 @@ CREATE TABLE IF NOT EXISTS `mdb_identifier_descriptions`
CREATE TABLE IF NOT EXISTS `mdb_related_identifiers`
(
id SERIAL,
pid bigint NOT NULL,
pid BIGINT UNSIGNED NOT NULL,
value varchar(255) NOT NULL,
type varchar(255) NOT NULL,
relation varchar(255) NOT NULL,
......@@ -467,7 +465,7 @@ CREATE TABLE IF NOT EXISTS `mdb_related_identifiers`
CREATE TABLE IF NOT EXISTS `mdb_identifier_creators`
(
id SERIAL,
pid bigint NOT NULL,
pid BIGINT UNSIGNED NOT NULL,
given_names text,
family_name text,
creator_name VARCHAR(255) NOT NULL,
......@@ -486,7 +484,7 @@ CREATE TABLE IF NOT EXISTS `mdb_identifier_creators`
CREATE TABLE IF NOT EXISTS `mdb_update`
(
uUserID character varying(255) NOT NULL,
uDBID bigint NOT NULL,
uDBID BIGINT UNSIGNED NOT NULL,
created timestamp NOT NULL DEFAULT NOW(),
PRIMARY KEY (uUserID, uDBID),
FOREIGN KEY (uDBID) REFERENCES mdb_databases (id)
......@@ -495,7 +493,7 @@ CREATE TABLE IF NOT EXISTS `mdb_update`
CREATE TABLE IF NOT EXISTS `mdb_access`
(
aUserID character varying(255) NOT NULL,
aDBID bigint REFERENCES mdb_databases (id),
aDBID BIGINT UNSIGNED REFERENCES mdb_databases (id),
attime TIMESTAMP,
download BOOLEAN,
created timestamp NOT NULL DEFAULT NOW(),
......@@ -505,7 +503,7 @@ CREATE TABLE IF NOT EXISTS `mdb_access`
CREATE TABLE IF NOT EXISTS `mdb_have_access`
(
user_id character varying(36) NOT NULL,
database_id bigint REFERENCES mdb_databases (id),
database_id BIGINT UNSIGNED REFERENCES mdb_databases (id),
access_type ENUM ('READ', 'WRITE_OWN', 'WRITE_ALL') NOT NULL,
created timestamp NOT NULL DEFAULT NOW(),
PRIMARY KEY (user_id, database_id),
......
......@@ -52,9 +52,6 @@ public class ColumnCreateDto {
@JsonProperty("unit_uri")
private String unitUri;
@Schema(description = "date format id")
private Long dfid;
@Schema(description = "enum values, only considered when type = ENUM")
private List<String> enums;
......
......@@ -57,9 +57,6 @@ public class ContainerImage {
@Column(nullable = false, unique = true, columnDefinition = "BOOLEAN DEFAULT FALSE")
private Boolean isDefault = false;
@OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL, CascadeType.PERSIST}, mappedBy = "image")
private List<ContainerImageDate> dateFormats;
@ToString.Exclude
@OneToMany(fetch = FetchType.LAZY, mappedBy = "image")
private List<Container> containers;
......
package at.tuwien.entities.container.image;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import jakarta.persistence.*;
import java.time.Instant;
@Data
@Entity
@Builder
@ToString
@AllArgsConstructor
@NoArgsConstructor
@EntityListeners(AuditingEntityListener.class)
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@Table(name = "mdb_images_date", uniqueConstraints = @UniqueConstraint(columnNames = {"database_format"}))
public class ContainerImageDate {
@Id
@EqualsAndHashCode.Include
@GeneratedValue(generator = "dates-sequence")
@GenericGenerator(name = "dates-sequence", strategy = "increment")
@Column(updatable = false, nullable = false)
private Long id;
@EqualsAndHashCode.Include
@Column(name = "iid")
private Long iid;
@ToString.Exclude
@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.MERGE})
@JoinColumns({
@JoinColumn(name = "iid", insertable = false, updatable = false)
})
private ContainerImage image;
@Column(name = "example", nullable = false)
private String example;
@Column(name = "has_time", nullable = false)
private Boolean hasTime;
@Column(name = "database_format", nullable = false)
private String databaseFormat;
@Column(name = "unix_format", nullable = false)
private String unixFormat;
@CreatedDate
@Column(name = "created_at", nullable = false, updatable = false, columnDefinition = "TIMESTAMP")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", timezone = "UTC")
private Instant createdAt;
}
package at.tuwien.entities.container.image;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
@EqualsAndHashCode
public class ContainerImageDateKey implements Serializable {
private Long id;
private Long iid;
}
package at.tuwien.entities.database;
import at.tuwien.entities.container.image.ContainerImageDate;
import at.tuwien.entities.database.table.columns.TableColumnType;
import lombok.*;
import org.hibernate.annotations.GenericGenerator;
......@@ -25,11 +24,6 @@ public class ViewColumn implements Comparable<ViewColumn> {
@Column(updatable = false, nullable = false)
private Long id;
@ToString.Exclude
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dfid", referencedColumnName = "id")
private ContainerImageDate dateFormat;
@ToString.Exclude
@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.MERGE})
@JoinColumns({
......
package at.tuwien.entities.database.table.columns;
import at.tuwien.entities.container.image.ContainerImageDate;
import at.tuwien.entities.database.table.Table;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
......@@ -38,11 +37,6 @@ public class TableColumn implements Comparable<TableColumn> {
@Column(updatable = false, nullable = false)
private Long id;
@ToString.Exclude
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dfid", referencedColumnName = "id")
private ContainerImageDate dateFormat;
@ToString.Exclude
@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.MERGE})
@JoinColumns({
......
......@@ -66,7 +66,7 @@ dbrepo:
searchService: http://localhost
analyseService: http://localhost
dataService: http://localhost:9093
brokerService: http://localhost/admin/broker
brokerService: http://localhost:15672
authService: http://localhost/api/auth
storageService: http://localhost/api/storage
rorService: https://api.ror.org
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment