<div dir="ltr"><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 18, 2017 at 12:17 PM, Yedidyah Bar David <span dir="ltr">&lt;<a href="mailto:didi@redhat.com" target="_blank">didi@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Jul 18, 2017 at 12:10 PM, Eli Mesika &lt;<a href="mailto:emesika@redhat.com">emesika@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Jul 18, 2017 at 8:56 AM, Yedidyah Bar David &lt;<a href="mailto:didi@redhat.com">didi@redhat.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Tue, Jul 18, 2017 at 1:29 AM, Martin Perina &lt;<a href="mailto:mperina@redhat.com">mperina@redhat.com</a>&gt; wrote:<br>
&gt;&gt; &gt; Hello,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; to make things completely clear: any developer which will perform any<br>
&gt;&gt; &gt; changes around permissions tables need to use only predefined stored<br>
&gt;&gt; &gt; procedures for permissions handling. If for some reason direct SQL<br>
&gt;&gt; &gt; update is<br>
&gt;&gt; &gt; performed, then materialized view will not be refreshed until some<br>
&gt;&gt; &gt; permission stored procedure is called, which could cause strange<br>
&gt;&gt; &gt; results.<br>
&gt;&gt;<br>
&gt;&gt; Isn&#39;t it possible to prevent such accidents somehow?<br>
&gt;&gt;<br>
&gt;&gt; E.g., is it possible that:<br>
&gt;&gt; 1. We rename current table (&quot;permissions&quot;) to some &quot;private&quot;<br>
&gt;&gt; name (e.g. &quot;permissions_tab&quot;)<br>
&gt;<br>
&gt; This is possible<br>
<br>
</span>OK. Are we going to? Is there a downside?<br></blockquote><div><br><div style="font-size:large;display:inline" class="gmail_default">​Yes we can :-) , no downsides as much as I concern ​</div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
We also might still have a view &#39;permissions&#39; if we want to support<br>
old code that reads from it.<br></blockquote><div><br><div style="font-size:large;display:inline" class="gmail_default">​Old views will remain the same and you can read from them as usual ​</div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; 2. We create the materialized view having the name of the<br>
&gt;&gt; original table (&quot;permissions&quot;)<br>
&gt;<br>
&gt;<br>
&gt; The MV replaces the views that uses the permissions table.<br>
&gt; The plan is to rename the original view to something else and have the<br>
&gt; created MV with the original view name<br>
&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; 3. We do what&#39;s needed (?) so that direct inserts/updates/deletes<br>
&gt;&gt; on the view either fail or do the right thing.<br>
&gt;<br>
&gt;<br>
&gt; See my answer in 1)<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Eli has already removed all such code within patch [3], so this is just<br>
&gt;&gt; &gt; a<br>
&gt;&gt; &gt; warning for future.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Martin<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Mon, Jul 17, 2017 at 9:47 PM, Eli Mesika &lt;<a href="mailto:emesika@redhat.com">emesika@redhat.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Materialized Views [1] can be used to reduce query time on complex<br>
&gt;&gt; &gt;&gt; queries<br>
&gt;&gt; &gt;&gt; with low data update<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; The first candidates to use this feature are all the *permission* views<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; There is already a RFE [2] opened for that.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Please make sure that each call that handles the permissions table data<br>
&gt;&gt; &gt;&gt; is<br>
&gt;&gt; &gt;&gt; using the corresponding SP in dbscripts/multi_level_<wbr>administration.sql<br>
&gt;&gt; &gt;&gt; No direct access to the permissions table is allowed !<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; In case that a direct access to the permissions table is used, you<br>
&gt;&gt; &gt;&gt; should<br>
&gt;&gt; &gt;&gt; replace the code in a call to the corresponding SP as you can see in<br>
&gt;&gt; &gt;&gt; [3]<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; A direct use that will not be replaced with a call to the corresponding<br>
&gt;&gt; &gt;&gt; SP<br>
&gt;&gt; &gt;&gt; may cause that direct changes to the permissions table will not be<br>
&gt;&gt; &gt;&gt; reflected<br>
&gt;&gt; &gt;&gt; in the<br>
&gt;&gt; &gt;&gt; *permission* Materialized Views and the views will remain dirty until a<br>
&gt;&gt; &gt;&gt; change that is calling one of the SPs that handle the data of the<br>
&gt;&gt; &gt;&gt; permissions table is issued and cause the Materialized Views to be<br>
&gt;&gt; &gt;&gt; refreshed<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Please check your code for direct use of the permissions table and<br>
&gt;&gt; &gt;&gt; consult<br>
&gt;&gt; &gt;&gt; with me if you have any questions or issues.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Thanks<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Eli Mesika<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; [1] <a href="https://wiki.postgresql.org/wiki/Materialized_Views" rel="noreferrer" target="_blank">https://wiki.postgresql.org/<wbr>wiki/Materialized_Views</a><br>
&gt;&gt; &gt;&gt; [2] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1470991" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/<wbr>show_bug.cgi?id=1470991</a><br>
&gt;&gt; &gt;&gt; [3] <a href="https://gerrit.ovirt.org/#/c/79287/" rel="noreferrer" target="_blank">https://gerrit.ovirt.org/#/c/<wbr>79287/</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt; &gt;&gt; Devel mailing list<br>
&gt;&gt; &gt;&gt; <a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a><br>
&gt;&gt; &gt;&gt; <a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; ______________________________<wbr>_________________<br>
&gt;&gt; &gt; Devel mailing list<br>
&gt;&gt; &gt; <a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a><br>
&gt;&gt; &gt; <a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Didi<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Didi<br>
</font></span></blockquote></div><br></div></div>