aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject aurora git commit: Fixing SQL schema data types.
Date Fri, 18 Sep 2015 17:13:10 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 26644fcc5 -> b320a0776


Fixing SQL schema data types.

Bugs closed: AURORA-1494

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


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

Branch: refs/heads/master
Commit: b320a0776d014b6450583914050252d1141260af
Parents: 26644fc
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Fri Sep 18 10:12:53 2015 -0700
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Fri Sep 18 10:12:53 2015 -0700

----------------------------------------------------------------------
 .../aurora/scheduler/storage/db/schema.sql      | 46 ++++++++++----------
 .../storage/db/DbJobUpdateStoreTest.java        | 24 ++++++++++
 2 files changed, 47 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/b320a077/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 4df685a..803960f 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
@@ -46,9 +46,9 @@ CREATE TABLE locks(
 CREATE TABLE quotas(
   id IDENTITY,
   role VARCHAR NOT NULL,
-  num_cpus FLOAT NOT NULL,
-  ram_mb INT NOT NULL,
-  disk_mb INT NOT NULL,
+  num_cpus DOUBLE NOT NULL,
+  ram_mb BIGINT NOT NULL,
+  disk_mb BIGINT NOT NULL,
 
   UNIQUE(role)
 );
@@ -85,12 +85,12 @@ CREATE TABLE host_attribute_values(
  */
 CREATE TABLE task_configs(
   id IDENTITY,
-  job_key_id INT NOT NULL REFERENCES job_keys(id),
+  job_key_id BIGINT 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,
+  num_cpus DOUBLE NOT NULL,
+  ram_mb BIGINT NOT NULL,
+  disk_mb BIGINT NOT NULL,
   priority INTEGER NOT NULL,
   max_task_failures INTEGER NOT NULL,
   production BOOLEAN NOT NULL,
@@ -102,7 +102,7 @@ CREATE TABLE task_configs(
 
 CREATE TABLE task_constraints(
   id IDENTITY,
-  task_config_id INT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
+  task_config_id BIGINT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
   name VARCHAR NOT NULL,
 
   UNIQUE(task_config_id, name)
@@ -110,7 +110,7 @@ CREATE TABLE task_constraints(
 
 CREATE TABLE value_constraints(
   id IDENTITY,
-  constraint_id INT NOT NULL REFERENCES task_constraints(id) ON DELETE CASCADE,
+  constraint_id BIGINT NOT NULL REFERENCES task_constraints(id) ON DELETE CASCADE,
   negated BOOLEAN NOT NULL,
 
   UNIQUE(constraint_id)
@@ -118,7 +118,7 @@ CREATE TABLE value_constraints(
 
 CREATE TABLE value_constraint_values(
   id IDENTITY,
-  value_constraint_id INT NOT NULL REFERENCES value_constraints(id) ON DELETE CASCADE,
+  value_constraint_id BIGINT NOT NULL REFERENCES value_constraints(id) ON DELETE CASCADE,
   value VARCHAR NOT NULL,
 
   UNIQUE(value_constraint_id, value)
@@ -126,7 +126,7 @@ CREATE TABLE value_constraint_values(
 
 CREATE TABLE limit_constraints(
   id IDENTITY,
-  constraint_id INT NOT NULL REFERENCES task_constraints(id) ON DELETE CASCADE,
+  constraint_id BIGINT NOT NULL REFERENCES task_constraints(id) ON DELETE CASCADE,
   value INTEGER NOT NULL,
 
   UNIQUE(constraint_id)
@@ -134,7 +134,7 @@ CREATE TABLE limit_constraints(
 
 CREATE TABLE task_config_requested_ports(
   id IDENTITY,
-  task_config_id INT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
+  task_config_id BIGINT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
   port_name VARCHAR NOT NULL,
 
   UNIQUE(task_config_id, port_name)
@@ -142,7 +142,7 @@ CREATE TABLE task_config_requested_ports(
 
 CREATE TABLE task_config_task_links(
   id IDENTITY,
-  task_config_id INT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
+  task_config_id BIGINT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
   label VARCHAR NOT NULL,
   url VARCHAR NOT NULL,
 
@@ -151,14 +151,14 @@ CREATE TABLE task_config_task_links(
 
 CREATE TABLE task_config_metadata(
   id IDENTITY,
-  task_config_id INT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
+  task_config_id BIGINT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
   key VARCHAR NOT NULL,
   value VARCHAR NOT NULL
 );
 
 CREATE TABLE task_config_docker_containers(
   id IDENTITY,
-  task_config_id INT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
+  task_config_id BIGINT NOT NULL REFERENCES task_configs(id) ON DELETE CASCADE,
   image VARCHAR NOT NULL,
 
   UNIQUE(task_config_id)
@@ -166,7 +166,7 @@ CREATE TABLE task_config_docker_containers(
 
 CREATE TABLE task_config_docker_container_parameters(
   id IDENTITY,
-  container_id INT NOT NULL REFERENCES task_config_docker_containers(id) ON DELETE CASCADE,
+  container_id BIGINT NOT NULL REFERENCES task_config_docker_containers(id) ON DELETE CASCADE,
   name VARCHAR NOT NULL,
   value VARCHAR NOT NULL
 );
@@ -181,19 +181,19 @@ CREATE TABLE task_states(
 CREATE TABLE tasks(
   id IDENTITY,
   task_id VARCHAR NOT NULL,
-  slave_row_id INT REFERENCES host_attributes(id),
+  slave_row_id BIGINT 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),
+  task_config_row_id BIGINT 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,
+  task_row_id BIGINT NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
   timestamp_ms BIGINT NOT NULL,
   status INT NOT NULL REFERENCES task_states(id),
   message VARCHAR NULL,
@@ -202,7 +202,7 @@ CREATE TABLE task_events(
 
 CREATE TABLE task_ports(
   id IDENTITY,
-  task_row_id INT NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
+  task_row_id BIGINT NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
   name VARCHAR NOT NULL,
   port INT NOT NULL,
 
@@ -218,11 +218,11 @@ CREATE TABLE cron_policies(
 
 CREATE TABLE cron_jobs(
   id IDENTITY,
-  job_key_id INT NOT NULL REFERENCES job_keys(id),
+  job_key_id BIGINT NOT NULL REFERENCES job_keys(id),
   creator_user VARCHAR NOT NULL,
   cron_schedule VARCHAR NOT NULL,
   cron_collision_policy INT REFERENCES cron_policies(id),
-  task_config_row_id INT NOT NULL REFERENCES task_configs(id),
+  task_config_row_id BIGINT NOT NULL REFERENCES task_configs(id),
   instance_count INT NOT NULL,
 
   UNIQUE(job_key_id)
@@ -271,7 +271,7 @@ CREATE TABLE job_update_locks(
 CREATE TABLE job_update_configs(
   id IDENTITY,
   update_row_id BIGINT NOT NULL REFERENCES job_updates(id) ON DELETE CASCADE,
-  task_config_row_id INT NOT NULL REFERENCES task_configs(id),
+  task_config_row_id BIGINT NOT NULL REFERENCES task_configs(id),
   is_new BOOLEAN NOT NULL
 );
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/b320a077/src/test/java/org/apache/aurora/scheduler/storage/db/DbJobUpdateStoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/db/DbJobUpdateStoreTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/db/DbJobUpdateStoreTest.java
index c159378..9d5468c 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/db/DbJobUpdateStoreTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/db/DbJobUpdateStoreTest.java
@@ -170,6 +170,30 @@ public class DbJobUpdateStoreTest {
   }
 
   @Test
+  public void testSaveJobUpdateWithLargeTaskConfigValues() {
+    // AURORA-1494 regression test validating max resources values are allowed.
+    IJobUpdateKey updateId = makeKey(JobKeys.from("role", "env", "name1"), "u1");
+
+    JobUpdate builder = makeFullyPopulatedUpdate(updateId).newBuilder();
+    builder.getInstructions().getDesiredState().getTask().setNumCpus(Double.MAX_VALUE);
+    builder.getInstructions().getDesiredState().getTask().setRamMb(Long.MAX_VALUE);
+    builder.getInstructions().getDesiredState().getTask().setDiskMb(Long.MAX_VALUE);
+
+    IJobUpdate update = IJobUpdate.build(builder);
+
+    assertEquals(Optional.absent(), getUpdate(updateId));
+
+    StorageEntityUtil.assertFullyPopulated(
+        update,
+        StorageEntityUtil.getField(JobUpdateSummary.class, "state"),
+        StorageEntityUtil.getField(IJobUpdateSummary.class, "state"),
+        StorageEntityUtil.getField(Range.class, "first"),
+        StorageEntityUtil.getField(Range.class, "last"));
+    saveUpdate(update, Optional.of("lock1"));
+    assertUpdate(update);
+  }
+
+  @Test
   public void testSaveNullInitialState() {
     JobUpdate builder = makeJobUpdate(makeKey("u1")).newBuilder();
     builder.getInstructions().unsetInitialState();


Mime
View raw message