You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by wf...@apache.org on 2015/04/25 00:29:27 UTC

aurora git commit: Add SQL tables needed for a datbase-backed task store.

Repository: aurora
Updated Branches:
  refs/heads/master 65df91bfd -> 94fe6c9df


Add SQL tables needed for a datbase-backed task store.

Bugs closed: AURORA-556

Reviewed at https://reviews.apache.org/r/33279/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/94fe6c9d
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/94fe6c9d
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/94fe6c9d

Branch: refs/heads/master
Commit: 94fe6c9df7322ec0acb1e203d73adccbb4155e0a
Parents: 65df91b
Author: Bill Farner <wf...@apache.org>
Authored: Fri Apr 24 15:27:11 2015 -0700
Committer: Bill Farner <wf...@apache.org>
Committed: Fri Apr 24 15:27:11 2015 -0700

----------------------------------------------------------------------
 .../aurora/scheduler/storage/db/schema.sql      | 124 +++++++++++++++++++
 1 file changed, 124 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/94fe6c9d/src/main/resources/org/apache/aurora/scheduler/storage/db/schema.sql
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/storage/db/schema.sql b/src/main/resources/org/apache/aurora/scheduler/storage/db/schema.sql
index ed73ef7..1ff8d23 100644
--- a/src/main/resources/org/apache/aurora/scheduler/storage/db/schema.sql
+++ b/src/main/resources/org/apache/aurora/scheduler/storage/db/schema.sql
@@ -171,3 +171,127 @@ CREATE TABLE job_instance_update_events(
   instance_id INT NOT NULL,
   timestamp_ms BIGINT NOT NULL
 );
+
+/**
+ * NOTE: This table is truncated by TaskMapper, which will cause a conflict when the table is shared
+ * with the forthcoming jobs table.  See note in TaskMapper about this before migrating MemJobStore.
+ */
+CREATE TABLE task_configs(
+  id IDENTITY,
+  job_key_id INT NOT NULL REFERENCES job_keys(id),
+  creator_user VARCHAR NOT NULL,
+  service BOOLEAN NOT NULL,
+  num_cpus FLOAT8 NOT NULL,
+  ram_mb INTEGER NOT NULL,
+  disk_mb INTEGER NOT NULL,
+  priority INTEGER NOT NULL,
+  max_task_failures INTEGER NOT NULL,
+  production BOOLEAN NOT NULL,
+  contact_email VARCHAR,
+  executor_name VARCHAR NOT NULL,
+  executor_data VARCHAR NOT NULL
+);
+
+CREATE TABLE task_constraints(
+  id IDENTITY,
+  task_config_id INT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
+  name VARCHAR NOT NULL,
+
+  UNIQUE(task_config_id, name)
+);
+
+CREATE TABLE value_constraints(
+  id IDENTITY,
+  constraint_id INT NOT NULL REFERENCES task_constraints(id) ON DELETE CASCADE,
+  negated BOOLEAN NOT NULL,
+
+  UNIQUE(constraint_id)
+);
+
+CREATE TABLE value_constraint_values(
+  id IDENTITY,
+  value_constraint_id INT NOT NULL REFERENCES value_constraints(id) ON DELETE CASCADE,
+  value VARCHAR NOT NULL,
+
+  UNIQUE(value_constraint_id, value)
+);
+
+CREATE TABLE limit_constraints(
+  id IDENTITY,
+  constraint_id INT NOT NULL REFERENCES task_constraints(id) ON DELETE CASCADE,
+  value INTEGER NOT NULL,
+
+  UNIQUE(constraint_id)
+);
+
+CREATE TABLE task_config_requested_ports(
+  id IDENTITY,
+  task_config_id INT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
+  port_name VARCHAR NOT NULL,
+
+  UNIQUE(task_config_id, port_name)
+);
+
+CREATE TABLE task_config_task_links(
+  id IDENTITY,
+  task_config_id INT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
+  label VARCHAR NOT NULL,
+  url VARCHAR NOT NULL,
+
+  UNIQUE(task_config_id, label)
+);
+
+CREATE TABLE task_config_metadata(
+  id IDENTITY,
+  task_config_id INT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
+  key VARCHAR NOT NULL,
+  value VARCHAR NOT NULL,
+
+  UNIQUE(task_config_id)
+);
+
+CREATE TABLE task_config_docker_containers(
+  id IDENTITY,
+  task_config_id INT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
+  image VARCHAR NOT NULL,
+
+  UNIQUE(task_config_id)
+);
+
+CREATE TABLE task_states(
+  id INT PRIMARY KEY,
+  name VARCHAR NOT NULL,
+
+  UNIQUE(name)
+);
+
+CREATE TABLE tasks(
+  id IDENTITY,
+  task_id VARCHAR NOT NULL,
+  slave_row_id INT REFERENCES host_attributes(id),
+  instance_id INTEGER NOT NULL,
+  status INT NOT NULL REFERENCES task_states(id),
+  failure_count INTEGER NOT NULL,
+  ancestor_task_id VARCHAR NULL,
+  task_config_row_id INT NOT NULL REFERENCES task_configs(id),
+
+  UNIQUE(task_id)
+);
+
+CREATE TABLE task_events(
+  id IDENTITY,
+  task_row_id INT NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
+  timestamp_ms BIGINT NOT NULL,
+  status INT NOT NULL REFERENCES task_states(id),
+  message VARCHAR NULL,
+  scheduler_host VARCHAR NULL,
+);
+
+CREATE TABLE task_ports(
+  id IDENTITY,
+  task_row_id INT NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
+  name VARCHAR NOT NULL,
+  port INT NOT NULL,
+
+  UNIQUE(task_row_id, name)
+);
\ No newline at end of file