Skip to content

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

Merged
merged 3 commits into from
Jul 8, 2024
Merged

Alter topic feature #448

merged 3 commits into from
Jul 8, 2024

Conversation

vgvoleg
Copy link
Collaborator

@vgvoleg vgvoleg commented Jun 28, 2024

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

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

@vgvoleg vgvoleg force-pushed the impl/alter_topic branch 2 times, most recently from d454b80 to 0164d38 Compare June 29, 2024 13:27
@vgvoleg vgvoleg force-pushed the impl/alter_topic branch 4 times, most recently from ab66f36 to dab805a Compare July 1, 2024 08:11
@@ -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):
Copy link
Member

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())
Copy link
Member

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)?

Copy link
Member

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())
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo?

@vgvoleg vgvoleg self-assigned this Jul 1, 2024
@vgvoleg vgvoleg linked an issue Jul 1, 2024 that may be closed by this pull request
@vgvoleg vgvoleg force-pushed the impl/alter_topic branch 2 times, most recently from f9280e2 to b246065 Compare July 2, 2024 10:47
Copy link

github-actions bot commented Jul 2, 2024

🌋 Here are results of SLO test for python-sync:

Grafana Dashboard

SLO-sync

@vgvoleg vgvoleg force-pushed the impl/alter_topic branch 3 times, most recently from e96a901 to 7f63d1e Compare July 2, 2024 11:18
@vgvoleg vgvoleg force-pushed the impl/alter_topic branch from 7f63d1e to badb27a Compare July 2, 2024 11:20
@vgvoleg vgvoleg force-pushed the impl/alter_topic branch 4 times, most recently from cfb8a99 to c28216f Compare July 4, 2024 16:06
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
Copy link
Member

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

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicit check for none

set_partition_count_limit: Optional[int]

@staticmethod
def from_proto(msg: ydb_topic_pb2.AlterPartitioningSettings) -> "AlterPartitioningSettings":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove from_proto

path: str
add_consumers: List["Consumer"]
alter_partitioning_settings: AlterPartitioningSettings
set_retention_period: datetime.timedelta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional?

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicit check if None


supported_codecs = None
if req.set_supported_codecs is not None:
supported_codecs = SupportedCodecs(req.set_supported_codecs)
Copy link
Member

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())
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional

@@ -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":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Optional for result
  2. Supported codec require Codec instead of PublicCodec
  3. from_public need to accept list of PublicCodec or int

@vgvoleg vgvoleg force-pushed the impl/alter_topic branch 2 times, most recently from 74b7c06 to 72b0a6f Compare July 8, 2024 10:59
@vgvoleg vgvoleg force-pushed the impl/alter_topic branch from 72b0a6f to e8e1272 Compare July 8, 2024 11:13
@vgvoleg vgvoleg merged commit 3eeef84 into main Jul 8, 2024
11 checks passed
@vgvoleg vgvoleg deleted the impl/alter_topic branch July 8, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add alter topic method
2 participants