VERY EXPERIMENTAL: refactoring storage of pause and resume#553
Conversation
0b59ea9 to
dea0185
Compare
aeb5bd1 to
bdf9c3d
Compare
|
@rgmf @pstorch If you have some time (and data to lose), here is a first version to change the internal storage of TrackPoints, so that we can restore the TrackStatistics completely (export/import). PS: Downgrading from DB version 30 to version 29 does not restore deleted RESUME trackpoints. Anyhow: 🤞, but keep a 🧯 handy 😎 |
|
@pstorch Thx; one of those face palm moments ;) |
| db.execSQL("ALTER TABLE trackpoints ADD COLUMN type TEXT CHECK(type IN (-2, -1, 0, 1))"); | ||
| db.execSQL("UPDATE trackpoints SET type = -2, latitude = NULL, longitude = NULL WHERE latitude = 200.0"); | ||
| db.execSQL("UPDATE trackpoints SET type = 1, latitude = NULL, longitude = NULL WHERE latitude = 100.0"); | ||
| db.execSQL("UPDATE trackpoints SET type = -2, latitude = NULL, longitude = NULL WHERE latitude = 200"); |
There was a problem hiding this comment.
That's not gonna work either. It should be 200 * 1E6 😉
I still don't get that "Downgrading". In which situation does this work? When I install the version from main branch (DB version 29), then the downgrade code from 30 to 29 is missing and the App is crashing. When I install the version from this branch it knows DB version 30 and doesn't downgrade either. |
9425684 to
9402de1
Compare
|
@pstorch Valid point, for a downgrade we would need to release a new version with version=29 that has the downgrade code for version 30. Then we could allow a real downgrade for a latter version. |
9402de1 to
6e71934
Compare
|
The db migration to version 30 works now. I did some tests with my 318 tracks in my OpenTracks (debug). Before I started:
Then I stumbled upon the migration bug, so I started over with the old version reimporting the 318 tracks in a clean db. Interestingly it was a bit different now:
So I guess this export/reimport "cleaned" something up. I installed the pauseResume branch and let the database migrate. After that I got the same overall statistics: and the trackpoints looked good:
I exported the 318 track after the migration. Then I cleaned up the data and started over with importing the 318 files before the migration: Now I got:
🤔 what happened here? The last test was reimporting the migrated files back to a clean database. Looks like something bad happening here:
The pause/resume trackpoints match the initial values, but why are so many regular trackpoints lost? |
|
I've started a similar branch on the OSMDashboard https://github.com/OpenTracksApp/OSMDashboard/tree/pauseResume to read this new column. Unfortunately the ContentProvider PROJECTION isn't backward compatible with older OT versions. As soon as I add the new We could add a |
|
@pstorch Thanks for the test. About OSMDashboard integration: do you need to send a projection (i.e., non null)? |
No, it's not needed. It works with null. The only drawback is that then all columns are transferred, more than needed. Don't know if this has a performance/memory impact. |
|
@pstorch Adding a version as extra sounds good! About the data import->export->import: |
|
Very strange: I tried to reproduce the last testcase (reimporting the migrated and exported tracks). Now it worked and the aggregated stats and the db trackpoints had the correct values. Sorry for the confusion. |
|
I get this error in 40 of my 161 tracks. I've not checked all the 40 files but the error is triggered in the files where there is a pause/restart: Here is the line when the error is triggered (with the context): To reproduce:
Also, when you are recording then the intervals doesn't work. Maybe it needs to be refactored because intervals uses TrackPoints directly. |
|
@pstorch If you can reproduce it again (or some other weird behavior), let me know. @rgmf Those trackpoints should not actually not have been exported - they should have become segment open/close. We can now either ignore these - or try to restore the segment. But those trackpoints have device time while the rest has GPS time. |
I see. I guess it's not that important for now but I'd try to restore segments altough stats are not the same: better that than end up with errors. I'll test import/export from this branch then ;) |
6e71934 to
6d705f4
Compare
So, far specific latitude for segment start/end (i.e., PAUSE/RESUME) was used. #316.
Existing data is not migrated. #316.
KML exports sensor data if actually present. #316.
…trackpoints were exported.
Location values are stored directly.
ExportImportTest were not checking TrackStatistics correctly. #316.
c8b1027 to
c45f867
Compare
- read protocol version and choose right projection OpenTracksApp/OpenTracks#553
|
I missed to include the elevation_loss column in the db upgrade/downgrade for version 29/30. |
|
I fixed this and:
|







For be able to recreate the TrackStatistics (export/import), we need to store some additional TrackPoints (aka track started, track ended) and these need to use the same base for timestamps (here device time; NOT GPS-provided time).
pause/stopCleanup:
gpsStatus.onLocationChanged(trackPoint);is called for each TrackPointUpgrade strategy:
Add in release notes: