[ARVADOS] updated: a58021c21d8ea05fa9b1a8cd0c0e1541f26f94c0
Git user
git at public.curoverse.com
Wed Sep 13 13:18:33 EDT 2017
Summary of changes:
.../api/config/initializers/init_permissions.rb | 9 --
.../20170906224040_materialized_permission_view.rb | 14 ++--
services/api/db/structure.sql | 95 ++++++++--------------
3 files changed, 39 insertions(+), 79 deletions(-)
delete mode 100644 services/api/config/initializers/init_permissions.rb
via a58021c21d8ea05fa9b1a8cd0c0e1541f26f94c0 (commit)
via 341b921a547e95e52852964dd3f9b3ff56cec90a (commit)
via 190e2b6980160aa6231c9b6a17c3a2b808260327 (commit)
from 037ecde427ca1049237e9b37801594f72887ce7f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit a58021c21d8ea05fa9b1a8cd0c0e1541f26f94c0
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Wed Sep 13 13:17:46 2017 -0400
12032: Refresh materialized_permission_view immediately after migration.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/services/api/config/initializers/init_permissions.rb b/services/api/config/initializers/init_permissions.rb
deleted file mode 100644
index 39a7ee8..0000000
--- a/services/api/config/initializers/init_permissions.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (C) The Arvados Authors. All rights reserved.
-#
-# SPDX-License-Identifier: AGPL-3.0
-
-require 'refresh_permission_view'
-
-if defined?(Rails::Server)
- refresh_permission_view
-end
diff --git a/services/api/db/migrate/20170906224040_materialized_permission_view.rb b/services/api/db/migrate/20170906224040_materialized_permission_view.rb
index ef6701f..00eae79 100644
--- a/services/api/db/migrate/20170906224040_materialized_permission_view.rb
+++ b/services/api/db/migrate/20170906224040_materialized_permission_view.rb
@@ -100,6 +100,8 @@ SELECT user_uuid,
@@idxtables.each do |table|
ActiveRecord::Base.connection.execute("CREATE INDEX index_#{table.to_s}_on_modified_at_uuid ON #{table.to_s} USING btree (modified_at desc, uuid asc)")
end
+
+ ActiveRecord::Base.connection.exec_query("REFRESH MATERIALIZED VIEW #{PERMISSION_VIEW}")
end
def down
commit 341b921a547e95e52852964dd3f9b3ff56cec90a
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Wed Sep 13 11:51:28 2017 -0400
12032: Remove startnode from materialized_permission_view (again), tests pass
without it.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/services/api/db/migrate/20170906224040_materialized_permission_view.rb b/services/api/db/migrate/20170906224040_materialized_permission_view.rb
index 704f202..ef6701f 100644
--- a/services/api/db/migrate/20170906224040_materialized_permission_view.rb
+++ b/services/api/db/migrate/20170906224040_materialized_permission_view.rb
@@ -56,24 +56,22 @@ perm_edges (tail_uuid, head_uuid, val, follow, trashed) AS (
CASE WHEN trash_at IS NOT NULL and trash_at < clock_timestamp() THEN 1 ELSE 0 END
FROM groups
),
-perm (val, follow, user_uuid, target_uuid, trashed, startnode) AS (
+perm (val, follow, user_uuid, target_uuid, trashed) AS (
SELECT 3::smallint AS val,
- false AS follow,
+ true AS follow,
users.uuid::varchar(32) AS user_uuid,
users.uuid::varchar(32) AS target_uuid,
- 0::smallint AS trashed,
- true AS startnode
+ 0::smallint AS trashed
FROM users
UNION
SELECT LEAST(perm.val, edges.val)::smallint AS val,
edges.follow AS follow,
perm.user_uuid::varchar(32) AS user_uuid,
edges.head_uuid::varchar(32) AS target_uuid,
- GREATEST(perm.trashed, edges.trashed)::smallint AS trashed,
- false AS startnode
+ GREATEST(perm.trashed, edges.trashed)::smallint AS trashed
FROM perm
INNER JOIN perm_edges edges
- ON (perm.startnode or perm.follow) AND edges.tail_uuid = perm.target_uuid
+ ON perm.follow AND edges.tail_uuid = perm.target_uuid
)
SELECT user_uuid,
target_uuid,
diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql
index ba91b30..b788749 100644
--- a/services/api/db/structure.sql
+++ b/services/api/db/structure.sql
@@ -802,23 +802,21 @@ CREATE MATERIALIZED VIEW materialized_permission_view AS
ELSE 0
END AS "case"
FROM groups
- ), perm(val, follow, user_uuid, target_uuid, trashed, startnode) AS (
+ ), perm(val, follow, user_uuid, target_uuid, trashed) AS (
SELECT (3)::smallint AS val,
- false AS follow,
+ true AS follow,
(users.uuid)::character varying(32) AS user_uuid,
(users.uuid)::character varying(32) AS target_uuid,
- (0)::smallint AS trashed,
- true AS startnode
+ (0)::smallint AS trashed
FROM users
UNION
SELECT (LEAST((perm_1.val)::integer, edges.val))::smallint AS val,
edges.follow,
perm_1.user_uuid,
(edges.head_uuid)::character varying(32) AS target_uuid,
- (GREATEST((perm_1.trashed)::integer, edges.trashed))::smallint AS trashed,
- false AS startnode
+ (GREATEST((perm_1.trashed)::integer, edges.trashed))::smallint AS trashed
FROM (perm perm_1
- JOIN perm_edges edges ON (((perm_1.startnode OR perm_1.follow) AND ((edges.tail_uuid)::text = (perm_1.target_uuid)::text))))
+ JOIN perm_edges edges ON ((perm_1.follow AND ((edges.tail_uuid)::text = (perm_1.target_uuid)::text))))
)
SELECT perm.user_uuid,
perm.target_uuid,
commit 190e2b6980160aa6231c9b6a17c3a2b808260327
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Wed Sep 13 11:32:24 2017 -0400
12032: Update structure.sql from master schema + migration only.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql
index 4a874fb..ba91b30 100644
--- a/services/api/db/structure.sql
+++ b/services/api/db/structure.sql
@@ -710,23 +710,11 @@ ALTER SEQUENCE links_id_seq OWNED BY links.id;
--
--- Name: logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE logs_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
-- Name: logs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE logs (
- id integer DEFAULT nextval('logs_id_seq'::regclass) NOT NULL,
+ id integer NOT NULL,
uuid character varying(255),
owner_uuid character varying(255),
modified_by_client_uuid character varying(255),
@@ -744,6 +732,25 @@ CREATE TABLE logs (
--
+-- Name: logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE logs_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE logs_id_seq OWNED BY logs.id;
+
+
+--
-- Name: users; Type: TABLE; Schema: public; Owner: -
--
@@ -957,30 +964,6 @@ ALTER SEQUENCE pipeline_templates_id_seq OWNED BY pipeline_templates.id;
--
--- Name: read_permissions; Type: VIEW; Schema: public; Owner: -
---
-
-CREATE VIEW read_permissions AS
- WITH RECURSIVE read_permissions(follow, user_uuid, readable_uuid) AS (
- SELECT true AS bool,
- users.uuid,
- users.uuid
- FROM users
- UNION
- SELECT (((links.name)::text = 'can_manage'::text) OR ((links.head_uuid)::text ~~ 'su92l-j7d0g-%'::text)) AS follow,
- rp.user_uuid,
- links.head_uuid
- FROM read_permissions rp,
- links
- WHERE (rp.follow AND ((links.tail_uuid)::text = (rp.readable_uuid)::text))
- )
- SELECT read_permissions.follow,
- read_permissions.user_uuid,
- read_permissions.readable_uuid
- FROM read_permissions;
-
-
---
-- Name: repositories; Type: TABLE; Schema: public; Owner: -
--
@@ -1017,18 +1000,6 @@ ALTER SEQUENCE repositories_id_seq OWNED BY repositories.id;
--
--- Name: rp_cache; Type: MATERIALIZED VIEW; Schema: public; Owner: -
---
-
-CREATE MATERIALIZED VIEW rp_cache AS
- SELECT read_permissions.follow,
- read_permissions.user_uuid,
- read_permissions.readable_uuid
- FROM read_permissions
- WITH NO DATA;
-
-
---
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
--
@@ -1310,6 +1281,13 @@ ALTER TABLE ONLY links ALTER COLUMN id SET DEFAULT nextval('links_id_seq'::regcl
--
+-- Name: logs id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY logs ALTER COLUMN id SET DEFAULT nextval('logs_id_seq'::regclass);
+
+
+--
-- Name: nodes id; Type: DEFAULT; Schema: public; Owner: -
--
@@ -2644,13 +2622,6 @@ CREATE INDEX specimens_search_index ON specimens USING btree (uuid, owner_uuid,
--
--- Name: test_1; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX test_1 ON collections USING btree (id) WHERE (delete_at IS NULL);
-
-
---
-- Name: traits_search_index; Type: INDEX; Schema: public; Owner: -
--
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list