Skip to content

Adding an "extras" column to transport databases #578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 12, 2019

Conversation

ashwinraghav
Copy link
Contributor

@ashwinraghav ashwinraghav commented Jul 1, 2019

  1. We add an extras column to the transport_contexts table.
  2. We introduce migrations to the new state for existing clients. Table creates are also modeled as migrations.
  3. Migrations are upgrade only. Downgrades are lossy and tables are dropped and recreated. Here's why
    1. When app developers downgrade their app, our SDKs potentially get downgraded (from say Vn to Vn-1). Since SDKs cannot know in advance what migrations are coming, Vn-1 will not know that (say) renaming a column will restore the database to the state expected by code in Vn-1.
    2. The other option would be to enforce all database migrations to be indefinitely backward compatible going forward. This will allow us to downgrade lossless-ly.
      Both options do not yield us enough value, with the potential to introduce bugs.
  4. We test migrations using a combination of high level operations on the SQLiteEventStore and operations on SchemaManager.
  5. We no longer need to inject SQL statements, since the behavior of the store can be controlled by injecting only the version of the database. (Sorry! 😞 )

@googlebot googlebot added the cla: yes Override cla label Jul 1, 2019
@ashwinraghav ashwinraghav changed the base branch from master to ashwinraghav.apiKey.1 July 1, 2019 16:35
@ashwinraghav ashwinraghav force-pushed the ashwinraghav.apiKey.2 branch 8 times, most recently from 167aa5c to 58dee2d Compare July 1, 2019 19:00
@ashwinraghav ashwinraghav changed the title Ashwinraghav.api key.2 Adding an "extras" column to transport databases Jul 1, 2019
@ashwinraghav ashwinraghav force-pushed the ashwinraghav.apiKey.2 branch from 58dee2d to 0b40241 Compare July 1, 2019 19:28
@ashwinraghav ashwinraghav force-pushed the ashwinraghav.apiKey.2 branch from 0b40241 to f20b6a9 Compare July 1, 2019 19:49
@ashwinraghav ashwinraghav force-pushed the ashwinraghav.apiKey.2 branch from 4e0b941 to 7179566 Compare July 3, 2019 01:46
@ashwinraghav
Copy link
Contributor Author

/retest

@ashwinraghav
Copy link
Contributor Author

/retest

db.execSQL(DROP_CONTEXTS_SQL);
// Indices are dropped automatically when the tables are dropped

onCreate(db);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is wrong, and should instead be onUpgrade(0, newVersion), am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Net effect is the same.

@Override
  public void onCreate(SQLiteDatabase db) {
    ensureConfigured(db);
    // schemaVersion here should be the same as the newVersion in onDowngrade.
    upgrade(db, 0, schemaVersion);
  }

@ashwinraghav ashwinraghav merged commit 8962d62 into ashwinraghav.apiKey.1 Jul 12, 2019
ashwinraghav added a commit that referenced this pull request Aug 13, 2019
* Moving schema manager to separate file

Injecting sql queries for better testability

* Extracting index queries

* Removed migrations

* Fix schema manager

* Fixed tests

* Fixed instrumentation tests

* Java format

* Adding an "extras" column to transport databases (#578)

* Legacy Firelog backend impl (#610)

* Added tests for upgrade

* Added tests for nullability

* Modelling creates as migrations

* Review feedback

* Review feedbackwq

* Throwing exception

* added test

* java formatting

* Fixed tests

* Apis to wire in extras (#581)

* Review feedback

* Review feedback

* Apis to wire in extras

* 1

* Flg destination

* Tests

* Fixed test

* Review feedback

* Review feedback

* Added lflg transport

* Review feedback
@rlazo rlazo deleted the ashwinraghav.apiKey.2 branch September 27, 2019 14:54
@firebase firebase locked and limited conversation to collaborators Oct 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants