Closed Bug 814163 Opened 12 years ago Closed 12 years ago

Migrate existing data to most-recent table, ensure most-recent items have id

Categories

(Core :: DOM: Device Interfaces, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20
blocking-basecamp -
Tracking Status
firefox18 --- fixed
firefox19 --- fixed
firefox20 --- fixed

People

(Reporter: daleharvey, Assigned: daleharvey)

Details

Attachments

(1 file, 2 obsolete files)

Previous update to the SmsDatabaseService didnt migrate existing data, it also wrote new threads entries without an id
blocking-basecamp: --- → ?
Attachment #684164 - Flags: review?(anygregor)
Assignee: nobody → dale
Comment on attachment 684164 [details] [diff] [review]
Populate most-recent table with existing sms data

I don't think you can rely on highest message id means youngest message for a thread. You still need to compare the timestamp. I forward to bent since he wrote the mostRecentEntry code.
Attachment #684164 - Flags: review?(anygregor) → review?(bent.mozilla)
Comment on attachment 684164 [details] [diff] [review]
Populate most-recent table with existing sms data

Review of attachment 684164 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/sms/src/ril/SmsDatabaseService.js
@@ +335,5 @@
> +      let contact = message.sender || message.receiver;
> +
> +      if (contact in threads) {
> +        let thread = threads[contact];
> +        threads[contact].id = message.id;

Wait, this cursor goes backwards, so the message you're overwriting probably has a newer timestamp, right?

@@ +476,5 @@
>          } else {
>            event.target.source.add({ senderOrReceiver: number,
>                                      timestamp: message.timestamp,
>                                      body: message.body,
> +                                    id: meesage.id,

Typo here ("meesage").
You are right, I think gwagner was right the first time and I would be best just comparing timestamps and not care about what order I traverse, will update tomorrow
I think this won't affect devices that are not already active (ie production devices)

Please re-nom if we have that wrong.
blocking-basecamp: ? → -
Updated based on review.

In theory this can affect anyone that is currently dogfooding, which would be a blocking+, I dont know enough about the sms app / api usage / deployed versions to know whether dogfooders will actually be affected by it. I am not.
Attachment #684164 - Attachment is obsolete: true
Attachment #684164 - Flags: review?(bent.mozilla)
Attachment #685137 - Flags: review?(bent.mozilla)
Comment on attachment 685137 [details] [diff] [review]
Populate most-recent table with existing sms data

Review of attachment 685137 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with this one small change.

::: dom/sms/src/ril/SmsDatabaseService.js
@@ +316,5 @@
>                                         { keyPath: "senderOrReceiver" });
>      objectStore.createIndex("timestamp", "timestamp");
>    },
>  
> +  upgradeSchema4: function upgradeSchema4(db, transaction) {

Nit: No need for this to take 'db' argument, you never use it and we don't really have much of a pattern to follow.
Attachment #685137 - Flags: review?(bent.mozilla) → review+
Dale, let's get this in so that Borja can land his SMS changes.
Nit addressed.
Attachment #685137 - Attachment is obsolete: true
Attachment #686476 - Flags: checkin?(bent.mozilla)
Comment on attachment 686476 [details] [diff] [review]
Bug 814163 - Populate most-recent table with existing sms data

[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 809661
User impact if declined: Dogfood devices will soon display an empty thread list in the SMS app.
Testing completed (on m-c, etc.): Dogfood
Risk to taking this patch (and alternatives if risky): Must be done if users have existing data
String or UUID changes made by this patch: None
Attachment #686476 - Flags: approval-mozilla-beta?
Attachment #686476 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/40d061793988
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Comment on attachment 686476 [details] [diff] [review]
Bug 814163 - Populate most-recent table with existing sms data

In support of existing pre-release testers. Thanks for taking the time to fix Dale/all. If this causes new regressions for whatever reason, we'll cut/run and move on to other b-b+ bugs instead (we'll eat the data loss).
Attachment #686476 - Flags: approval-mozilla-beta?
Attachment #686476 - Flags: approval-mozilla-beta+
Attachment #686476 - Flags: approval-mozilla-aurora?
Attachment #686476 - Flags: approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: