Closed Bug 939061 Opened 11 years ago Closed 11 years ago

[NetworkStats API] Remove redundant indexes in NetworkStatsDB.jsm

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
1.3 Sprint 5 - 11/22

People

(Reporter: airpingu, Assigned: johnshih.bugs)

References

Details

Attachments

(1 file, 1 obsolete file)

The following are our indexes for DB:

  objectStore.createIndex("appId", "appId", { unique: false }); 
  objectStore.createIndex("network", "network", { unique: false });
  objectStore.createIndex("networkType", "networkType", { unique: false });
  objectStore.createIndex("timestamp", "timestamp", { unique: false });
  objectStore.createIndex("rxBytes", "rxBytes", { unique: false });
  objectStore.createIndex("txBytes", "txBytes", { unique: false });
  objectStore.createIndex("rxTotalBytes", "rxTotalBytes", { unique: false });
  objectStore.createIndex("txTotalBytes", "txTotalBytes", { unique: false });

However, we only used "network" to do searching and the rest is not used. I believe removing the redundant ones can speed up our metering performance because less indexes have to be updated at run-time.
Since I'm working on bug 922926, which is related to this bug (both work on DB part).
I'll take this one.
Assignee: nobody → jshih
Attachment #8335166 - Flags: review?(gene.lian)
Blocks: 922926
Comment on attachment 8335166 [details] [diff] [review]
Bug 939061 - Remove redundant indexes in NetworkStatsDB.jsm. r=gene

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

Looks good to me bug I hope to see Albert's feedback as well before landing. We have to be very careful about the change of updating DB schema.

::: dom/network/src/NetworkStatsDB.jsm
@@ +91,5 @@
>          if (DEBUG) {
>            debug("Created object stores and indexes for version 3");
>          }
> +      } else if (currVersion == 3) {
> +        // Delete redundent indexes.

// Delete redundent indexes (leave "network" only).

@@ +94,5 @@
> +      } else if (currVersion == 3) {
> +        // Delete redundent indexes.
> +        if (!objectStore) {
> +          objectStore = aTransaction.objectStore(STORE_NAME);
> +        }

I'd prefer just doing:

objectStore = aTransaction.objectStore(STORE_NAME);

without checking the previous assignment to make the logic more clear.
Attachment #8335166 - Flags: review?(gene.lian)
Attachment #8335166 - Flags: review+
Attachment #8335166 - Flags: feedback?(acperez)
Comment on attachment 8335166 [details] [diff] [review]
Bug 939061 - Remove redundant indexes in NetworkStatsDB.jsm. r=gene

All tests passed, it's fine. Just needs a rebase.

For me is ok.
Attachment #8335166 - Flags: feedback?(acperez) → feedback+
r=gene
Attachment #8335166 - Attachment is obsolete: true
Attachment #8336588 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/806acbcc5207
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.3 Sprint 5 - 11/22
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: