@@ -715,6 +715,8 @@ void TPersQueue::ApplyNewConfig(const NKikimrPQ::TPQTabletConfig& newConfig,
715
715
{
716
716
Config = newConfig;
717
717
718
+ PQ_LOG_D (" Apply new config " << Config.ShortDebugString ());
719
+
718
720
ui32 cacheSize = CACHE_SIZE;
719
721
if (Config.HasCacheSize ()) {
720
722
cacheSize = Config.GetCacheSize ();
@@ -1630,6 +1632,32 @@ void TPersQueue::CreateTopicConverter(const NKikimrPQ::TPQTabletConfig& config,
1630
1632
Y_ABORT_UNLESS (topicConverter->IsValid (), " %s" , topicConverter->GetReason ().c_str ());
1631
1633
}
1632
1634
1635
+ void TPersQueue::UpdateReadRuleGenerations (NKikimrPQ::TPQTabletConfig& cfg) const
1636
+ {
1637
+ Y_ABORT_UNLESS (cfg.HasVersion ());
1638
+ const int curConfigVersion = cfg.GetVersion ();
1639
+
1640
+ // set rr generation for provided read rules
1641
+ THashMap<TString, std::pair<ui64, ui64>> existed; // map name -> rrVersion, rrGeneration
1642
+ for (const auto & c : Config.GetConsumers ()) {
1643
+ existed[c.GetName ()] = std::make_pair (c.GetVersion (), c.GetGeneration ());
1644
+ }
1645
+
1646
+ for (auto & c : *cfg.MutableConsumers ()) {
1647
+ auto it = existed.find (c.GetName ());
1648
+ ui64 generation = 0 ;
1649
+ if (it != existed.end () && it->second .first == c.GetVersion ()) {
1650
+ generation = it->second .second ;
1651
+ } else {
1652
+ generation = curConfigVersion;
1653
+ }
1654
+ c.SetGeneration (generation);
1655
+ if (ReadRuleCompatible ()) {
1656
+ cfg.AddReadRuleGenerations (generation);
1657
+ }
1658
+ }
1659
+ }
1660
+
1633
1661
void TPersQueue::ProcessUpdateConfigRequest (TAutoPtr<TEvPersQueue::TEvUpdateConfig> ev, const TActorId& sender, const TActorContext& ctx)
1634
1662
{
1635
1663
const auto & record = ev->GetRecord ();
@@ -1642,7 +1670,7 @@ void TPersQueue::ProcessUpdateConfigRequest(TAutoPtr<TEvPersQueue::TEvUpdateConf
1642
1670
NKikimrPQ::TPQTabletConfig cfg = record.GetTabletConfig ();
1643
1671
1644
1672
Y_ABORT_UNLESS (cfg.HasVersion ());
1645
- int curConfigVersion = cfg.GetVersion ();
1673
+ const int curConfigVersion = cfg.GetVersion ();
1646
1674
1647
1675
if (curConfigVersion == oldConfigVersion) { // already applied
1648
1676
LOG_INFO_S (ctx, NKikimrServices::PERSQUEUE, " Tablet " << TabletID ()
@@ -1741,27 +1769,7 @@ void TPersQueue::ProcessUpdateConfigRequest(TAutoPtr<TEvPersQueue::TEvUpdateConf
1741
1769
1742
1770
Migrate (cfg);
1743
1771
1744
- // set rr generation for provided read rules
1745
- {
1746
- THashMap<TString, std::pair<ui64, ui64>> existed; // map name -> rrVersion, rrGeneration
1747
- for (const auto & c : Config.GetConsumers ()) {
1748
- existed[c.GetName ()] = std::make_pair (c.GetVersion (), c.GetGeneration ());
1749
- }
1750
-
1751
- for (auto & c : *cfg.MutableConsumers ()) {
1752
- auto it = existed.find (c.GetName ());
1753
- ui64 generation = 0 ;
1754
- if (it != existed.end () && it->second .first == c.GetVersion ()) {
1755
- generation = it->second .second ;
1756
- } else {
1757
- generation = curConfigVersion;
1758
- }
1759
- c.SetGeneration (generation);
1760
- if (ReadRuleCompatible ()) {
1761
- cfg.AddReadRuleGenerations (generation);
1762
- }
1763
- }
1764
- }
1772
+ UpdateReadRuleGenerations (cfg);
1765
1773
1766
1774
LOG_DEBUG_S (ctx, NKikimrServices::PERSQUEUE, " Tablet " << TabletID ()
1767
1775
<< " Config update version " << cfg.GetVersion () << " (current " << Config.GetVersion () << " ) received from actor " << sender
@@ -3727,6 +3735,10 @@ void TPersQueue::ProcessProposeTransactionQueue(const TActorContext& ctx)
3727
3735
tx.OnProposeTransaction (event, GetAllowedStep (),
3728
3736
TabletID ());
3729
3737
3738
+ if (tx.Kind == NKikimrPQ::TTransaction::KIND_CONFIG) {
3739
+ UpdateReadRuleGenerations (tx.TabletConfig );
3740
+ }
3741
+
3730
3742
if (tx.WriteId .Defined ()) {
3731
3743
const TWriteId& writeId = *tx.WriteId ;
3732
3744
Y_ABORT_UNLESS (TxWrites.contains (writeId),
0 commit comments