Skip to content
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

Fix resolving queue path in AdvanceConsumer #505

Closed
wants to merge 2 commits into from

Conversation

savnadya
Copy link
Collaborator

@savnadya savnadya commented Apr 4, 2024

No description provided.

@savnadya savnadya requested a review from achulkov2 April 4, 2024 13:53
Logger);
THashMap<int, THashMap<i64, TPartitionRowInfo>> partitionRowInfos;
try {
partitionRowInfos = CollectPartitionRowInfos(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that we generally try to avoid try-except clauses like this in our control flow. Let's make CollectPartitionRowInfos return a future to its result. It should be fairly easy to rewrite the logic inside into SelectRows + Apply.

ReplicaToReplicatedTable_[replica] = replicatedTableInfo.Ref;
ReplicaToReplicatedTable_[replica] = TResolvedObject{
.Path = replicatedTableInfo.Ref,
.ObjectType = replicatedTableInfo.ObjectType,
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we implement it like this, replicas will have a type of [Chaos]ReplicatedTable, while the [chaos]_replicated_table objects themselves will have a std::nullopt type.

Ideally, we would want to separate these types, but that all depends on how this will be used in the end.

Copy link
Collaborator

@achulkov2 achulkov2 left a comment

Choose a reason for hiding this comment

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

I think we should separate the ObjectType related changes into a separate PR in which we actually use them.

Copy link
Collaborator

@achulkov2 achulkov2 left a comment

Choose a reason for hiding this comment

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

Left a few more comments, but otherwise LGTM.

Logger));

if (!partitionRowInfosOrError.IsOK()) {
YT_LOG_DEBUG("Failed to get partition row infos (Path: %v)",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's print the error.

if (!queueTableInfoOrError.IsOK()) {
THROW_ERROR_EXCEPTION("Failed to resolve queue path")
<< queueTableInfoOrError;
const auto& consumerClusterTableMountCache = Client_->GetNativeConnection()->GetTableMountCache();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this should be a helper function, since we are re-using code from PullConsumer?

@@ -207,4 +215,25 @@ TError MakeRevivalError(

////////////////////////////////////////////////////////////////////////////////

void CheckConsumerPermission(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's expose the context switch happening inside by returning a future? We can even chain this with .Apply.

CheckConsumerPermission(Client_->GetNativeConnection(), consumerPath, Client_->GetOptions());

auto registrationCheckResult = Client_->GetNativeConnection()->GetQueueConsumerRegistrationManager()->GetRegistration(queuePath, consumerPath);
if (!registrationCheckResult.Registration) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Checking registrations should also go inside the helper, IMO, since it is also exactly the same.

@@ -817,6 +816,8 @@ def test_multicluster_symlink_registrations(self, create_registration_table):
class TestDataApi(TestQueueConsumerApiBase, ReplicatedObjectBase, TestQueueAgentBase):
NUM_TEST_PARTITIONS = 2

NUM_REMOTE_CLUSTERS = 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's make a separate suite for multi-cluster API tests. The multi-cluster set-up/tear-down takes a while and would make all the other tests in the suite longer.

@savnadya savnadya force-pushed the fix-resolving-advance-consumer branch from 0273716 to 1c85073 Compare April 10, 2024 07:34
@savnadya
Copy link
Collaborator Author

It was merged here: cdc867f

@savnadya savnadya closed this May 17, 2024
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.

None yet

2 participants