kafka-python 3.0.5__py3-none-any.whl → 3.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kafka/consumer/subscription_state.py +39 -5
- kafka/version.py +1 -1
- {kafka_python-3.0.5.dist-info → kafka_python-3.0.6.dist-info}/METADATA +1 -1
- {kafka_python-3.0.5.dist-info → kafka_python-3.0.6.dist-info}/RECORD +8 -8
- {kafka_python-3.0.5.dist-info → kafka_python-3.0.6.dist-info}/WHEEL +0 -0
- {kafka_python-3.0.5.dist-info → kafka_python-3.0.6.dist-info}/entry_points.txt +0 -0
- {kafka_python-3.0.5.dist-info → kafka_python-3.0.6.dist-info}/licenses/LICENSE +0 -0
- {kafka_python-3.0.5.dist-info → kafka_python-3.0.6.dist-info}/top_level.txt +0 -0
|
@@ -564,6 +564,18 @@ class TopicPartitionState:
|
|
|
564
564
|
# until OffsetForLeaderEpoch confirms the position is consistent with
|
|
565
565
|
# the current leader's log; mutually exclusive with awaiting_reset.
|
|
566
566
|
self._awaiting_validation = False
|
|
567
|
+
# Highest cluster leader epoch this position has already been reconciled
|
|
568
|
+
# against (a completed validation, or adoption of a position whose
|
|
569
|
+
# record epoch is unknown). This is deliberately distinct from the
|
|
570
|
+
# position's *record* epoch (``OffsetAndMetadata.leader_epoch``, which
|
|
571
|
+
# is sent as last_fetched_epoch for KIP-595 divergence detection): a
|
|
572
|
+
# leader election bumps the cluster epoch without changing the epoch of
|
|
573
|
+
# the record we're positioned on, and OffsetForLeaderEpoch reports the
|
|
574
|
+
# epoch of the requested (older) point, so the record epoch alone can't
|
|
575
|
+
# tell us whether we've validated against the current leader. Tracking
|
|
576
|
+
# it separately is what stops poll() from re-validating forever and
|
|
577
|
+
# stalling the consumer. See #3106.
|
|
578
|
+
self._current_leader_epoch = -1
|
|
567
579
|
# KIP-392: preferred read replica chosen by the broker (rack-aware).
|
|
568
580
|
# ``_preferred_read_replica_expiration`` is a monotonic deadline; after
|
|
569
581
|
# it passes we fall back to the leader and re-learn. Cleared on
|
|
@@ -597,6 +609,7 @@ class TopicPartitionState:
|
|
|
597
609
|
self._position = None
|
|
598
610
|
self.next_allowed_retry_time = None
|
|
599
611
|
self._awaiting_validation = False
|
|
612
|
+
self._current_leader_epoch = -1
|
|
600
613
|
self.clear_preferred_read_replica()
|
|
601
614
|
|
|
602
615
|
def is_reset_allowed(self):
|
|
@@ -625,6 +638,11 @@ class TopicPartitionState:
|
|
|
625
638
|
self.drop_pending_record_batch = True
|
|
626
639
|
self.next_allowed_retry_time = None
|
|
627
640
|
self._awaiting_validation = False
|
|
641
|
+
# A freshly-seeked position has not been reconciled against any leader;
|
|
642
|
+
# force the next maybe_validate_position to validate it against the
|
|
643
|
+
# current leader (the prior position's validation says nothing about
|
|
644
|
+
# this offset).
|
|
645
|
+
self._current_leader_epoch = -1
|
|
628
646
|
self.clear_preferred_read_replica()
|
|
629
647
|
|
|
630
648
|
def pause(self):
|
|
@@ -686,7 +704,8 @@ class TopicPartitionState:
|
|
|
686
704
|
return self._awaiting_validation
|
|
687
705
|
|
|
688
706
|
def maybe_validate_position(self, current_leader_epoch):
|
|
689
|
-
"""Mark for validation if current leader has advanced beyond
|
|
707
|
+
"""Mark for validation if the current leader has advanced beyond the
|
|
708
|
+
leader epoch this position was last reconciled against.
|
|
690
709
|
|
|
691
710
|
Returns True if the partition is now awaiting validation.
|
|
692
711
|
"""
|
|
@@ -696,11 +715,26 @@ class TopicPartitionState:
|
|
|
696
715
|
return False
|
|
697
716
|
if current_leader_epoch is None or current_leader_epoch < 0:
|
|
698
717
|
return False
|
|
699
|
-
#
|
|
700
|
-
#
|
|
701
|
-
|
|
718
|
+
# Have we already reconciled this position against this leader epoch (or
|
|
719
|
+
# a newer one)? The floor is the max of:
|
|
720
|
+
# - the record epoch of the position itself: a record we actually
|
|
721
|
+
# fetched at this offset proves the position is valid through its
|
|
722
|
+
# epoch (so a position fetched under the current leader needs no
|
|
723
|
+
# validation), and
|
|
724
|
+
# - the leader epoch a completed validation reconciled us against,
|
|
725
|
+
# which can exceed the record epoch because OffsetForLeaderEpoch
|
|
726
|
+
# reports the epoch of the requested (older) point, not the current
|
|
727
|
+
# leader's. Without this second term the position is re-marked every
|
|
728
|
+
# poll and the partition never becomes fetchable again (#3106).
|
|
729
|
+
reconciled_epoch = max(self._current_leader_epoch, self._position.leader_epoch)
|
|
730
|
+
if current_leader_epoch <= reconciled_epoch:
|
|
702
731
|
return False
|
|
703
|
-
|
|
732
|
+
# We are now tracking this leader epoch regardless of whether the
|
|
733
|
+
# position itself carries a record epoch we can validate against.
|
|
734
|
+
self._current_leader_epoch = current_leader_epoch
|
|
735
|
+
# Positions without a known record epoch (legacy data, post-seek to bare
|
|
736
|
+
# offset) can't be validated; treat as already-fetchable.
|
|
737
|
+
if self._position.leader_epoch < 0:
|
|
704
738
|
return False
|
|
705
739
|
self.clear_preferred_read_replica()
|
|
706
740
|
self._awaiting_validation = True
|
kafka/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '3.0.
|
|
1
|
+
__version__ = '3.0.6'
|
|
@@ -6,7 +6,7 @@ kafka/errors.py,sha256=9owgtTIcttdTCD1vAF9wz5jL9G72ljpR7M-vjLKEGvY,33206
|
|
|
6
6
|
kafka/future.py,sha256=INmMIy2-BPxJ4zlw-V_i8Tj_OG9DMbyYyUEjOQ5pn_o,5440
|
|
7
7
|
kafka/structs.py,sha256=ZOFmVJRbhSXykkw9cnuv-DGYE7g2KjaUGsytSOv4xVw,3146
|
|
8
8
|
kafka/util.py,sha256=hvSdRbh5-IsUbpD_BqjabjEldtNmXufZH68b_xCkNjE,5194
|
|
9
|
-
kafka/version.py,sha256=
|
|
9
|
+
kafka/version.py,sha256=CDrF7ZuVPf2iv0oruW7EHmnEThkmylzR7xWICjw4EtM,22
|
|
10
10
|
kafka/admin/__init__.py,sha256=nTXg2CQo8Bydxsj80pVBzF2-jq4IhK7_gLnboeNWG60,1575
|
|
11
11
|
kafka/admin/__main__.py,sha256=l5ujkHa3lBFEbKPCl7U0_pi6IIgj1IJfmB219vtcj50,69
|
|
12
12
|
kafka/admin/_acls.py,sha256=QJlHguEM9t46qlABoQqTEDFQErDgG2RKwfV1NOKeKmU,13983
|
|
@@ -85,7 +85,7 @@ kafka/consumer/__init__.py,sha256=I7nuPUb103S1CvCqcudbIRG_isJbRgTXkK1mpHIhoVs,82
|
|
|
85
85
|
kafka/consumer/__main__.py,sha256=bnxM30LbGVvLb0ZBcgJEt_8bZHADJpboHZCxzd8QEhA,72
|
|
86
86
|
kafka/consumer/fetcher.py,sha256=Xr-JNlyNZgVNanh6AlYn1ImsyuBbpMqjPGwMZL50Hmc,106075
|
|
87
87
|
kafka/consumer/group.py,sha256=lJo2U_wHSk_j-qwfa2GeU_gOZq5kWbxh2qAkjyMer6Q,68423
|
|
88
|
-
kafka/consumer/subscription_state.py,sha256=
|
|
88
|
+
kafka/consumer/subscription_state.py,sha256=0ixLOlO9KIxzFD0eMkLqrUjSJ44CMkkcvCQGWxt7nJg,40883
|
|
89
89
|
kafka/coordinator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
90
90
|
kafka/coordinator/base.py,sha256=UgMXWES0VVgDsvLEEZB8tAvchGFRzJFO6N9bL06vGm4,57794
|
|
91
91
|
kafka/coordinator/consumer.py,sha256=cQ-zo0p_lL5H3j8DT4Q6ZrBBxCWWh4p1ub1X2IHlx5w,60186
|
|
@@ -365,9 +365,9 @@ kafka/serializer/default.py,sha256=ZKzTWlG9N4vS3QXovFLygNVrnjAcMZKS0RE4OvQ6DL4,4
|
|
|
365
365
|
kafka/serializer/json.py,sha256=lErgU66KZGf33hofwlObYIaxLDk9gcolhy_rlcOuf8Y,469
|
|
366
366
|
kafka/serializer/wrapper.py,sha256=RGXFj-PXQyL3rdMXI9ACaohRa6Kg5SHOZTRruU9jluM,485
|
|
367
367
|
kafka/vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
368
|
-
kafka_python-3.0.
|
|
369
|
-
kafka_python-3.0.
|
|
370
|
-
kafka_python-3.0.
|
|
371
|
-
kafka_python-3.0.
|
|
372
|
-
kafka_python-3.0.
|
|
373
|
-
kafka_python-3.0.
|
|
368
|
+
kafka_python-3.0.6.dist-info/licenses/LICENSE,sha256=vxnoJsqm6bKl3ZWdI1Q7Ikw_k9cOvO3vcvZNsY_1fP8,11374
|
|
369
|
+
kafka_python-3.0.6.dist-info/METADATA,sha256=hcD366G7QC4pqvsezCx8YGYduujSM3DFKUnqOJusHJM,11590
|
|
370
|
+
kafka_python-3.0.6.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
371
|
+
kafka_python-3.0.6.dist-info/entry_points.txt,sha256=LQvqZj3uM785ainO5HrXmukbjSrK-oPqrESqpvoR-As,51
|
|
372
|
+
kafka_python-3.0.6.dist-info/top_level.txt,sha256=IivJz7l5WHdLNDT6RIiVAlhjQzYRwGqBBmKHZ7WjPeM,6
|
|
373
|
+
kafka_python-3.0.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|