Migration from QUIC_BUG to QUIC_BUG_V2(bug_id).

Per go/gfe-bug-improvements GFE_BUGs are getting stable IDs to allow for monitoring and alerting. Existing QUIC_BUG instances are changed to have `quic_bug_n_m` ID, where `n` is unique for each file, and `m` is a counter within each file, so we get `QUIC_BUG_V2(quic_bug_123_2)`

PiperOrigin-RevId: 361614272
Change-Id: Ie33b834d401ab0252725b3c44434ef4a1eb5fcd7
diff --git a/quic/core/congestion_control/bandwidth_sampler.cc b/quic/core/congestion_control/bandwidth_sampler.cc
index babb6e3..bb1f03d 100644
--- a/quic/core/congestion_control/bandwidth_sampler.cc
+++ b/quic/core/congestion_control/bandwidth_sampler.cc
@@ -171,42 +171,43 @@
     if (unacked_packet_map_ != nullptr && !unacked_packet_map_->empty()) {
       QuicPacketNumber maybe_least_unacked =
           unacked_packet_map_->GetLeastUnacked();
-      QUIC_BUG << "BandwidthSampler in-flight packet map has exceeded maximum "
-                  "number of tracked packets("
-               << max_tracked_packets_
-               << ").  First tracked: " << connection_state_map_.first_packet()
-               << "; last tracked: " << connection_state_map_.last_packet()
-               << "; entry_slots_used: "
-               << connection_state_map_.entry_slots_used()
-               << "; number_of_present_entries: "
-               << connection_state_map_.number_of_present_entries()
-               << "; packet number: " << packet_number
-               << "; unacked_map: " << unacked_packet_map_->DebugString()
-               << "; total_bytes_sent: " << total_bytes_sent_
-               << "; total_bytes_acked: " << total_bytes_acked_
-               << "; total_bytes_lost: " << total_bytes_lost_
-               << "; total_bytes_neutered: " << total_bytes_neutered_
-               << "; last_acked_packet_sent_time: "
-               << last_acked_packet_sent_time_
-               << "; total_bytes_sent_at_last_acked_packet: "
-               << total_bytes_sent_at_last_acked_packet_
-               << "; least_unacked_packet_info: "
-               << (unacked_packet_map_->IsUnacked(maybe_least_unacked)
-                       ? unacked_packet_map_
-                             ->GetTransmissionInfo(maybe_least_unacked)
-                             .DebugString()
-                       : "n/a");
+      QUIC_BUG_V2(quic_bug_10437_1)
+          << "BandwidthSampler in-flight packet map has exceeded maximum "
+             "number of tracked packets("
+          << max_tracked_packets_
+          << ").  First tracked: " << connection_state_map_.first_packet()
+          << "; last tracked: " << connection_state_map_.last_packet()
+          << "; entry_slots_used: " << connection_state_map_.entry_slots_used()
+          << "; number_of_present_entries: "
+          << connection_state_map_.number_of_present_entries()
+          << "; packet number: " << packet_number
+          << "; unacked_map: " << unacked_packet_map_->DebugString()
+          << "; total_bytes_sent: " << total_bytes_sent_
+          << "; total_bytes_acked: " << total_bytes_acked_
+          << "; total_bytes_lost: " << total_bytes_lost_
+          << "; total_bytes_neutered: " << total_bytes_neutered_
+          << "; last_acked_packet_sent_time: " << last_acked_packet_sent_time_
+          << "; total_bytes_sent_at_last_acked_packet: "
+          << total_bytes_sent_at_last_acked_packet_
+          << "; least_unacked_packet_info: "
+          << (unacked_packet_map_->IsUnacked(maybe_least_unacked)
+                  ? unacked_packet_map_
+                        ->GetTransmissionInfo(maybe_least_unacked)
+                        .DebugString()
+                  : "n/a");
     } else {
-      QUIC_BUG << "BandwidthSampler in-flight packet map has exceeded maximum "
-                  "number of tracked packets.";
+      QUIC_BUG_V2(quic_bug_10437_2)
+          << "BandwidthSampler in-flight packet map has exceeded maximum "
+             "number of tracked packets.";
     }
   }
 
   bool success = connection_state_map_.Emplace(packet_number, sent_time, bytes,
                                                bytes_in_flight + bytes, *this);
-  QUIC_BUG_IF(!success) << "BandwidthSampler failed to insert the packet "
-                           "into the map, most likely because it's already "
-                           "in it.";
+  QUIC_BUG_IF_V2(quic_bug_10437_3, !success)
+      << "BandwidthSampler failed to insert the packet "
+         "into the map, most likely because it's already "
+         "in it.";
 }
 
 void BandwidthSampler::OnPacketNeutered(QuicPacketNumber packet_number) {
@@ -355,7 +356,8 @@
   // current packet was sent. In that case, there is no bandwidth sample to
   // make.
   if (sent_packet.last_acked_packet_sent_time == QuicTime::Zero()) {
-    QUIC_BUG << "sent_packet.last_acked_packet_sent_time is zero";
+    QUIC_BUG_V2(quic_bug_10437_4)
+        << "sent_packet.last_acked_packet_sent_time is zero";
     return BandwidthSample();
   }
 
@@ -427,8 +429,8 @@
 bool BandwidthSampler::ChooseA0Point(QuicByteCount total_bytes_acked,
                                      AckPoint* a0) {
   if (a0_candidates_.empty()) {
-    QUIC_BUG << "No A0 point candicates. total_bytes_acked:"
-             << total_bytes_acked;
+    QUIC_BUG_V2(quic_bug_10437_5)
+        << "No A0 point candicates. total_bytes_acked:" << total_bytes_acked;
     return false;
   }
 
diff --git a/quic/core/congestion_control/bbr2_misc.cc b/quic/core/congestion_control/bbr2_misc.cc
index dfb834c..d7e386e 100644
--- a/quic/core/congestion_control/bbr2_misc.cc
+++ b/quic/core/congestion_control/bbr2_misc.cc
@@ -227,7 +227,7 @@
              static_cast<double>(congestion_event.prior_cwnd));
         break;
       case Bbr2Params::DEFAULT:
-        QUIC_BUG << "Unreachable case DEFAULT.";
+        QUIC_BUG_V2(quic_bug_10466_1) << "Unreachable case DEFAULT.";
     }
     if (pacing_gain_ > Params().startup_full_bw_threshold) {
       // In STARTUP, pacing_gain_ is applied to bandwidth_lo_, so this backs
diff --git a/quic/core/congestion_control/bbr2_probe_bw.cc b/quic/core/congestion_control/bbr2_probe_bw.cc
index 78bd06d..95520bc 100644
--- a/quic/core/congestion_control/bbr2_probe_bw.cc
+++ b/quic/core/congestion_control/bbr2_probe_bw.cc
@@ -205,10 +205,10 @@
           model_->total_bytes_acked() -
           congestion_event.last_packet_send_state.total_bytes_acked;
     } else {
-      QUIC_BUG << "Total_bytes_acked(" << model_->total_bytes_acked()
-               << ") < send_state.total_bytes_acked("
-               << congestion_event.last_packet_send_state.total_bytes_acked
-               << ")";
+      QUIC_BUG_V2(quic_bug_10436_1)
+          << "Total_bytes_acked(" << model_->total_bytes_acked()
+          << ") < send_state.total_bytes_acked("
+          << congestion_event.last_packet_send_state.total_bytes_acked << ")";
     }
   }
   if (model_->IsInflightTooHigh(congestion_event,
@@ -394,8 +394,9 @@
 
       model_->set_inflight_hi(new_inflight_hi);
     } else {
-      QUIC_BUG << "Not growing inflight_hi due to wrap around. Old value:"
-               << model_->inflight_hi() << ", new value:" << new_inflight_hi;
+      QUIC_BUG_V2(quic_bug_10436_2)
+          << "Not growing inflight_hi due to wrap around. Old value:"
+          << model_->inflight_hi() << ", new value:" << new_inflight_hi;
     }
   }
 
diff --git a/quic/core/congestion_control/bbr2_sender.cc b/quic/core/congestion_control/bbr2_sender.cc
index db6a31a..c339bc5 100644
--- a/quic/core/congestion_control/bbr2_sender.cc
+++ b/quic/core/congestion_control/bbr2_sender.cc
@@ -264,16 +264,19 @@
     BBR2_MODE_DISPATCH(Enter(event_time, &congestion_event));
     --mode_changes_allowed;
     if (mode_changes_allowed < 0) {
-      QUIC_BUG << "Exceeded max number of mode changes per congestion event.";
+      QUIC_BUG_V2(quic_bug_10443_1)
+          << "Exceeded max number of mode changes per congestion event.";
       break;
     }
   }
 
   UpdatePacingRate(congestion_event.bytes_acked);
-  QUIC_BUG_IF(pacing_rate_.IsZero()) << "Pacing rate must not be zero!";
+  QUIC_BUG_IF_V2(quic_bug_10443_2, pacing_rate_.IsZero())
+      << "Pacing rate must not be zero!";
 
   UpdateCongestionWindow(congestion_event.bytes_acked);
-  QUIC_BUG_IF(cwnd_ == 0u) << "Congestion window must not be zero!";
+  QUIC_BUG_IF_V2(quic_bug_10443_3, cwnd_ == 0u)
+      << "Congestion window must not be zero!";
 
   model_.OnCongestionEventFinish(unacked_packets_->GetLeastUnacked(),
                                  congestion_event);
diff --git a/quic/core/congestion_control/bbr2_startup.cc b/quic/core/congestion_control/bbr2_startup.cc
index 0f6b80f..80b4bcd 100644
--- a/quic/core/congestion_control/bbr2_startup.cc
+++ b/quic/core/congestion_control/bbr2_startup.cc
@@ -32,7 +32,8 @@
 
 void Bbr2StartupMode::Enter(QuicTime /*now*/,
                             const Bbr2CongestionEvent* /*congestion_event*/) {
-  QUIC_BUG << "Bbr2StartupMode::Enter should not be called";
+  QUIC_BUG_V2(quic_bug_10463_1)
+      << "Bbr2StartupMode::Enter should not be called";
 }
 
 void Bbr2StartupMode::Leave(QuicTime now,
diff --git a/quic/core/congestion_control/general_loss_algorithm.cc b/quic/core/congestion_control/general_loss_algorithm.cc
index 521aa4a..a995e0a 100644
--- a/quic/core/congestion_control/general_loss_algorithm.cc
+++ b/quic/core/congestion_control/general_loss_algorithm.cc
@@ -69,9 +69,10 @@
   auto it = unacked_packets.begin();
   if (least_in_flight_.IsInitialized() && least_in_flight_ >= packet_number) {
     if (least_in_flight_ > unacked_packets.largest_sent_packet() + 1) {
-      QUIC_BUG << "least_in_flight: " << least_in_flight_
-               << " is greater than largest_sent_packet + 1: "
-               << unacked_packets.largest_sent_packet() + 1;
+      QUIC_BUG_V2(quic_bug_10430_1)
+          << "least_in_flight: " << least_in_flight_
+          << " is greater than largest_sent_packet + 1: "
+          << unacked_packets.largest_sent_packet() + 1;
     } else {
       it += (least_in_flight_ - packet_number);
       packet_number = least_in_flight_;
@@ -181,7 +182,7 @@
                                       LossDetectionInterface* parent) {
   parent_ = parent;
   if (packet_number_space_ < NUM_PACKET_NUMBER_SPACES) {
-    QUIC_BUG << "Cannot switch packet_number_space";
+    QUIC_BUG_V2(quic_bug_10430_2) << "Cannot switch packet_number_space";
     return;
   }
 
diff --git a/quic/core/congestion_control/rtt_stats.h b/quic/core/congestion_control/rtt_stats.h
index 1911e38..505925b 100644
--- a/quic/core/congestion_control/rtt_stats.h
+++ b/quic/core/congestion_control/rtt_stats.h
@@ -79,7 +79,7 @@
   // Sets an initial RTT to be used for SmoothedRtt before any RTT updates.
   void set_initial_rtt(QuicTime::Delta initial_rtt) {
     if (initial_rtt.ToMicroseconds() <= 0) {
-      QUIC_BUG << "Attempt to set initial rtt to <= 0.";
+      QUIC_BUG_V2(quic_bug_10453_1) << "Attempt to set initial rtt to <= 0.";
       return;
     }
     initial_rtt_ = initial_rtt;
diff --git a/quic/core/congestion_control/tcp_cubic_sender_bytes.cc b/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
index 77691fd..6a0b6f4 100644
--- a/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
+++ b/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
@@ -361,7 +361,8 @@
     QuicByteCount acked_bytes,
     QuicByteCount prior_in_flight,
     QuicTime event_time) {
-  QUIC_BUG_IF(InRecovery()) << "Never increase the CWND during recovery.";
+  QUIC_BUG_IF_V2(quic_bug_10439_1, InRecovery())
+      << "Never increase the CWND during recovery.";
   // Do not increase the congestion window unless the sender is close to using
   // the current window.
   if (!IsCwndLimited(prior_in_flight)) {
diff --git a/quic/core/congestion_control/uber_loss_algorithm.cc b/quic/core/congestion_control/uber_loss_algorithm.cc
index 3668487..0d7909f 100644
--- a/quic/core/congestion_control/uber_loss_algorithm.cc
+++ b/quic/core/congestion_control/uber_loss_algorithm.cc
@@ -93,7 +93,8 @@
 void UberLossAlgorithm::SetLossDetectionTuner(
     std::unique_ptr<LossDetectionTunerInterface> tuner) {
   if (tuner_ != nullptr) {
-    QUIC_BUG << "LossDetectionTuner can only be set once when session begins.";
+    QUIC_BUG_V2(quic_bug_10469_1)
+        << "LossDetectionTuner can only be set once when session begins.";
     return;
   }
   tuner_ = std::move(tuner);
@@ -119,7 +120,8 @@
     SetReorderingShift(*tuned_parameters_.reordering_shift);
     SetReorderingThreshold(*tuned_parameters_.reordering_threshold);
   } else {
-    QUIC_BUG << "Tuner started but some parameters are missing";
+    QUIC_BUG_V2(quic_bug_10469_2)
+        << "Tuner started but some parameters are missing";
   }
 }
 
@@ -204,7 +206,7 @@
 
 void UberLossAlgorithm::ResetLossDetection(PacketNumberSpace space) {
   if (space >= NUM_PACKET_NUMBER_SPACES) {
-    QUIC_BUG << "Invalid packet number space: " << space;
+    QUIC_BUG_V2(quic_bug_10469_3) << "Invalid packet number space: " << space;
     return;
   }
   general_loss_algorithms_[space].Reset();