-
Notifications
You must be signed in to change notification settings - Fork 733
test for invalid reassign #28404
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
test for invalid reassign #28404
Conversation
|
⚪
🟢 |
|
⚪
🟢 |
|
🟢 |
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.
Pull Request Overview
This PR adds a new unit test TestReassignNonexistentTablet to verify that attempting to reassign a non-existent tablet is handled gracefully and does not block the Hive balancer.
- Adds test for reassigning a non-existent tablet via HTTP API
- Verifies that the invalid reassignment returns
total=0in the response - Ensures the balancer continues to operate normally after the invalid request
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| THolder<TEvHive::TEvTabletMetrics> metrics = MakeHolder<TEvHive::TEvTabletMetrics>(); | ||
| NKikimrHive::TTabletMetrics* metric = metrics->Record.AddTabletMetrics(); | ||
| metric->SetTabletID(tablet); | ||
| metric->MutableResourceUsage()->SetNetwork(9000); | ||
|
|
||
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | ||
| } |
Copilot
AI
Nov 11, 2025
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.
Inconsistent indentation: this opening brace uses 7 spaces instead of 8 spaces like the rest of the function. Should align with the opening brace on line 8254.
| { | |
| THolder<TEvHive::TEvTabletMetrics> metrics = MakeHolder<TEvHive::TEvTabletMetrics>(); | |
| NKikimrHive::TTabletMetrics* metric = metrics->Record.AddTabletMetrics(); | |
| metric->SetTabletID(tablet); | |
| metric->MutableResourceUsage()->SetNetwork(9000); | |
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | |
| } | |
| { | |
| THolder<TEvHive::TEvTabletMetrics> metrics = MakeHolder<TEvHive::TEvTabletMetrics>(); | |
| NKikimrHive::TTabletMetrics* metric = metrics->Record.AddTabletMetrics(); | |
| metric->SetTabletID(tablet); | |
| metric->MutableResourceUsage()->SetNetwork(9000); | |
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | |
| } |
| metric->MutableResourceUsage()->SetNetwork(9000); | ||
|
|
||
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | ||
| } |
Copilot
AI
Nov 11, 2025
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.
Inconsistent indentation: this closing brace uses 7 spaces instead of 8 spaces like the rest of the function. Should align with the corresponding opening brace.
| } | |
| } |
| { | ||
| THolder<TEvHive::TEvTabletMetrics> metrics = MakeHolder<TEvHive::TEvTabletMetrics>(); | ||
| NKikimrHive::TTabletMetrics* metric = metrics->Record.AddTabletMetrics(); | ||
| metric->SetTabletID(tablet); | ||
| metric->MutableResourceUsage()->SetNetwork(9000); | ||
|
|
||
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | ||
| } | ||
|
|
||
| { | ||
| TDispatchOptions options; | ||
| options.FinalEvents.push_back(NHive::TEvPrivate::EvBalancerOut); | ||
| runtime.DispatchEvents(options); | ||
| } |
Copilot
AI
Nov 11, 2025
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.
Inconsistent indentation: this block uses 7 spaces instead of 8 spaces like the rest of the function. All lines in this block should be indented with 8 spaces to match the rest of the test function.
| { | |
| THolder<TEvHive::TEvTabletMetrics> metrics = MakeHolder<TEvHive::TEvTabletMetrics>(); | |
| NKikimrHive::TTabletMetrics* metric = metrics->Record.AddTabletMetrics(); | |
| metric->SetTabletID(tablet); | |
| metric->MutableResourceUsage()->SetNetwork(9000); | |
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | |
| } | |
| { | |
| TDispatchOptions options; | |
| options.FinalEvents.push_back(NHive::TEvPrivate::EvBalancerOut); | |
| runtime.DispatchEvents(options); | |
| } | |
| { | |
| THolder<TEvHive::TEvTabletMetrics> metrics = MakeHolder<TEvHive::TEvTabletMetrics>(); | |
| NKikimrHive::TTabletMetrics* metric = metrics->Record.AddTabletMetrics(); | |
| metric->SetTabletID(tablet); | |
| metric->MutableResourceUsage()->SetNetwork(9000); | |
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | |
| } | |
| { | |
| TDispatchOptions options; | |
| options.FinalEvents.push_back(NHive::TEvPrivate::EvBalancerOut); | |
| runtime.DispatchEvents(options); | |
| } |
| p2->SetValue("ReassignTablet"); | ||
| auto* p3 = pb.AddQueryParams(); | ||
| p3->SetKey("tablet"); | ||
| p3->SetValue("52"); |
Copilot
AI
Nov 11, 2025
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 hardcoded tablet ID "52" could potentially collide with an existing tablet. Consider using a clearly non-existent ID similar to line 8214 (e.g., TStringBuilder() << 0xfa5e7ab1e7) or adding a comment explaining why this specific value is guaranteed to be non-existent.
| p3->SetValue("52"); | |
| p3->SetValue(TStringBuilder() << 0xfa5e7ab1e7); |
|
@vporyadke привяжи issue и свяжи с pr, в котором делалось исправление. |
Changelog entry
...
Changelog category
Description for reviewers
...