<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>CKAN: Ticket #1077: Switch to new vdm changeset model</title>
    <link>http://localhost/ticket/1077</link>
    <description>&lt;p&gt;
Have developed a new "changeset" based model for revisioning in vdm. This has several advantages:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Much simpler
&lt;/li&gt;&lt;li&gt;Cleaner separation of continuity from changesets
&lt;ul&gt;&lt;li&gt;Supports certain operations that are impossible now (e.g. deleting all changes to a particular object irrespective of whether other objects were changed in same revisions).
&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Easier support for pending state and similar behaviour
&lt;/li&gt;&lt;li&gt;No need to introduce new tables (and hence migrations) when making something revisioned (or not).
&lt;/li&gt;&lt;li&gt;Almost identical API
&lt;/li&gt;&lt;/ul&gt;&lt;h2 id="PossibleDisadvantages"&gt;Possible Disadvantages&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Difficult to query revision history. Currently we have a way of finding out the diffs of particular packages.  These diffs *include* changes to objects associated with packages (i.e a resource attached to a package).  With the new model the only way to get this information is by looking in the json stored in the change object which is very awkward.
&lt;ul&gt;&lt;li&gt;RP: not sure this is true. You can query on object id very easily in the changeset model. Possible complication here is working out what objects are associated to say a package (e.g. have to look up ids of package_tags) but this does not seem more problematic than what you would do in other model to achieve the same ends.s
&lt;ul&gt;&lt;li&gt;DR: In looking for related objects we do joins between revision tables and the main tables.  For example we join the package_extras_revision table to the package table.  We could not do this with the new model as we would need to look into change object table dict for the join, which is painful.  Also the object_ids are tuples as the moment which is difficult to join on.
&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Does not give us anything extra if we simplify our use of vdm currently. (see alternative below)
&lt;ul&gt;&lt;li&gt;RP: not quite true. E.g. pending support and API.
&lt;ul&gt;&lt;li&gt;DR: pending support would be there if we did not use any stateful lists/dicts and use vdm as a copy on write only with revision_id only.  I do not know what you mean by api.
&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;A large change to database structure needs to happen.
&lt;/li&gt;&lt;/ul&gt;&lt;h2 id="Implementation"&gt;Implementation&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;The main challenge with this change is schema and data migration
&lt;/li&gt;&lt;/ul&gt;&lt;h3 id="Migration"&gt;Migration&lt;/h3&gt;
&lt;p&gt;
Every revisioned object has a revision_id and revision attribute.
&lt;/p&gt;
&lt;p&gt;
Approximate algorithm:
&lt;/p&gt;
&lt;pre class="wiki"&gt;Revision -&amp;gt; Changeset
for revtype in [PackageRevision, ...]:
    for pkgrev in package_revision:
        changeset = lookupchangeset(package_revision)
        ChangeObject(cset, (table, id), dictize(pkgrev))
&lt;/pre&gt;&lt;p&gt;
Question:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;does pkg include tags attributes or not? or we have to dictize, pkgrev, pkg2tagrev, and tag. Probably the latter.
&lt;/li&gt;&lt;/ul&gt;&lt;h2 id="Alternative"&gt;Alternative&lt;/h2&gt;
&lt;p&gt;
Instead of restructuring the whole of the database to fit the new changeset model just simplifying our use of the current vdm by removing stateful list/dicts and handling this state ourselves in the logic layer could be adequate. The vdm would then be just a simple copy on write mechanism at the table level.  This seems to cover all advantages/disadvantages above.
&lt;/p&gt;
</description>
    <language>en-us</language>
    <image>
      <title>CKAN</title>
      <url>http://assets.okfn.org/p/ckan/img/ckan_logo_shortname.png</url>
      <link>http://localhost/ticket/1077</link>
    </image>
    <generator>Trac 0.12.3</generator>
    <item>
      
        <dc:creator>rgrp</dc:creator>

      <pubDate>Mon, 18 Apr 2011 11:36:41 GMT</pubDate>
      <title>priority, description changed</title>
      <link>http://localhost/ticket/1077#comment:1</link>
      <guid isPermaLink="false">http://localhost/ticket/1077#comment:1</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;priority&lt;/strong&gt;
                changed from &lt;em&gt;awaiting triage&lt;/em&gt; to &lt;em&gt;critical&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;description&lt;/strong&gt;
              modified (&lt;a href="/ticket/1077?action=diff&amp;amp;version=1"&gt;diff&lt;/a&gt;)
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>kindly</dc:creator>

      <pubDate>Mon, 02 May 2011 11:01:19 GMT</pubDate>
      <title>description changed</title>
      <link>http://localhost/ticket/1077#comment:2</link>
      <guid isPermaLink="false">http://localhost/ticket/1077#comment:2</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;description&lt;/strong&gt;
              modified (&lt;a href="/ticket/1077?action=diff&amp;amp;version=2"&gt;diff&lt;/a&gt;)
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>rgrp</dc:creator>

      <pubDate>Sun, 08 May 2011 12:24:53 GMT</pubDate>
      <title>description changed; state set</title>
      <link>http://localhost/ticket/1077#comment:3</link>
      <guid isPermaLink="false">http://localhost/ticket/1077#comment:3</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;state&lt;/strong&gt;
                set to &lt;em&gt;draft&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;description&lt;/strong&gt;
              modified (&lt;a href="/ticket/1077?action=diff&amp;amp;version=3"&gt;diff&lt;/a&gt;)
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>kindly</dc:creator>

      <pubDate>Sun, 08 May 2011 18:58:07 GMT</pubDate>
      <title>description changed</title>
      <link>http://localhost/ticket/1077#comment:4</link>
      <guid isPermaLink="false">http://localhost/ticket/1077#comment:4</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;description&lt;/strong&gt;
              modified (&lt;a href="/ticket/1077?action=diff&amp;amp;version=4"&gt;diff&lt;/a&gt;)
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>rgrp</dc:creator>

      <pubDate>Thu, 12 May 2011 14:57:51 GMT</pubDate>
      <title>description, summary changed</title>
      <link>http://localhost/ticket/1077#comment:5</link>
      <guid isPermaLink="false">http://localhost/ticket/1077#comment:5</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;description&lt;/strong&gt;
              modified (&lt;a href="/ticket/1077?action=diff&amp;amp;version=5"&gt;diff&lt;/a&gt;)
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;summary&lt;/strong&gt;
                changed from &lt;em&gt;Switch to new vdm changeset model&lt;/em&gt; to &lt;em&gt;Move to simpler vdm system&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>shevski</dc:creator>

      <pubDate>Fri, 08 Jul 2011 11:56:54 GMT</pubDate>
      <title>milestone deleted</title>
      <link>http://localhost/ticket/1077#comment:6</link>
      <guid isPermaLink="false">http://localhost/ticket/1077#comment:6</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;milestone&lt;/strong&gt;
                &lt;em&gt;ckan-v1.5&lt;/em&gt; deleted
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>dread</dc:creator>

      <pubDate>Fri, 28 Oct 2011 10:21:24 GMT</pubDate>
      <title>priority changed</title>
      <link>http://localhost/ticket/1077#comment:7</link>
      <guid isPermaLink="false">http://localhost/ticket/1077#comment:7</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;priority&lt;/strong&gt;
                changed from &lt;em&gt;critical&lt;/em&gt; to &lt;em&gt;awaiting triage&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
I guess this is not a priority now.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>kindly</dc:creator>

      <pubDate>Mon, 18 Jun 2012 15:45:45 GMT</pubDate>
      <title>milestone set</title>
      <link>http://localhost/ticket/1077#comment:8</link>
      <guid isPermaLink="false">http://localhost/ticket/1077#comment:8</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;milestone&lt;/strong&gt;
                set to &lt;em&gt;ckan-backlog&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>