Skip to content

Conversation

@maximyurchuk
Copy link
Collaborator

New tool to run standalone ydbd in local environment

Possible next_steps:

  • download arbitrary version from s3
  • add nemesis support
  • add ability to run cluster with mixed versions
  • ...

Copilot AI review requested due to automatic review settings December 8, 2025 15:41
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

2025-12-08 15:43:14 UTC Pre-commit check linux-x86_64-release-asan for 5614eb7 has started.
2025-12-08 15:43:57 UTC Artifacts will be uploaded here
2025-12-08 15:45:44 UTC ya make is running...
🟡 2025-12-08 16:22:30 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1837 1812 0 10 6 9

🟢 2025-12-08 16:22:36 UTC Build successful.
🟢 2025-12-08 16:22:57 UTC ydbd size 3.8 GiB changed* by -96 Bytes, which is <= 0 Bytes vs main: OK

ydbd size dash main: fe86628 merge: 5614eb7 diff diff %
ydbd size 4 131 363 280 Bytes 4 131 363 184 Bytes -96 Bytes -0.000%
ydbd stripped size 1 533 585 400 Bytes 1 533 585 336 Bytes -64 Bytes -0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

2025-12-08 15:43:56 UTC Pre-commit check linux-x86_64-relwithdebinfo for 5614eb7 has started.
2025-12-08 15:44:13 UTC Artifacts will be uploaded here
2025-12-08 15:46:20 UTC ya make is running...
🟡 2025-12-08 16:34:01 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
6774 6629 0 2 130 13

2025-12-08 16:34:09 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-12-08 16:47:24 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
59 (only retried tests) 49 0 2 0 8

2025-12-08 16:47:31 UTC ya make is running... (failed tests rerun, try 3)
🔴 2025-12-08 16:59:40 UTC Some tests failed, follow the links below.

Ya make output | Test bloat | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
20 (only retried tests) 9 0 2 0 9

🟢 2025-12-08 16:59:47 UTC Build successful.
🟢 2025-12-08 17:00:05 UTC ydbd size 2.3 GiB changed* by 0 Bytes, which is <= 0 Bytes vs main: OK

ydbd size dash main: fe86628 merge: 5614eb7 diff diff %
ydbd size 2 467 827 848 Bytes 2 467 827 848 Bytes 0 Bytes 0.000%
ydbd stripped size 525 130 592 Bytes 525 130 592 Bytes 0 Bytes 0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@ydbot
Copy link
Collaborator

ydbot commented Dec 8, 2025

Run Extra Tests

Run additional tests for this PR. You can customize:

  • Test Size: small, medium, large (default: all)
  • Test Targets: any directory path (default: ydb/)
  • Sanitizers: ASAN, MSAN, TSAN
  • Coredumps: enable for debugging (default: off)
  • Additional args: custom ya make arguments

▶  Run tests

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

🟢 2025-12-08 15:46:33 UTC The validation of the Pull Request description is successful.

Copy link
Contributor

Copilot AI left a 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 introduces a new command-line tool called local_cluster that allows developers to run a standalone YDB cluster (ydbd) locally in their development environment. The tool simplifies local testing by starting a cluster with default ports and a MIRROR_3DC configuration.

Key Changes

  • New local_cluster Python CLI tool that wraps the existing test harness to start a local YDB cluster
  • New DefaultFirstNodePortAllocator class that assigns default ports (grpc=2135, mon=8765, ic=19001) to the first node and offset ports for additional nodes
  • Command-line interface supporting custom working directory and binary path specification

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
ydb/tests/tools/ya.make Adds local_cluster to the list of tools to be built
ydb/tests/tools/local_cluster/ya.make Build configuration for the new local_cluster Python program
ydb/tests/tools/local_cluster/main.py Main implementation of the local cluster management tool with CLI interface
ydb/tests/library/harness/kikimr_port_allocator.py Adds DefaultFirstNodePortAllocator class and default port constants to support predictable port assignment

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


def get_slot_port_allocator(self, slot_index):
# For slots, use offset starting from a large number to avoid conflicts
slot_offset = 10000 + (slot_index - 1) * PORT_OFFSET_STEP
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

[nitpick] In the slot port allocator, the offset calculation 10000 + (slot_index - 1) * PORT_OFFSET_STEP could result in port conflicts if there are many nodes. For example, if there are more than 800 nodes (8 * PORT_OFFSET_STEP = 80 added to a base port like 2135 would give 2215, and 10000 + 0 * 10 = 10000, but they'd still be separate). However, a more concerning issue is that slots starting at port 10000+ might conflict with other services. Consider documenting the expected range of node and slot counts to avoid conflicts, or using a more robust conflict avoidance strategy.

Copilot uses AI. Check for mistakes.
for node_id, node in self.cluster.nodes.items():
if not node.daemon.process.poll() is None:
logger.error("ydbd process for node %d terminated unexpectedly", node_id)
break
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The break statement on line 102 only exits the inner for loop, not the outer while True loop. When a node process terminates unexpectedly, the code logs an error but continues the infinite loop, repeatedly logging the same error message every second. Consider either exiting the method after detecting a terminated process or adding proper handling to stop the cluster.

Suggested change
break
self.stop()
sys.exit(1)

Copilot uses AI. Check for mistakes.
Comment on lines +67 to +69
error_msg = "Failed to start cluster.\n\n"
error_msg += "\nOriginal error:\n"
error_msg += str(e)
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

[nitpick] The error message construction is redundant. Line 67 says "Failed to start cluster.\n\n" followed by line 68 which adds "\nOriginal error:\n". This results in three newlines between the two parts of the message. Consider simplifying to: error_msg = "Failed to start cluster.\n\nOriginal error:\n" + str(e)

Suggested change
error_msg = "Failed to start cluster.\n\n"
error_msg += "\nOriginal error:\n"
error_msg += str(e)
error_msg = "Failed to start cluster.\n\nOriginal error:\n" + str(e)

Copilot uses AI. Check for mistakes.
# Check that processes are still alive
if self.cluster and self.cluster.nodes:
for node_id, node in self.cluster.nodes.items():
if not node.daemon.process.poll() is None:
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The comparison not node.daemon.process.poll() is None should be simplified to node.daemon.process.poll() is not None for better readability. The is not operator should come after the method call, not before None.

Suggested change
if not node.daemon.process.poll() is None:
if node.daemon.process.poll() is not None:

Copilot uses AI. Check for mistakes.
'--working-dir',
type=str,
default=None,
help='Working directory for cluster data storage (default: temporary directory)'
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The help text says "(default: temporary directory)" but the actual default is .ydbd_working_dir in the current directory (line 35). The help text should be updated to reflect this, for example: "(default: .ydbd_working_dir in current directory)".

Suggested change
help='Working directory for cluster data storage (default: temporary directory)'
help='Working directory for cluster data storage (default: .ydbd_working_dir in current directory)'

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

github-actions bot commented Dec 9, 2025

2025-12-09 09:54:57 UTC Pre-commit check linux-x86_64-relwithdebinfo for ea415f4 has started.
2025-12-09 09:55:13 UTC Artifacts will be uploaded here
2025-12-09 09:57:24 UTC ya make is running...
🟢 2025-12-09 10:43:46 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
6775 6633 0 0 130 12

🟢 2025-12-09 10:43:54 UTC Build successful.
🟡 2025-12-09 10:44:15 UTC ydbd size 2.3 GiB changed* by +236.1 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 059973d merge: ea415f4 diff diff %
ydbd size 2 466 721 552 Bytes 2 466 963 288 Bytes +236.1 KiB +0.010%
ydbd stripped size 524 960 640 Bytes 525 013 952 Bytes +52.1 KiB +0.010%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

2025-12-09 09:55:13 UTC Pre-commit check linux-x86_64-release-asan for ea415f4 has started.
2025-12-09 09:55:30 UTC Artifacts will be uploaded here
2025-12-09 09:57:42 UTC ya make is running...
🟡 2025-12-09 10:39:25 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1837 1810 0 12 6 9

🟢 2025-12-09 10:39:32 UTC Build successful.
🟡 2025-12-09 10:39:53 UTC ydbd size 3.8 GiB changed* by +392.0 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 059973d merge: ea415f4 diff diff %
ydbd size 4 130 791 632 Bytes 4 131 193 040 Bytes +392.0 KiB +0.010%
ydbd stripped size 1 533 426 776 Bytes 1 533 582 168 Bytes +151.8 KiB +0.010%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

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.

2 participants