Replace ACCOUNT_DIFF_PREFERENCES table with Git backend (part1)

Replace the usage of AccountDiffPreference with a different class in
extension API package.

Data is saved optimized in Git backend: default values are discarded
during save operation and restored during read operation; so that
this optimization step is transparent for the callers.

For example when only one setting, theme in this case, differs from
the default value, only this value is written into diff section in
preferences.config file:

+[diff]
+       theme = eclipse

To support live migration, the upgrade is done in two steps:

* part1 (this change):
  o Always write to both git and db
  o Introduce new configuration option to indicate whether to read from
    git or db, initially set to read from db
  o First binary update: some servers are reading/writing just the db;
    some servers are additionally writing to git
  o After first update: all servers are reading from the db, writing to
    both
  o Batch copy data from db to git (only related to non open source
    Gerrit version)
  o Update all servers to read from git. During the update, some will
    still be reading from the db; that's ok, because everybody is
    writing to git
* part2 (next change):
  o Bump database version, migrate the data from db to git, delete the
    table (and the flag) from the code and update the servers.

Change-Id: I30a6d82f4a8d0c33ae9bb26d7f93c66bd0cb8bee
This commit is contained in:
David Ostrovsky
2014-11-16 18:48:50 +01:00
committed by Edwin Kempin
parent ddd8ec8d06
commit 7d5a771844
43 changed files with 836 additions and 475 deletions

View File

@@ -16,6 +16,7 @@ package com.google.gerrit.reviewdb.client;
import static com.google.gerrit.reviewdb.client.RefNames.REFS_USERS;
import com.google.gerrit.extensions.client.DiffPreferencesInfo;
import com.google.gwtorm.client.Column;
import com.google.gwtorm.client.IntKey;
@@ -51,7 +52,7 @@ import java.sql.Timestamp;
* notifications of updates on that change, or just book-marking it for faster
* future reference. One record per starred change.</li>
*
* <li>{@link AccountDiffPreference}: user's preferences for rendering side-to-side
* <li>{@link DiffPreferencesInfo}: user's preferences for rendering side-to-side
* and unified diff</li>
*
* </ul>