|
|
Chromium Code Reviews
DescriptionChange scantimestamp to firstseentimestamp.
Garbage collector uses this field to check for expiration, before we name
it scantimestamp and keep updating it, so the record may never be expired.
BUG=682244
Review-Url: https://codereview.chromium.org/2711683003
Cr-Commit-Position: refs/heads/master@{#453979}
Committed: https://chromium.googlesource.com/chromium/src/+/9202c88ac94265dc91315fe2f3b8c1341e9b1e35
Patch Set 1 #Patch Set 2 : fix style #Patch Set 3 : comment #Patch Set 4 : fix test #
Total comments: 2
Patch Set 5 : rename scantimestamp to firstseentimestamp #Patch Set 6 : fix tests #
Total comments: 8
Patch Set 7 : change lastseen to firstseen #
Total comments: 2
Patch Set 8 : fix style #Patch Set 9 : git cl format #
Total comments: 5
Patch Set 10 : add comment #Patch Set 11 : rebase #Patch Set 12 : rebase #Patch Set 13 : fix conflict #Patch Set 14 : upload from new branch #
Messages
Total messages: 79 (59 generated)
Description was changed from ========== fix broken icon BUG=682244 ========== to ========== Do not update scantimestamp. Garbage collector uses this field to check for expiration, so changing this field may cause GC not working. BUG=682244 ==========
Description was changed from ========== Do not update scantimestamp. Garbage collector uses this field to check for expiration, so changing this field may cause GC not working. BUG=682244 ========== to ========== Do not update scantimestamp. Garbage collector uses this field to check for expiration, so changing this field may cause GC not work. BUG=682244 ==========
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== Do not update scantimestamp. Garbage collector uses this field to check for expiration, so changing this field may cause GC not work. BUG=682244 ========== to ========== Do not update scantimestamp. Garbage collector uses this field to check for expiration, so changing this field may cause GC not working. BUG=682244 ==========
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
ranj@chromium.org changed reviewers: + cco3@chromium.org, mattreynolds@chromium.org, mmocny@chromium.org
I think this is not the right approach. I expect we need to keep track of scan updates or things may go wrong in subtle ways. Instead, we should probably attach a timestamp to the resolved values, either in the map or directly in PwsResult class, and then also garbage collect those. https://codereview.chromium.org/2711683003/diff/60001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java (right): https://codereview.chromium.org/2711683003/diff/60001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:441: // currentUrlInfo.setScanTimestamp(urlInfo.getScanTimestamp()); If we don't update this here, won't these results get garbage collected too early?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
In offline discussion, we consider to rename ScanTimestamp to FirstSeenTimestamp so it's consistent with the actual meaning. Seems ScanTimestamp is only used for garbage collection, Could you confirm that so the change won't break anything? Also Conley & Matt WDYT?
On 2017/02/22 20:12:41, Ran wrote: > In offline discussion, we consider to rename ScanTimestamp to FirstSeenTimestamp > so it's consistent with the actual meaning. > > Seems ScanTimestamp is only used for garbage collection, Could you confirm that > so the change won't break anything? > > Also Conley & Matt WDYT? Darn, I just realized a case where this won't work perfect: Once we add re-resolving to WebUI onload. It will mean that the resolved time != firstseentime. I think this is OK for now, since worst case we do an extra resolve every 24 hours, but its another hint that maybe we need a resolved-results-manager of some kind which is distinct from the scanned-results-manager. Since this may all be moving to Native, and/or Nearby, we should stick with the simple fix.
https://codereview.chromium.org/2711683003/diff/60001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java (right): https://codereview.chromium.org/2711683003/diff/60001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:441: // currentUrlInfo.setScanTimestamp(urlInfo.getScanTimestamp()); On 2017/02/22 19:36:52, mmocny wrote: > If we don't update this here, won't these results get garbage collected too > early? Yes, but that's OK. time-based garbage collection had mostly to do with notification frequency (so that after 24 hours, swipes would be reset). In fact, now that we don't have notifications, it might be worth reconsidering why we have a cache for anything other than PwsResults
On 2017/02/22 20:21:48, cco3 wrote: > https://codereview.chromium.org/2711683003/diff/60001/chrome/android/java/src... > File > chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java > (right): > > https://codereview.chromium.org/2711683003/diff/60001/chrome/android/java/src... > chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:441: > // currentUrlInfo.setScanTimestamp(urlInfo.getScanTimestamp()); > On 2017/02/22 19:36:52, mmocny wrote: > > If we don't update this here, won't these results get garbage collected too > > early? > > Yes, but that's OK. time-based garbage collection had mostly to do with > notification frequency (so that after 24 hours, swipes would be reset). In > fact, now that we don't have notifications, it might be worth reconsidering why > we have a cache for anything other than PwsResults That would simplify things a lot, and also remove the need for duplicate data structures.
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_clang_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_clan...)
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Description was changed from ========== Do not update scantimestamp. Garbage collector uses this field to check for expiration, so changing this field may cause GC not working. BUG=682244 ========== to ========== Change scantimestamp to firstseentimestamp. Garbage collector uses this field to check for expiration, before we name is scantimestamp and keep updating it, so the record may never be expired. BUG=682244 ==========
Description was changed from ========== Change scantimestamp to firstseentimestamp. Garbage collector uses this field to check for expiration, before we name is scantimestamp and keep updating it, so the record may never be expired. BUG=682244 ========== to ========== Change scantimestamp to firstseentimestamp. Garbage collector uses this field to check for expiration, before we name it scantimestamp and keep updating it, so the record may never be expired. BUG=682244 ==========
Description was changed from ========== Change scantimestamp to firstseentimestamp. Garbage collector uses this field to check for expiration, before we name it scantimestamp and keep updating it, so the record may never be expired. BUG=682244 ========== to ========== Change scantimestamp to firstseentimestamp. Garbage collector uses this field to check for expiration, before we name it scantimestamp and keep updating it, so the record may never be expired. BUG=682244 ==========
I think firstseentimestamp might just be confusing. I'd be fine repurposing this CL to just blow away the whole cache. Not sure if you want to do that or just want to get something in.
On 2017/02/22 23:18:45, cco3 wrote: > I think firstseentimestamp might just be confusing. I'd be fine repurposing > this CL to just blow away the whole cache. Not sure if you want to do that or > just want to get something in. Of course, if you were to do that, you'd have to start keeping track of when PwsResults had last been fetched (which we probably should be doing anyway, but may take some work). Anyway, this lgtm, and we can do something better later.
https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java (right): https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java:18: private static final String LASTSEEN_TIMESTAMP_KEY = "lastseen_timestamp"; Shouldn't this be first seen, not last seen? (according to the commit message) Also, could you rename this to put a space before "seen", for instance: private static final String FIRST_SEEN_TIMESTAMP_KEY = "first_seen_timestamp"; https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java:72: public UrlInfo setLastSeenTimestamp(long lastSeenTimestamp) { If we don't need to update the timestamp anymore, let's remove this setter and make the field final. https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java:80: * @return The lastseen timestamp. "The lastseen timestamp" is awkward. I think the javadoc already does a good job of explaining what is returned, so you could change this to "The timestamp." or remove the @return line altogether. https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java (right): https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:426: * When we reencounter a URL, a subset of its metadata should update. Only distance fall How about: "When we reencounter a URL, only its distance should update."
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java (right): https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java:18: private static final String LASTSEEN_TIMESTAMP_KEY = "lastseen_timestamp"; On 2017/02/22 23:33:42, mattreynolds wrote: > Shouldn't this be first seen, not last seen? (according to the commit message) > > Also, could you rename this to put a space before "seen", for instance: > > private static final String FIRST_SEEN_TIMESTAMP_KEY = "first_seen_timestamp"; Done. https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java:72: public UrlInfo setLastSeenTimestamp(long lastSeenTimestamp) { On 2017/02/22 23:33:42, mattreynolds wrote: > If we don't need to update the timestamp anymore, let's remove this setter and > make the field final. Done. https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java:80: * @return The lastseen timestamp. On 2017/02/22 23:33:42, mattreynolds wrote: > "The lastseen timestamp" is awkward. I think the javadoc already does a good job > of explaining what is returned, so you could change this to "The timestamp." or > remove the @return line altogether. Done. https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java (right): https://codereview.chromium.org/2711683003/diff/100001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:426: * When we reencounter a URL, a subset of its metadata should update. Only distance fall On 2017/02/22 23:33:42, mattreynolds wrote: > How about: "When we reencounter a URL, only its distance should update." Done.
lgtm (with nit) https://codereview.chromium.org/2711683003/diff/120001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java (right): https://codereview.chromium.org/2711683003/diff/120001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java:23: private final long mFirstSeenTimestamp; nit: move mFirstSeenTimestamp to below mUrl to keep the private final fields together
https://codereview.chromium.org/2711683003/diff/120001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java (right): https://codereview.chromium.org/2711683003/diff/120001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java:23: private final long mFirstSeenTimestamp; On 2017/02/23 19:49:14, mattreynolds wrote: > nit: move mFirstSeenTimestamp to below mUrl to keep the private final fields > together Done.
lgtm LGTM Look forward to being able to clean this up even further, possibly removing need for garbage collection and timestamp map altogether.
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by ranj@chromium.org
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
ranj@chromium.org changed reviewers: + nyquist@chromium.org
+nyquist
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2711683003/diff/160001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java (right): https://codereview.chromium.org/2711683003/diff/160001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java:68: * Gets the timestamp of when the URL was first scanned. Should this use @return somewhere? I mean, your comment is helpful as is, but it ends up missing the @return statement. https://codereview.chromium.org/2711683003/diff/160001/chrome/android/javates... File chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java (left): https://codereview.chromium.org/2711683003/diff/160001/chrome/android/javates... chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java:199: assertEquals(urlInfo.getScanTimestamp(), urls.get(0).getScanTimestamp()); What is the reasoning behind removing this? Isn't it helpful that this is also cached and correct? I realize that you shouldn't change it in the prod code after this change, but isn't it nice to ensure that with a test?
Oh, and other than those comments which I leave up to you to resolve or not, this lgtm.
https://codereview.chromium.org/2711683003/diff/160001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java (right): https://codereview.chromium.org/2711683003/diff/160001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlInfo.java:68: * Gets the timestamp of when the URL was first scanned. On 2017/02/28 07:10:36, nyquist wrote: > Should this use @return somewhere? I mean, your comment is helpful as is, but it > ends up missing the @return statement. Done. https://codereview.chromium.org/2711683003/diff/160001/chrome/android/javates... File chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java (left): https://codereview.chromium.org/2711683003/diff/160001/chrome/android/javates... chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java:199: assertEquals(urlInfo.getScanTimestamp(), urls.get(0).getScanTimestamp()); On 2017/02/28 07:10:36, nyquist wrote: > What is the reasoning behind removing this? Isn't it helpful that this is also > cached and correct? I realize that you shouldn't change it in the prod code > after this change, but isn't it nice to ensure that with a test? We changed scantimestamp to firstseentimestamp. scantimestamp gets changed every time we do a scan, while firstseentimestamp only be assigned when we first seen it. So this assert is no longer applied.
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2711683003/diff/160001/chrome/android/javates... File chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java (left): https://codereview.chromium.org/2711683003/diff/160001/chrome/android/javates... chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java:199: assertEquals(urlInfo.getScanTimestamp(), urls.get(0).getScanTimestamp()); On 2017/02/28 18:53:57, Ran wrote: > On 2017/02/28 07:10:36, nyquist wrote: > > What is the reasoning behind removing this? Isn't it helpful that this is also > > cached and correct? I realize that you shouldn't change it in the prod code > > after this change, but isn't it nice to ensure that with a test? > > We changed scantimestamp to firstseentimestamp. scantimestamp gets changed every > time we do a scan, while firstseentimestamp only be assigned when we first seen > it. > So this assert is no longer applied. Right. It's just that now the test code assumes that, and if someone makes the field non-final and changes it, we don't have a test that catches it. Anyway, fine with me to keep as is of course.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds...) ios-device-xcode-clang on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device-xcode-...) ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...) ios-simulator-xcode-clang on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator-xco...)
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by ranj@chromium.org
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-device-xcode-clang on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device-xcode-...) ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-...) chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presub...) linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds...) ios-device-xcode-clang on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device-xcode-...) mac_chromium_compile_dbg_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_comp...) mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by ranj@chromium.org
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...) ios-simulator-xcode-clang on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator-xco...)
The CQ bit was checked by ranj@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by ranj@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from cco3@chromium.org, mattreynolds@chromium.org, nyquist@chromium.org, mmocny@chromium.org Link to the patchset: https://codereview.chromium.org/2711683003/#ps260001 (title: "upload from new branch")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch.
Bot data: {"patchset_id": 260001, "attempt_start_ts": 1488393224657470,
"parent_rev": "c55c4ef894a6871a79f318c43f211f0e81105a76", "commit_rev":
"9202c88ac94265dc91315fe2f3b8c1341e9b1e35"}
Message was sent while issue was closed.
Description was changed from ========== Change scantimestamp to firstseentimestamp. Garbage collector uses this field to check for expiration, before we name it scantimestamp and keep updating it, so the record may never be expired. BUG=682244 ========== to ========== Change scantimestamp to firstseentimestamp. Garbage collector uses this field to check for expiration, before we name it scantimestamp and keep updating it, so the record may never be expired. BUG=682244 Review-Url: https://codereview.chromium.org/2711683003 Cr-Commit-Position: refs/heads/master@{#453979} Committed: https://chromium.googlesource.com/chromium/src/+/9202c88ac94265dc91315fe2f3b8... ==========
Message was sent while issue was closed.
Committed patchset #14 (id:260001) as https://chromium.googlesource.com/chromium/src/+/9202c88ac94265dc91315fe2f3b8... |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
