Remove changes remaining counter from about:sync

The label "changes remaining" is not quite correct.  It's actually set
to either zero or one, depending on whether or not the current sync
cycle should result in more downloads.

If there is an issue with infinite download looping, we should be able
to detect and debug it based on the protocol logs, among other things.
The protocol logs indicate when a GetUpdates response had a non-zero
"changes remaining" value.

BUG=349301

Review URL: https://codereview.chromium.org/256413007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266594 0039d316-1c4b-4281-b951-d872f2087c98
parent f26417d9
......@@ -298,7 +298,6 @@ scoped_ptr<base::DictionaryValue> ConstructAboutInformation(
IntSyncStat hierarchy_conflicts(section_this_cycle, "Hierarchy Conflicts");
IntSyncStat server_conflicts(section_this_cycle, "Server Conflicts");
IntSyncStat committed_items(section_this_cycle, "Committed Items");
IntSyncStat updates_remaining(section_this_cycle, "Updates Remaining");
base::ListValue* section_that_cycle = AddSection(
stats_list, "Transient Counters (last cycle of last completed session)");
......@@ -427,7 +426,6 @@ scoped_ptr<base::DictionaryValue> ConstructAboutInformation(
hierarchy_conflicts.SetValue(full_status.hierarchy_conflicts);
server_conflicts.SetValue(full_status.server_conflicts);
committed_items.SetValue(full_status.committed_count);
updates_remaining.SetValue(full_status.updates_available);
}
if (is_status_valid) {
......
......@@ -32,7 +32,6 @@ SyncStatus AllStatus::CreateBlankStatus() const {
status.hierarchy_conflicts = 0;
status.server_conflicts = 0;
status.committed_count = 0;
status.updates_available = 0;
return status;
}
......@@ -51,8 +50,6 @@ SyncStatus AllStatus::CalcSyncing(const SyncCycleEvent &event) const {
status.syncing = false;
}
status.updates_available += snapshot.num_server_changes_remaining();
status.num_entries_by_type = snapshot.num_entries_by_type();
status.num_to_delete_entries_by_type =
snapshot.num_to_delete_entries_by_type();
......
......@@ -241,11 +241,10 @@ SyncerError GetUpdatesProcessor::ExecuteDownloadUpdates(
return result;
}
DVLOG(1) << "GetUpdates "
<< " returned " << update_response.get_updates().entries_size()
<< " updates and indicated "
<< update_response.get_updates().changes_remaining()
<< " updates left on server.";
DVLOG(1) << "GetUpdates returned "
<< update_response.get_updates().entries_size()
<< " updates.";
if (session->context()->debug_info_getter()) {
// Clear debug info now that we have successfully sent it to the server.
......@@ -268,6 +267,8 @@ SyncerError GetUpdatesProcessor::ExecuteDownloadUpdates(
base::Time::Now(), update_response, process_result);
session->SendProtocolEvent(response_event);
DVLOG(1) << "GetUpdates result: " << process_result;
return process_result;
}
......@@ -282,7 +283,6 @@ SyncerError GetUpdatesProcessor::ProcessResponse(
if (!gu_response.has_changes_remaining()) {
return SERVER_RESPONSE_VALIDATION_FAILED;
}
status->set_num_server_changes_remaining(gu_response.changes_remaining());
syncer::SyncerError result =
ProcessGetUpdatesResponse(request_types, gu_response, status);
......
......@@ -14,7 +14,6 @@ SyncStatus::SyncStatus()
server_conflicts(0),
committed_count(0),
syncing(false),
updates_available(0),
updates_received(0),
reflected_updates_received(0),
tombstone_updates_received(0),
......
......@@ -49,8 +49,6 @@ struct SYNC_EXPORT SyncStatus {
bool syncing;
// Total updates available. If zero, nothing left to download.
int64 updates_available;
// Total updates received by the syncer since browser start.
int updates_received;
// Total updates received that are echoes of our own changes.
......
......@@ -22,8 +22,7 @@ ModelNeutralState::ModelNeutralState()
last_get_key_result(UNSET),
last_download_updates_result(UNSET),
commit_result(UNSET),
items_committed(false),
num_server_changes_remaining(0) {
items_committed(false) {
}
ModelNeutralState::~ModelNeutralState() {}
......
......@@ -53,11 +53,6 @@ struct SYNC_EXPORT ModelNeutralState {
// Set to true by PostCommitMessageCommand if any commits were successful.
bool items_committed;
// Number of changes remaining, according to the server.
// Take it as an estimate unless it's value is zero, in which case there
// really is nothing more to download.
int64 num_server_changes_remaining;
};
bool HasSyncerError(const ModelNeutralState& state);
......
......@@ -70,9 +70,6 @@ base::DictionaryValue* SyncSessionSnapshot::ToValue() const {
model_neutral_state_.num_local_overwrites);
value->SetInteger("numServerOverwrites",
model_neutral_state_.num_server_overwrites);
value->SetInteger(
"numServerChangesRemaining",
static_cast<int>(model_neutral_state_.num_server_changes_remaining));
value->Set("downloadProgressMarkers",
ProgressMarkerMapToValue(download_progress_markers_).release());
value->SetBoolean("isSilenced", is_silenced_);
......@@ -112,10 +109,6 @@ std::string SyncSessionSnapshot::ToString() const {
return json;
}
int64 SyncSessionSnapshot::num_server_changes_remaining() const {
return model_neutral_state().num_server_changes_remaining;
}
const ProgressMarkerMap&
SyncSessionSnapshot::download_progress_markers() const {
return download_progress_markers_;
......
......@@ -52,7 +52,6 @@ class SYNC_EXPORT SyncSessionSnapshot {
ModelNeutralState model_neutral_state() const {
return model_neutral_state_;
}
int64 num_server_changes_remaining() const;
const ProgressMarkerMap& download_progress_markers() const;
bool is_silenced() const;
int num_encryption_conflicts() const;
......
......@@ -23,7 +23,6 @@ class SyncSessionSnapshotTest : public testing::Test {};
TEST_F(SyncSessionSnapshotTest, SyncSessionSnapshotToValue) {
ModelNeutralState model_neutral;
model_neutral.num_server_changes_remaining = 105;
model_neutral.num_successful_commits = 5;
model_neutral.num_successful_bookmark_commits = 10;
model_neutral.num_updates_downloaded_total = 100;
......@@ -56,7 +55,7 @@ TEST_F(SyncSessionSnapshotTest, SyncSessionSnapshotToValue) {
std::vector<int>(MODEL_TYPE_COUNT, 0),
sync_pb::GetUpdatesCallerInfo::UNKNOWN);
scoped_ptr<base::DictionaryValue> value(snapshot.ToValue());
EXPECT_EQ(17u, value->size());
EXPECT_EQ(16u, value->size());
ExpectDictIntegerValue(model_neutral.num_successful_commits,
*value, "numSuccessfulCommits");
ExpectDictIntegerValue(model_neutral.num_successful_bookmark_commits,
......@@ -71,8 +70,6 @@ TEST_F(SyncSessionSnapshotTest, SyncSessionSnapshotToValue) {
*value, "numLocalOverwrites");
ExpectDictIntegerValue(model_neutral.num_server_overwrites,
*value, "numServerOverwrites");
ExpectDictIntegerValue(model_neutral.num_server_changes_remaining,
*value, "numServerChangesRemaining");
ExpectDictDictionaryValue(*expected_download_progress_markers_value,
*value, "downloadProgressMarkers");
ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced");
......
......@@ -32,11 +32,6 @@ void StatusController::increment_num_reflected_updates_downloaded_by(
model_neutral_.num_reflected_updates_downloaded_total += value;
}
void StatusController::set_num_server_changes_remaining(
int64 changes_remaining) {
model_neutral_.num_server_changes_remaining = changes_remaining;
}
void StatusController::UpdateStartTime() {
sync_start_time_ = base::Time::Now();
}
......
......@@ -43,11 +43,6 @@ class SYNC_EXPORT_PRIVATE StatusController {
model_neutral_.commit_request_types = value;
}
// Changelog related state.
int64 num_server_changes_remaining() const {
return model_neutral_.num_server_changes_remaining;
}
// Various conflict counters.
int num_encryption_conflicts() const;
int num_hierarchy_conflicts() const;
......@@ -73,7 +68,6 @@ class SYNC_EXPORT_PRIVATE StatusController {
SyncerError last_get_key_result() const;
// Download counters.
void set_num_server_changes_remaining(int64 changes_remaining);
void increment_num_updates_downloaded_by(int value);
void increment_num_tombstone_updates_downloaded_by(int value);
void increment_num_reflected_updates_downloaded_by(int value);
......
......@@ -16,8 +16,6 @@ class StatusControllerTest : public testing::Test { };
// method was actually setting |bar_| instead!).
TEST_F(StatusControllerTest, ReadYourWrites) {
StatusController status;
status.set_num_server_changes_remaining(13);
EXPECT_EQ(13, status.num_server_changes_remaining());
status.set_last_download_updates_result(SYNCER_OK);
EXPECT_EQ(SYNCER_OK,
......
......@@ -22,7 +22,6 @@ void SimulateConfigureSuccess(
ModelTypeSet requsted_types,
sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
sessions::SyncSession* session) {
ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining());
session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
session->mutable_status_controller()->set_last_download_updates_result(
SYNCER_OK);
......@@ -49,7 +48,6 @@ void SimulateConfigureConnectionFailure(
void SimulateNormalSuccess(ModelTypeSet requested_types,
const sessions::NudgeTracker& nudge_tracker,
sessions::SyncSession* session) {
ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining());
session->mutable_status_controller()->set_commit_result(SYNCER_OK);
session->mutable_status_controller()->set_last_download_updates_result(
SYNCER_OK);
......@@ -83,14 +81,12 @@ void SimulateConnectionFailure(
void SimulatePollSuccess(ModelTypeSet requested_types,
sessions::SyncSession* session) {
ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining());
session->mutable_status_controller()->set_last_download_updates_result(
SYNCER_OK);
}
void SimulatePollFailed(ModelTypeSet requested_types,
sessions::SyncSession* session) {
ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining());
session->mutable_status_controller()->set_last_download_updates_result(
SERVER_RETURN_TRANSIENT_ERROR);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment