17
17
18
18
namespace NKikimr ::Tests::NCS {
19
19
20
- void THelperSchemaless::CreateTestOlapStore (TActorId sender, TString scheme) {
21
- NKikimrSchemeOp::TColumnStoreDescription store;
22
- UNIT_ASSERT (::google::protobuf::TextFormat::ParseFromString (scheme, &store));
23
-
20
+ void THelperSchemaless::ExecuteModifyScheme (NKikimrSchemeOp::TModifyScheme& modifyScheme) {
24
21
auto request = std::make_unique<TEvTxUserProxy::TEvProposeTransaction>();
25
22
request->Record .SetExecTimeoutPeriod (Max<ui64>());
26
- auto * op = request->Record .MutableTransaction ()->MutableModifyScheme ();
27
- op->SetOperationType (NKikimrSchemeOp::EOperationType::ESchemeOpCreateColumnStore);
28
- op->SetWorkingDir (ROOT_PATH);
29
- op->MutableCreateColumnStore ()->CopyFrom (store);
30
-
23
+ *request->Record .MutableTransaction ()->MutableModifyScheme () = modifyScheme;
24
+ TActorId sender = Server.GetRuntime ()->AllocateEdgeActor ();
31
25
Server.GetRuntime ()->Send (new IEventHandle (MakeTxProxyID (), sender, request.release ()));
32
26
auto ev = Server.GetRuntime ()->GrabEdgeEventRethrow <TEvTxUserProxy::TEvProposeTransactionStatus>(sender);
33
27
Cerr << ev->Get ()->Record .DebugString () << Endl;
@@ -37,29 +31,29 @@ void THelperSchemaless::CreateTestOlapStore(TActorId sender, TString scheme) {
37
31
WaitForSchemeOperation (sender, txId);
38
32
}
39
33
40
- void THelperSchemaless::CreateTestOlapTable (TActorId sender, TString storeOrDirName, TString scheme) {
34
+ void THelperSchemaless::CreateTestOlapStore (TString scheme) {
35
+ NKikimrSchemeOp::TColumnStoreDescription store;
36
+ UNIT_ASSERT (::google::protobuf::TextFormat::ParseFromString (scheme, &store));
37
+ NKikimrSchemeOp::TModifyScheme op;
38
+ op.SetOperationType (NKikimrSchemeOp::EOperationType::ESchemeOpCreateColumnStore);
39
+ op.SetWorkingDir (ROOT_PATH);
40
+ op.MutableCreateColumnStore ()->CopyFrom (store);
41
+ ExecuteModifyScheme (op);
42
+ }
43
+
44
+ void THelperSchemaless::CreateTestOlapTable (TString storeOrDirName, TString scheme) {
41
45
NKikimrSchemeOp::TColumnTableDescription table;
42
46
UNIT_ASSERT (::google::protobuf::TextFormat::ParseFromString (scheme, &table));
43
- auto request = std::make_unique<TEvTxUserProxy::TEvProposeTransaction>();
44
- request->Record .SetExecTimeoutPeriod (Max<ui64>());
45
-
46
47
TString workingDir = ROOT_PATH;
47
48
if (!storeOrDirName.empty ()) {
48
49
workingDir += " /" + storeOrDirName;
49
50
}
50
51
51
- auto * op = request->Record .MutableTransaction ()->MutableModifyScheme ();
52
- op->SetOperationType (NKikimrSchemeOp::EOperationType::ESchemeOpCreateColumnTable);
53
- op->SetWorkingDir (workingDir);
54
- op->MutableCreateColumnTable ()->CopyFrom (table);
55
-
56
- Server.GetRuntime ()->Send (new IEventHandle (MakeTxProxyID (), sender, request.release ()));
57
- auto ev = Server.GetRuntime ()->GrabEdgeEventRethrow <TEvTxUserProxy::TEvProposeTransactionStatus>(sender);
58
- ui64 txId = ev->Get ()->Record .GetTxId ();
59
- auto status = ev->Get ()->Record .GetStatus ();
60
- Cerr << ev->Get ()->Record .DebugString () << Endl;
61
- UNIT_ASSERT (status != TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecError);
62
- WaitForSchemeOperation (sender, txId);
52
+ NKikimrSchemeOp::TModifyScheme op;
53
+ op.SetOperationType (NKikimrSchemeOp::EOperationType::ESchemeOpCreateColumnTable);
54
+ op.SetWorkingDir (workingDir);
55
+ op.MutableCreateColumnTable ()->CopyFrom (table);
56
+ ExecuteModifyScheme (op);
63
57
}
64
58
65
59
void THelperSchemaless::SendDataViaActorSystem (TString testTable, std::shared_ptr<arrow::RecordBatch> batch, const Ydb::StatusIds_StatusCode& expectedStatus) const {
@@ -200,8 +194,7 @@ TString THelper::GetTestTableSchema() const {
200
194
}
201
195
202
196
void THelper::CreateSchemaOlapTablesWithStore (const TString tableSchema, TVector<TString> tableNames /* = "olapTable"*/ , TString storeName /* = "olapStore"*/ , ui32 storeShardsCount /* = 4*/ , ui32 tableShardsCount /* = 3*/ ) {
203
- TActorId sender = Server.GetRuntime ()->AllocateEdgeActor ();
204
- CreateTestOlapStore (sender, Sprintf (R"(
197
+ CreateTestOlapStore (Sprintf (R"(
205
198
Name: "%s"
206
199
ColumnShardCount: %d
207
200
SchemaPresets {
@@ -215,7 +208,7 @@ void THelper::CreateSchemaOlapTablesWithStore(const TString tableSchema, TVector
215
208
const TString shardingColumns = " [\" " + JoinSeq (" \" ,\" " , GetShardingColumns ()) + " \" ]" ;
216
209
217
210
for (const TString& tableName : tableNames) {
218
- TBase::CreateTestOlapTable (sender, storeName, Sprintf (R"(
211
+ TBase::CreateTestOlapTable (storeName, Sprintf (R"(
219
212
Name: "%s"
220
213
ColumnShardCount: %d
221
214
Sharding {
@@ -232,12 +225,10 @@ void THelper::CreateOlapTablesWithStore(TVector<TString> tableNames /*= {"olapTa
232
225
}
233
226
234
227
void THelper::CreateSchemaOlapTables (const TString tableSchema, TVector<TString> tableNames, ui32 tableShardsCount) {
235
- TActorId sender = Server.GetRuntime ()->AllocateEdgeActor ();
236
-
237
228
const TString shardingColumns = " [\" " + JoinSeq (" \" ,\" " , GetShardingColumns ()) + " \" ]" ;
238
229
239
230
for (const TString& tableName : tableNames) {
240
- TBase::CreateTestOlapTable (sender, " " , Sprintf (R"(
231
+ TBase::CreateTestOlapTable (" " , Sprintf (R"(
241
232
Name: "%s"
242
233
ColumnShardCount: %d
243
234
Sharding {
0 commit comments