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

rework olap_workload #12870

Merged
merged 6 commits into from
Dec 24, 2024
Merged

Conversation

zverevgeny
Copy link
Collaborator

@zverevgeny zverevgeny commented Dec 23, 2024

Changelog entry

Load test for column tables
...

Changelog category

  • Not for changelog (changelog entry is not required)

Additional information

...

Copy link

github-actions bot commented Dec 23, 2024

2024-12-23 06:02:07 UTC Pre-commit check linux-x86_64-relwithdebinfo for bbf7937 has started.
2024-12-23 06:02:18 UTC Artifacts will be uploaded here
2024-12-23 06:04:50 UTC ya make is running...
🟢 2024-12-23 06:05:28 UTC Tests successful.

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
8 8 0 0 0 0

🟢 2024-12-23 06:05:34 UTC Build successful.

Copy link

github-actions bot commented Dec 23, 2024

2024-12-23 06:02:38 UTC Pre-commit check linux-x86_64-release-asan for bbf7937 has started.
2024-12-23 06:02:48 UTC Artifacts will be uploaded here
2024-12-23 06:05:19 UTC ya make is running...
🟢 2024-12-23 06:06:11 UTC Tests successful.

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
4 4 0 0 0 0

🟢 2024-12-23 06:06:17 UTC Build successful.

if self.use_query_service():
return self.session_pool.execute_with_retries(statement)
else:
if ddl:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Мне кажется какой-то нестройный подход: типа я бы понял, если бы ddl полностью поддерживался в этой функции, но у тебя появилась функция "drop_table".

Может проще было бы удалить аргумент ddl из этого метода и просто завести отдельный метод create_table? Оно хотя бы расширяемо будет

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Не уверен, что это нужно. Поэтому пока оставил TODO


def _generate_new_table_n(self):
while True:
r = random.randint(1, 40000)
Copy link
Collaborator

Choose a reason for hiding this comment

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

А зачем числа? Мне кажется проще использовать random_string(..)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Мне с числами удобнее. Их проще держать в голове при отладке

Copy link
Collaborator

Choose a reason for hiding this comment

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

Я не возражаю иметь числовые идентификаторы, но ты в self.tables все таки строки храни имхо

n = self._get_existing_table_n()
if n is None:
print("create_drop: No tables to delete")
time.sleep(10)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Мне кажется слип слишком большой, наверное мы не хотим такие большие тормоза на джоине треда видеть, предлагаю написать 0.1 например

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Тут идея была в том, чтобы накопить какое-то кол-вон созданных таблиц, когда их кол-во снизилось до 0

n = self._generate_new_table_n()
self.create_table(str(n))
with self.lock:
self.tables.add(n)
Copy link
Collaborator

Choose a reason for hiding this comment

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

А зачем в self.tables хранить какие то числа, а не просто пути до таблиц? Предлагаю просто строчки хранить

Copy link

github-actions bot commented Dec 23, 2024

2024-12-23 09:43:14 UTC Pre-commit check linux-x86_64-relwithdebinfo for e6bd3a5 has started.
2024-12-23 09:43:25 UTC Artifacts will be uploaded here
2024-12-23 09:44:21 UTC Check cancelled

Copy link

github-actions bot commented Dec 23, 2024

2024-12-23 09:43:50 UTC Pre-commit check linux-x86_64-release-asan for e6bd3a5 has started.
2024-12-23 09:44:02 UTC Artifacts will be uploaded here
2024-12-23 09:44:21 UTC Check cancelled

Copy link

github-actions bot commented Dec 23, 2024

2024-12-23 09:45:50 UTC Pre-commit check linux-x86_64-release-asan for 75978c3 has started.
2024-12-23 09:46:01 UTC Artifacts will be uploaded here
2024-12-23 09:48:24 UTC ya make is running...
🟡 2024-12-23 09:49:32 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
4 3 0 1 0 0

🟢 2024-12-23 09:49:38 UTC Build successful.

Copy link

github-actions bot commented Dec 23, 2024

2024-12-23 09:46:10 UTC Pre-commit check linux-x86_64-relwithdebinfo for 75978c3 has started.
2024-12-23 09:46:21 UTC Artifacts will be uploaded here
2024-12-23 09:48:43 UTC ya make is running...
🟡 2024-12-23 09:49:40 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
8 7 0 1 0 0

2024-12-23 09:49:47 UTC ya make is running... (failed tests rerun, try 2)
🟡 2024-12-23 09:50:10 UTC Some tests failed, follow the links below. Going to retry failed tests...

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

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

2024-12-23 09:50:18 UTC ya make is running... (failed tests rerun, try 3)
🔴 2024-12-23 09:50:41 UTC Some tests failed, follow the links below.

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

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

🟢 2024-12-23 09:50:47 UTC Build successful.

print("create_drop: No tables to delete")
time.sleep(10)
continue
self.client.drop_table(self.get_table_path(str(n)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

У тебя как будто не проверяются фэйлы нигде

Если дроп тэйбл сфэйлит, то тред просто умрет и перестанет работать

Посмотри как сделано в simple_queue: там все ошибки попадают в стату, мне кажется надо сделать так же в get_stat (видимо код переиспользовать)

Я просто подозреваю, что по причине отсутствия обработки ошибок ворклоад проработает условные полчаса и перестанет генерить запросы

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Я исхожу из того, что все ошибки должны ретраится SDK. Если это не помогло, то тест должен упасть

Copy link
Collaborator

Choose a reason for hiding this comment

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

Я некоторое время думал про это, и пришел к выводу, что кажется, если хочешь падать, то мне кажется лучше это сделать через отдельную опцию

В текущем состоянии мне кажется это не требуется, пусть это будет следующим шагом

Copy link
Collaborator

Choose a reason for hiding this comment

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

И как будто все равно нет перехвата исключений

workload.run()
client = YdbClient(args.endpoint, args.database, True)
client.wait_connection()
with WorkloadRunner(client, "olap_workload", args.duration) as runner:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Посмотри как сделано в simple_queue: там зашивается имя хоста в префикс пути таблицы, мне кажется тут так же надо сделать, чтобы разные запуски ворклоадов не пересекались

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

вынес в аргументы командной строки. При желании можно разделять разные запуски на одной базе

self.select_n(table_name, 300)
actual = self.client.query(
f"""
select count(*) as cnt, sum(i64Val) as vals, sum(id) as ids FROM `{table_path}`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Может все таки в upper case как в других местах?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

поправил

)[0].rows[0]
expected = {"cnt": i, "vals": i * (i + 1) * 5, "ids": i * (i + 1)}
if actual != expected:
raise f"Incorrect result: expected:{expected}, actual:{actual}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Оно рейзится и не обрабатывается, после чего тред просто умирает, кажется не должно так работать

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Добавил перехват исключений в код базового класча

parser.add_argument('--batch_size', default=1000, help='Batch size for bulk insert')
parser.add_argument('--endpoint', default='localhost:2136', help="An endpoint to be used")
parser.add_argument('--database', default='Root/test', help='A database to connect')
parser.add_argument('--duration', default=10, type=lambda x: int(x), help='A duration of workload in seconds.')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Предлагаю дефолтный duration оставить как было: 10 ** 9

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

def query(self, statement, is_ddl):
if self.use_query_service:
return self.session_pool.execute_with_retries(statement)
else:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Синтаксическая красивость, оператор elif.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Я про нею знаю, но в данном случае, мне нравится больше этот спсобо, т.к. он структурно более выразительный

Comment on lines +46 to +67
def _remove_recursively(self, path):
deleted = 0
d = self.driver.scheme_client.list_directory(path)
for entry in d.children:
entry_path = "/".join([path, entry.name])
if entry.is_directory():
deleted += self._remove_recursively(entry_path)
elif entry.is_column_table() or entry.is_table():
self.drop_table(entry_path)
deleted += 1
else:
raise f"Scheme entry {entry_path} of unexpected type"
self.driver.scheme_client.remove_directory(path)
return deleted

def remove_recursively(self, path):
d = self.describe(path)
if d is None:
return
if not d.is_directory():
raise f"{path} has unexpected type"
return self._remove_recursively(path)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Есть ощущение, что это у нас написано уже в нескольких местах. Например вот тут. Предлагаю переиспользовать. Возможно это вообще затащить в sdk.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Тут весь раннер - это переписывание аналогов. Нужно бы их как-то смёрджить. Но не в рамках этого PR

Copy link

github-actions bot commented Dec 23, 2024

2024-12-23 12:09:08 UTC Pre-commit check linux-x86_64-release-asan for 9ebbcbd has started.
2024-12-23 12:09:16 UTC Artifacts will be uploaded here
2024-12-23 12:11:44 UTC ya make is running...
🟡 2024-12-23 12:13:21 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
4 3 0 1 0 0

🟢 2024-12-23 12:13:28 UTC Build successful.

Copy link

github-actions bot commented Dec 23, 2024

2024-12-23 12:11:22 UTC Pre-commit check linux-x86_64-relwithdebinfo for 9ebbcbd has started.
2024-12-23 12:11:30 UTC Artifacts will be uploaded here
2024-12-23 12:14:01 UTC ya make is running...
🟡 2024-12-23 12:15:12 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
8 7 0 1 0 0

2024-12-23 12:15:20 UTC ya make is running... (failed tests rerun, try 2)
🟡 2024-12-23 12:15:54 UTC Some tests failed, follow the links below. Going to retry failed tests...

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

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

2024-12-23 12:16:01 UTC ya make is running... (failed tests rerun, try 3)
🔴 2024-12-23 12:16:30 UTC Some tests failed, follow the links below.

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

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

🟢 2024-12-23 12:16:37 UTC Build successful.

Copy link

github-actions bot commented Dec 23, 2024

2024-12-23 14:11:24 UTC Pre-commit check linux-x86_64-release-asan for afec54d has started.
2024-12-23 14:11:48 UTC Artifacts will be uploaded here
2024-12-23 14:14:27 UTC ya make is running...
🟡 2024-12-23 14:15:45 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
4 3 0 1 0 0

🟢 2024-12-23 14:15:52 UTC Build successful.

Copy link

github-actions bot commented Dec 23, 2024

2024-12-23 14:13:44 UTC Pre-commit check linux-x86_64-relwithdebinfo for afec54d has started.
2024-12-23 14:13:56 UTC Artifacts will be uploaded here
2024-12-23 14:16:28 UTC ya make is running...
🟡 2024-12-23 14:17:32 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
8 7 0 1 0 0

2024-12-23 14:17:40 UTC ya make is running... (failed tests rerun, try 2)
🟡 2024-12-23 14:22:35 UTC Some tests failed, follow the links below. Going to retry failed tests...

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

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

2024-12-23 14:22:43 UTC ya make is running... (failed tests rerun, try 3)
🔴 2024-12-23 14:23:31 UTC Some tests failed, follow the links below.

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

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

🟢 2024-12-23 14:23:39 UTC Build successful.

Copy link

github-actions bot commented Dec 24, 2024

2024-12-24 08:48:05 UTC Pre-commit check linux-x86_64-relwithdebinfo for 9fce4f7 has started.
2024-12-24 08:48:35 UTC Artifacts will be uploaded here
2024-12-24 08:51:30 UTC ya make is running...
🟢 2024-12-24 08:52:12 UTC Tests successful.

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
8 8 0 0 0 0

🟢 2024-12-24 08:52:18 UTC Build successful.

Copy link

github-actions bot commented Dec 24, 2024

2024-12-24 08:48:33 UTC Pre-commit check linux-x86_64-release-asan for 9fce4f7 has started.
2024-12-24 08:50:41 UTC Artifacts will be uploaded here
2024-12-24 08:53:43 UTC ya make is running...
🟢 2024-12-24 08:54:35 UTC Tests successful.

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
4 4 0 0 0 0

🟢 2024-12-24 08:54:41 UTC Build successful.

Copy link
Collaborator

@maximyurchuk maximyurchuk left a comment

Choose a reason for hiding this comment

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

Предлагаю залить как есть, позже поправлю на свой вкус

@zverevgeny zverevgeny merged commit c35f002 into ydb-platform:main Dec 24, 2024
12 checks passed
zverevgeny added a commit to zverevgeny/ydb that referenced this pull request Jan 2, 2025
Conflicts:
	ydb/tools/olap_workload/__main__.py
zverevgeny added a commit to zverevgeny/ydb that referenced this pull request Jan 5, 2025
Conflicts:
	ydb/tools/olap_workload/__main__.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants