Skip to content

Commit 79898e6

Browse files
authored
TESTOWNERS and migration to column shard (#7733)
1 parent d21cb12 commit 79898e6

7 files changed

+555
-204
lines changed

.github/TESTOWNERS

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# TEAM:@ydb-platform/docs
2+
/*.md @ydb-platform/docs
3+
/ydb/docs/ @ydb-platform/docs
4+
5+
# YQL @ydb-platform/yql
6+
/ydb/library/yql/ @ydb-platform/yql
7+
/ydb/library/yql/dq @ydb-platform/yql @ydb-platform/qp
8+
/ydb/library/yql/yt @Krock21 @Krisha11 @zlobober @gritukan
9+
10+
#TEAM:@ydb-platform/Topics
11+
/ydb/core/kafka_proxy @ydb-platform/Topics
12+
/ydb/core/persqueue @ydb-platform/Topics
13+
/ydb/services/datastreams @ydb-platform/Topics
14+
/ydb/services/deprecated/persqueue_v0 @ydb-platform/Topics
15+
/ydb/services/persqueue_v1 @ydb-platform/Topics
16+
17+
#Группа разработки строковых таблиц @azevaykin TEAM:?
18+
/ydb/core/tablet_flat @azevaykin
19+
/ydb/core/tx/datashard @azevaykin
20+
/ydb/core/mon_alloc @azevaykin
21+
22+
# Сoordinator
23+
/ydb/core/tx/coordinator @snaury
24+
25+
#Группа распределенной системной инфраструктуры @ijon TEAM:?
26+
/ydb/core/mind/ @ijon
27+
/ydb/core/blob_depot @ijon
28+
/ydb/core/tx/schemeshard @ijon
29+
/ydb/core/tx/columnshard @ivanmorozov333
30+
/ydb/services/ydb/ @ijon
31+
/ydb/core/util @ijon
32+
/ydb/core/persqueue @ijon
33+
/ydb/core/client @ijon
34+
/ydb/core/engine @ijon
35+
36+
#YDB Query Execution Team @gridnevvvit TEAM:@ydb-platform/qp
37+
/ydb/core/kqp @ydb-platform/qp
38+
39+
#YDB Application Team @asmyasnikov TEAM:?
40+
/ydb/public/sdk @asmyasnikov
41+
/ydb/tests/functional/ydb_cli @asmyasnikov
42+
/ydb/public/lib/ydb_cli @asmyasnikov
43+
44+
#YDB Query Optimizer Team @pavelvelikhov TEAM:???
45+
/ydb/tests/functional/canonical @pavelvelikhov
46+
47+
48+
#YDB Engineering Team @maximyurchuk
49+
# - пока не понятно
50+
51+
#Группа разработки распределенного хранилища @the-ancient-1 TEAM:???
52+
/ydb/core/blobstorage @the-ancient-1
53+
/ydb/core/mind/bscontroller @the-ancient-1
54+
55+
#Группа функциональности ядра @CyberROFL TEAM:@ydb-platform/core
56+
57+
/ydb/core/config/ut @ydb-platform/core
58+
/ydb/core/scheme @ydb-platform/core
59+
/ydb/core/cms @ydb-platform/core
60+
/ydb/tests/functional/cms @ydb-platform/core
61+
62+
63+
#Группа разработки систем поставки данных / LogBroker @alexnick88 TEAM:???
64+
/ydb/tests/functional/sqs
65+
66+
#YDB Analytics TEAM:???
67+
68+
#Federative query TEAM:@ydb-platform/fq
69+
/ydb/tests/fq @ydb-platform/fq
70+
/ydb/core/fq/ @ydb-platform/fq
71+
/ydb/services/fq/ @ydb-platform/fq
72+
/ydb/library/yql/providers/common/http_gateway @ydb-platform/fq
73+
/ydb/library/yql/providers/common/db_id_async_resolver @ydb-platform/fq
74+
/ydb/library/yql/providers/generic @ydb-platform/fq
75+
/ydb/library/yql/providers/pq @ydb-platform/fq
76+
/ydb/library/yql/providers/s3 @ydb-platform/fq
77+
/ydb/library/yql/providers/solomon @ydb-platform/fq
78+
/ydb/core/public_http/ @ydb-platform/fq
79+
80+
#@ydb-platform/ui-backend
81+
/ydb/core/viewer @ydb-platform/ui-backend
82+
/ydb/core/protos/node_whiteboard.proto @ydb-platform/ui-backend
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# NOT USED ANYWHERE, YOU CAN DELETE THIS IF YOU KNOW WHAT ARE YOU DOING
2+
import os
3+
import csv
4+
import urllib.parse
5+
6+
# Функция для декодирования percent-encoded строки
7+
def decode_percent_encoded_string(encoded_string):
8+
return urllib.parse.unquote(encoded_string)
9+
10+
# Функция для декодирования CSV файла
11+
def decode_csv(file_path):
12+
with open(file_path, mode='r', encoding='utf-8') as infile, open(file_path + '.decoded', mode='w', encoding='utf-8', newline='') as outfile:
13+
reader = csv.reader(infile)
14+
writer = csv.writer(outfile,escapechar='\\', quotechar='"', quoting=csv.QUOTE_ALL, doublequote=True)
15+
16+
for row in reader:
17+
decoded_row = [decode_percent_encoded_string(cell) for cell in row]
18+
writer.writerow(decoded_row)
19+
20+
# Функция для обработки всех CSV файлов в директории
21+
def decode_all_csv_files_in_directory(directory_path):
22+
for filename in os.listdir(directory_path):
23+
if filename.endswith('.csv'):
24+
file_path = os.path.join(directory_path, filename)
25+
print(f"Processing file: {file_path}")
26+
decode_csv(file_path)
27+
os.replace(file_path + '.decoded', file_path)
28+
29+
def main():
30+
directory_path = 'place_your_path_here'
31+
decode_all_csv_files_in_directory(directory_path)
32+
33+
34+
if __name__ == "__main__":
35+
main()

.github/scripts/analytics/flaky_tests_history.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def main():
151151
DISTINCT suite_folder || '/' || test_name as full_name,
152152
suite_folder,
153153
test_name
154-
from `test_results/test_runs_results`
154+
from `test_results/test_runs_column`
155155
where
156156
status in ('failure','mute')
157157
and job_name in ('Nightly-run', 'Postcommit_relwithdebinfo')
@@ -161,7 +161,7 @@ def main():
161161
cross join (
162162
select
163163
DISTINCT DateTime::MakeDate(run_timestamp) as date_base
164-
from `test_results/test_runs_results`
164+
from `test_results/test_runs_column`
165165
where
166166
status in ('failure','mute')
167167
and job_name in ('Nightly-run', 'Postcommit_relwithdebinfo')
@@ -176,7 +176,7 @@ def main():
176176
run_timestamp,
177177
status
178178
--ROW_NUMBER() OVER (PARTITION BY test_name ORDER BY run_timestamp DESC) AS rn
179-
from `test_results/test_runs_results`
179+
from `test_results/test_runs_column`
180180
where
181181
run_timestamp >= Date('{last_date}') -{history_for_n_day}*Interval("P1D") and
182182
job_name in ('Nightly-run', 'Postcommit_relwithdebinfo')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
#!/bin/bash
3+
# NOT USED ANYWHERE, YOU CAN DELETE THIS IF YOU KNOW WHAT ARE YOU DOING
4+
# Параметры подключения к YDB
5+
ENDPOINT="grpcs://lb.etnvsjbk7kh1jc6bbfi8.ydb.mdb.yandexcloud.net:2135"
6+
DATABASE="/ru-central1/b1ggceeul2pkher8vhb6/etnvsjbk7kh1jc6bbfi8"
7+
SA_KEY_FILE="/home/kirrysin/fork_2/.github/scripts/my-robot-key.json"
8+
TABLE="test_results/test_runs_column"
9+
DIRECTORY="/home/kirrysin/fork_2/~tmp_backup/test_runs_results"
10+
11+
# Обрабатываем каждый .csv файл в указанной директории
12+
for FILE in "$DIRECTORY"/*.csv; do
13+
if [[ -f "$FILE" ]]; then
14+
echo "Импортируем файл: $FILE"
15+
16+
ydb -e "$ENDPOINT" \
17+
-d "$DATABASE" \
18+
--sa-key-file "$SA_KEY_FILE" \
19+
import file csv \
20+
-p "$TABLE" \
21+
"$FILE"
22+
23+
if [[ $? -eq 0 ]]; then
24+
echo "Импорт файла $FILE успешно завершен."
25+
else
26+
echo "Ошибка при импорте файла $FILE." >&2
27+
exit 1
28+
fi
29+
fi
30+
done
31+
32+
echo "Импорт всех файлов завершен."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
#!/usr/bin/env python3
2+
# NOT USED ANYWHERE, YOU CAN DELETE THIS IF YOU KNOW WHAT ARE YOU DOING
3+
import argparse
4+
import configparser
5+
import datetime
6+
import os
7+
import posixpath
8+
import traceback
9+
import time
10+
import ydb
11+
from collections import Counter
12+
13+
dir = os.path.dirname(__file__)
14+
config = configparser.ConfigParser()
15+
config_file_path = f"{dir}/../../config/ydb_qa_db.ini"
16+
config.read(config_file_path)
17+
18+
build_preset = os.environ.get("build_preset")
19+
branch = os.environ.get("branch_to_compare")
20+
21+
DATABASE_ENDPOINT = config["QA_DB"]["DATABASE_ENDPOINT"]
22+
DATABASE_PATH = config["QA_DB"]["DATABASE_PATH"]
23+
24+
25+
def create_tables(pool, table_path):
26+
print(f"> create table: {table_path}")
27+
28+
def callee(session):
29+
session.execute_scheme(f"""
30+
CREATE table IF NOT EXISTS`{table_path}` (
31+
branch Utf8 NOT NULL,
32+
build_type Utf8 NOT NULL,
33+
commit Utf8 NOT NULL,
34+
duration Double,
35+
job_id Uint64,
36+
job_name Utf8,
37+
log Utf8,
38+
logsdir Utf8,
39+
owners Utf8,
40+
pull Utf8,
41+
run_timestamp Timestamp NOT NULL,
42+
status_description Utf8,
43+
status Utf8 NOT NULL,
44+
stderr Utf8,
45+
stdout Utf8,
46+
suite_folder Utf8 NOT NULL,
47+
test_id Utf8 NOT NULL,
48+
test_name Utf8 NOT NULL,
49+
PRIMARY KEY (`test_name`, `suite_folder`,build_type, status, run_timestamp)
50+
)
51+
PARTITION BY HASH(`test_name`, `suite_folder`, branch, build_type )
52+
WITH (STORE = COLUMN)
53+
""")
54+
55+
return pool.retry_operation_sync(callee)
56+
57+
58+
def bulk_upsert(table_client, table_path, rows):
59+
print(f"> bulk upsert: {table_path}")
60+
column_types = (
61+
ydb.BulkUpsertColumns()
62+
.add_column("branch", ydb.OptionalType(ydb.PrimitiveType.Utf8))
63+
.add_column("build_type", ydb.OptionalType(ydb.PrimitiveType.Utf8))
64+
.add_column("commit", ydb.OptionalType(ydb.PrimitiveType.Utf8))
65+
.add_column("duration", ydb.OptionalType(ydb.PrimitiveType.Double))
66+
.add_column("job_id", ydb.OptionalType(ydb.PrimitiveType.Uint64))
67+
.add_column("job_name", ydb.OptionalType(ydb.PrimitiveType.Utf8))
68+
.add_column("log", ydb.OptionalType(ydb.PrimitiveType.Utf8))
69+
.add_column("logsdir", ydb.OptionalType(ydb.PrimitiveType.Utf8))
70+
.add_column("owners", ydb.OptionalType(ydb.PrimitiveType.Utf8))
71+
.add_column("pull", ydb.OptionalType(ydb.PrimitiveType.Utf8))
72+
.add_column("run_timestamp", ydb.OptionalType(ydb.PrimitiveType.Timestamp))
73+
.add_column("status", ydb.OptionalType(ydb.PrimitiveType.Utf8))
74+
.add_column("status_description", ydb.OptionalType(ydb.PrimitiveType.Utf8))
75+
.add_column("stderr", ydb.OptionalType(ydb.PrimitiveType.Utf8))
76+
.add_column("stdout", ydb.OptionalType(ydb.PrimitiveType.Utf8))
77+
.add_column("suite_folder", ydb.OptionalType(ydb.PrimitiveType.Utf8))
78+
.add_column("test_id", ydb.OptionalType(ydb.PrimitiveType.Utf8))
79+
.add_column("test_name", ydb.OptionalType(ydb.PrimitiveType.Utf8))
80+
81+
)
82+
table_client.bulk_upsert(table_path, rows, column_types)
83+
84+
85+
def main():
86+
87+
88+
89+
if "CI_YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS" not in os.environ:
90+
print(
91+
"Error: Env variable CI_YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS is missing, skipping"
92+
)
93+
return 1
94+
else:
95+
# Do not set up 'real' variable from gh workflows because it interfere with ydb tests
96+
# So, set up it locally
97+
os.environ["YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS"] = os.environ[
98+
"CI_YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS"
99+
]
100+
with ydb.Driver(
101+
endpoint=DATABASE_ENDPOINT,
102+
database=DATABASE_PATH,
103+
credentials=ydb.credentials_from_env_variables(),
104+
) as driver:
105+
driver.wait(timeout=10, fail_fast=True)
106+
session = ydb.retry_operation_sync(
107+
lambda: driver.table_client.session().create()
108+
)
109+
110+
# settings, paths, consts
111+
tc_settings = ydb.TableClientSettings().with_native_date_in_result_sets(enabled=True)
112+
table_client = ydb.TableClient(driver, tc_settings)
113+
114+
table_path = 'test_results/test_runs_column'
115+
116+
with ydb.SessionPool(driver) as pool:
117+
create_tables(pool, table_path)
118+
119+
120+
# geting last timestamp from runs column
121+
default_start_date = datetime.datetime(2024, 7, 1)
122+
last_date_query = f"select max(run_timestamp) as last_run_timestamp from `{table_path}`"
123+
query = ydb.ScanQuery(last_date_query, {})
124+
it = table_client.scan_query(query)
125+
results = []
126+
start_time = time.time()
127+
while True:
128+
try:
129+
result = next(it)
130+
results = results + result.result_set.rows
131+
except StopIteration:
132+
break
133+
134+
end_time = time.time()
135+
print(f"transaction 'geting last timestamp from runs column' duration: {end_time - start_time}")
136+
137+
if results[0] and results[0].get( 'max_date_window', default_start_date) is not None:
138+
last_date = results[0].get(
139+
'max_date_window', default_start_date).strftime("%Y-%m-%dT%H:%M:%SZ")
140+
141+
else:
142+
last_date = ddefault_start_date.strftime("%Y-%m-%dT%H:%M:%SZ")
143+
print(f'last run_datetime in table : {last_date}')
144+
# geting timestamp list from runs
145+
last_date_query = f"""select distinct run_timestamp from `test_results/test_runs_results`
146+
where run_timestamp >=Timestamp('{last_date}')"""
147+
query = ydb.ScanQuery(last_date_query, {})
148+
it = table_client.scan_query(query)
149+
timestamps = []
150+
start_time = time.time()
151+
while True:
152+
try:
153+
result = next(it)
154+
timestamps = timestamps + result.result_set.rows
155+
except StopIteration:
156+
break
157+
end_time = time.time()
158+
print(f"transaction 'geting timestamp list from runs' duration: {end_time - start_time}")
159+
print(f'count of timestamps : {len(timestamps)}')
160+
for ts in timestamps:
161+
# getting history for dates >= last_date
162+
query_get_runs = f"""
163+
select * from `test_results/test_runs_results`
164+
where run_timestamp = cast({ts['run_timestamp']} as Timestamp)
165+
"""
166+
query = ydb.ScanQuery(query_get_runs, {})
167+
# start transaction time
168+
start_time = time.time()
169+
it = driver.table_client.scan_query(query)
170+
# end transaction time
171+
172+
results = []
173+
prepared_for_update_rows = []
174+
while True:
175+
try:
176+
result = next(it)
177+
results = results + result.result_set.rows
178+
except StopIteration:
179+
break
180+
end_time = time.time()
181+
print(f'transaction duration: {end_time - start_time}')
182+
183+
print(f'runs data captured, {len(results)} rows')
184+
for row in results:
185+
prepared_for_update_rows.append({
186+
'branch': row['branch'],
187+
'build_type': row['build_type'],
188+
'commit': row['commit'],
189+
'duration': row['duration'],
190+
'job_id': row['job_id'],
191+
'job_name': row['job_name'],
192+
'log': row['log'],
193+
'logsdir': row['logsdir'],
194+
'owners': row['owners'],
195+
'pull': row['pull'],
196+
'run_timestamp': row['run_timestamp'],
197+
'status_description': row['status_description'],
198+
'status': row['status'],
199+
'stderr': row['stderr'],
200+
'stdout': row['stdout'],
201+
'suite_folder': row['suite_folder'],
202+
'test_id': row['test_id'],
203+
'test_name': row['test_name'],
204+
})
205+
print('upserting runs')
206+
with ydb.SessionPool(driver) as pool:
207+
208+
full_path = posixpath.join(DATABASE_PATH, table_path)
209+
bulk_upsert(driver.table_client, full_path,
210+
prepared_for_update_rows)
211+
212+
print('history updated')
213+
214+
215+
if __name__ == "__main__":
216+
main()

0 commit comments

Comments
 (0)