Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 48753f9ec399cd4e48c5655a67358b940140aaca
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Thu Mar 14 12:35:51 2019
Refactor shadows tables mapping in the InvalidationTracker.
This changes the approach from swapping table name at trigger creation
to re-mapping tables whose shadow table is another mapped table during
initialization.
For example, given the following tables:
[table_1, table_2, fts_table_1, fts_table_2]
and the following shadow table mapping:
[fts_table_1 -> fts_table_1_content, fts_table_2 -> table_2]
Then the tracker configuration will be:
mTableNames = [table_1, table_2, fts_table_1_content, table_2]
mTableLookupId = [
table_1 -> 0,
table_2 -> 1,
fts_table_1 -> 2,
fts_table_2 -> 1
]
Thus when adding an observer for a table named "fts_table_2" we
actually end up adding an observer to table id '1' which is table_2,
the correct shadow table.
This change prevents multiple triggers being added to the same table and
also fixes removing triggers for tables still being observed, which can
occur when observing a normal table (A) and an FTS table in external
content mode (B) that is using the normal table (A) as its shadow table.
Bug: 128508917
Test: LiveDataQueryTest & InvalidationTrackerTest
Change-Id: Ida78880c54ad8020cc1eb3a0131f8e4ac41028d0
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/dao/SongDao.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/LiveDataQueryTest.java
M room/runtime/src/main/java/androidx/room/InvalidationTracker.java
M room/runtime/src/test/java/androidx/room/InvalidationTrackerTest.java
https://android-review.googlesource.com/928714
https://goto.google.com/android-sha1/48753f9ec399cd4e48c5655a67358b940140aaca
Branch: androidx-master-dev
commit 48753f9ec399cd4e48c5655a67358b940140aaca
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Thu Mar 14 12:35:51 2019
Refactor shadows tables mapping in the InvalidationTracker.
This changes the approach from swapping table name at trigger creation
to re-mapping tables whose shadow table is another mapped table during
initialization.
For example, given the following tables:
[table_1, table_2, fts_table_1, fts_table_2]
and the following shadow table mapping:
[fts_table_1 -> fts_table_1_content, fts_table_2 -> table_2]
Then the tracker configuration will be:
mTableNames = [table_1, table_2, fts_table_1_content, table_2]
mTableLookupId = [
table_1 -> 0,
table_2 -> 1,
fts_table_1 -> 2,
fts_table_2 -> 1
]
Thus when adding an observer for a table named "fts_table_2" we
actually end up adding an observer to table id '1' which is table_2,
the correct shadow table.
This change prevents multiple triggers being added to the same table and
also fixes removing triggers for tables still being observed, which can
occur when observing a normal table (A) and an FTS table in external
content mode (B) that is using the normal table (A) as its shadow table.
Bug: 128508917
Test: LiveDataQueryTest & InvalidationTrackerTest
Change-Id: Ida78880c54ad8020cc1eb3a0131f8e4ac41028d0
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/dao/SongDao.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/LiveDataQueryTest.java
M room/runtime/src/main/java/androidx/room/InvalidationTracker.java
M room/runtime/src/test/java/androidx/room/InvalidationTrackerTest.java
da...@google.com <da...@google.com> #3
A fix for this will be available in Room 2.1.0-alpha06
Description
Version used: 2.1.0-alpha04
The stopTrackingTable function uses this look up to get to the table name (since 2.1.0):
final String tableName = mShadowTableLookup.get(tableId, mTableNames[tableId])
For FTS tables that lookup will return the name of the table that it is tracking, therefore dropping the triggers for the tracking table. When this happens no other observers / LiveData active on the table that the FTS table is tracking will receive any updates.