-
Notifications
You must be signed in to change notification settings - Fork 57
Alter topic feature #448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alter topic feature #448
Conversation
d454b80
to
0164d38
Compare
ab66f36
to
dab805a
Compare
tests/topics/test_control_plane.py
Outdated
@@ -39,6 +39,14 @@ async def test_describe_topic(self, driver, topic_path: str, topic_consumer): | |||
|
|||
assert has_consumer | |||
|
|||
async def test_alter_topic(self, driver, topic_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function needs a positive test too
set_read_from: Optional[datetime.datetime] = None | ||
"All messages with smaller server written_at timestamp will be skipped." | ||
|
||
set_supported_codecs: List[PublicCodec] = field(default_factory=lambda: list()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will you distinct empty list and empty value (doesn't need to change)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default for set_supported_codecs must be None
supported_codecs on topic must be contained inside this list. | ||
""" | ||
|
||
alter_attributes: Dict[str, str] = field(default_factory=lambda: dict()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question
set_partition_count_limit: Optional[int] | ||
add_consumers: Optional[List[Union["PublicConsumer", str]]] | ||
alter_consumers: Optional[List[Union["PublicAlterConsumer", str]]] | ||
drop_consumers: Optional[List[str]] # TODO: clarify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo?
f9280e2
to
b246065
Compare
🌋 Here are results of SLO test for python-sync: |
e96a901
to
7f63d1e
Compare
cfb8a99
to
c28216f
Compare
ydb/_grpc/grpcwrapper/ydb_topic.py
Outdated
set_metering_mode: "MeteringMode" | ||
|
||
def to_proto(self) -> ydb_topic_pb2.AlterTopicRequest: | ||
supported_codecs = self.set_supported_codecs.to_proto() if self.set_supported_codecs.codecs else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need distinct between empty list and none - for select between set empty codecs list and skip set the option
ydb/_grpc/grpcwrapper/ydb_topic.py
Outdated
alter_attributes: Optional[Dict[str, str]] | ||
|
||
def to_proto(self) -> ydb_topic_pb2.AlterConsumer: | ||
supported_codecs = self.set_supported_codecs.to_proto() if self.set_supported_codecs else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicit check for none
ydb/_grpc/grpcwrapper/ydb_topic.py
Outdated
set_partition_count_limit: Optional[int] | ||
|
||
@staticmethod | ||
def from_proto(msg: ydb_topic_pb2.AlterPartitioningSettings) -> "AlterPartitioningSettings": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove from_proto
ydb/_grpc/grpcwrapper/ydb_topic.py
Outdated
path: str | ||
add_consumers: List["Consumer"] | ||
alter_partitioning_settings: AlterPartitioningSettings | ||
set_retention_period: datetime.timedelta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional?
ydb/_grpc/grpcwrapper/ydb_topic.py
Outdated
set_metering_mode: Optional["MeteringMode"] | ||
|
||
def to_proto(self) -> ydb_topic_pb2.AlterTopicRequest: | ||
supported_codecs = self.set_supported_codecs.to_proto() if self.set_supported_codecs else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explicit check if None
ydb/_grpc/grpcwrapper/ydb_topic.py
Outdated
|
||
supported_codecs = None | ||
if req.set_supported_codecs is not None: | ||
supported_codecs = SupportedCodecs(req.set_supported_codecs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need appect all types from req.set_supported_codecs and drop deny from field order.
set_read_from: Optional[datetime.datetime] = None | ||
"All messages with smaller server written_at timestamp will be skipped." | ||
|
||
set_supported_codecs: List[PublicCodec] = field(default_factory=lambda: list()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default for set_supported_codecs must be None
@dataclass | ||
class PublicAlterConsumer: | ||
name: str | ||
set_important: bool = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional
ydb/_grpc/grpcwrapper/ydb_topic.py
Outdated
@@ -69,6 +69,13 @@ def from_proto(msg: Optional[ydb_topic_pb2.SupportedCodecs]) -> "SupportedCodecs | |||
def to_public(self) -> List[ydb_topic_public_types.PublicCodec]: | |||
return list(map(Codec.to_public, self.codecs)) | |||
|
|||
@staticmethod | |||
def from_public(codecs: Optional[List[ydb_topic_public_types.PublicCodec]]) -> "SupportedCodecs": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Optional for result
- Supported codec require Codec instead of PublicCodec
- from_public need to accept list of PublicCodec or int
74b7c06
to
72b0a6f
Compare
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Topic client has a new method
alter_topic
to update existing topics.Other information