1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include "table_settings.h"
namespace NKikimr {
namespace NGRpcService {
bool FillCreateTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
const Ydb::Table::CreateTableRequest& in, const NGRpcService::TTableProfiles& profiles,
Ydb::StatusIds::StatusCode& code, TString& error, TList<TString>& warnings) {
bool tableProfileSet = false;
if (in.has_profile()) {
const auto& profile = in.profile();
tableProfileSet = profile.preset_name() || profile.has_compaction_policy() || profile.has_execution_policy()
|| profile.has_partitioning_policy() || profile.has_storage_policy() || profile.has_replication_policy()
|| profile.has_caching_policy();
}
auto &partitionConfig = *out.MutablePartitionConfig();
if (!in.compaction_policy().empty()) {
if (tableProfileSet) {
MEWarning("CompactionPolicy", warnings);
}
if (!profiles.ApplyCompactionPolicy(in.compaction_policy(), partitionConfig, code, error)) {
return false;
}
}
return NKikimr::FillCreateTableSettingsDesc(out, in, code, error, warnings, tableProfileSet);
}
bool FillAlterTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
const Ydb::Table::AlterTableRequest& in, const NGRpcService::TTableProfiles& profiles,
Ydb::StatusIds::StatusCode& code, TString& error, const TAppData* appData) {
bool changed = false;
auto &partitionConfig = *out.MutablePartitionConfig();
if (in.set_compaction_policy()) {
if (!profiles.ApplyCompactionPolicy(in.set_compaction_policy(), partitionConfig, code, error, appData)) {
return false;
}
changed = true;
}
return NKikimr::FillAlterTableSettingsDesc(out, in, code, error, changed);
}
} // namespace NGRpcService
} // namespace NKikimr
|