[FEAT MERGE] column store ddl
Co-authored-by: AnimationFan <30674773338@qq.com> Co-authored-by: simonjoylet <simonjoylet@gmail.com> Co-authored-by: Monk-Liu <1152761042@qq.com>
This commit is contained in:
@ -59,7 +59,9 @@ int ObTableCreator::execute()
|
||||
int ObTableCreator::add_create_tablets_of_local_aux_tables_arg(
|
||||
const common::ObIArray<const share::schema::ObTableSchema*> &schemas,
|
||||
const share::schema::ObTableSchema *data_table_schema,
|
||||
const common::ObIArray<share::ObLSID> &ls_id_array)
|
||||
const common::ObIArray<share::ObLSID> &ls_id_array,
|
||||
const uint64_t tenant_data_version,
|
||||
const common::ObIArray<bool> &need_create_empty_majors)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(data_table_schema)) {
|
||||
@ -71,6 +73,10 @@ int ObTableCreator::add_create_tablets_of_local_aux_tables_arg(
|
||||
data_table_schema->is_mlog_table()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("data_table_schema must be data table", KR(ret), KPC(data_table_schema));
|
||||
} else if (OB_UNLIKELY(tenant_data_version <= 0 || need_create_empty_majors.count() != schemas.count())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid args", K(ret), K(tenant_data_version), "count_need_create_empty_majors", need_create_empty_majors.count(),
|
||||
"count_schemas", schemas.count());
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < schemas.count(); ++i) {
|
||||
const share::schema::ObTableSchema *aux_schema = schemas.at(i);
|
||||
@ -86,7 +92,7 @@ int ObTableCreator::add_create_tablets_of_local_aux_tables_arg(
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(add_create_tablets_of_tables_arg_(
|
||||
schemas, data_table_schema, ls_id_array))) {
|
||||
schemas, data_table_schema, ls_id_array, tenant_data_version, need_create_empty_majors))) {
|
||||
LOG_WARN("fail to add_create_tablets_of_tables_arg_", KR(ret), K(schemas));
|
||||
}
|
||||
return ret;
|
||||
@ -95,10 +101,12 @@ int ObTableCreator::add_create_tablets_of_local_aux_tables_arg(
|
||||
int ObTableCreator::add_create_bind_tablets_of_hidden_table_arg(
|
||||
const share::schema::ObTableSchema &orig_table_schema,
|
||||
const share::schema::ObTableSchema &hidden_table_schema,
|
||||
const common::ObIArray<share::ObLSID> &ls_id_array)
|
||||
const common::ObIArray<share::ObLSID> &ls_id_array,
|
||||
const uint64_t tenant_data_version)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSEArray<const ObTableSchema *, 1> schemas;
|
||||
ObSEArray<bool, 1> need_create_empty_majors;
|
||||
if (OB_UNLIKELY(!orig_table_schema.has_tablet()
|
||||
|| orig_table_schema.is_index_table()
|
||||
|| hidden_table_schema.is_index_table()
|
||||
@ -107,10 +115,10 @@ int ObTableCreator::add_create_bind_tablets_of_hidden_table_arg(
|
||||
|| !hidden_table_schema.is_user_hidden_table())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("both orig and hidden table must be data table", K(ret), K(orig_table_schema), K(hidden_table_schema));
|
||||
} else if (OB_FAIL(schemas.push_back(&hidden_table_schema))) {
|
||||
} else if (OB_FAIL(schemas.push_back(&hidden_table_schema)) || OB_FAIL(need_create_empty_majors.push_back(false))) {
|
||||
LOG_WARN("failed to push back hidden table schema", K(ret));
|
||||
} else if (OB_FAIL(add_create_tablets_of_tables_arg_(
|
||||
schemas, &orig_table_schema, ls_id_array))) {
|
||||
schemas, &orig_table_schema, ls_id_array, tenant_data_version, need_create_empty_majors))) {
|
||||
LOG_WARN("failed to add arg", K(ret), K(schemas));
|
||||
}
|
||||
return ret;
|
||||
@ -118,20 +126,21 @@ int ObTableCreator::add_create_bind_tablets_of_hidden_table_arg(
|
||||
|
||||
int ObTableCreator::add_create_tablets_of_table_arg(
|
||||
const share::schema::ObTableSchema &table_schema,
|
||||
const common::ObIArray<share::ObLSID> &ls_id_array)
|
||||
const common::ObIArray<share::ObLSID> &ls_id_array,
|
||||
const uint64_t tenant_data_version,
|
||||
const bool need_create_empty_major_sstable)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSEArray<const share::schema::ObTableSchema*, 1> schemas;
|
||||
if (!table_schema.has_tablet()
|
||||
|| table_schema.is_index_local_storage()
|
||||
|| table_schema.is_aux_lob_table()
|
||||
|| table_schema.is_mlog_table()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("table_schema must be data table or global indexes", KR(ret), K(table_schema));
|
||||
} else if (OB_FAIL(schemas.push_back(&table_schema))) {
|
||||
LOG_WARN("failed to push_back", KR(ret), K(table_schema));
|
||||
ObSEArray<bool, 1> need_create_empty_majors;
|
||||
if (!table_schema.has_tablet() || table_schema.is_index_local_storage() || table_schema.is_aux_lob_table()
|
||||
|| table_schema.is_mlog_table() || tenant_data_version <= 0) {
|
||||
LOG_WARN("table_schema must be data table or global indexes", KR(ret), K(table_schema), K(tenant_data_version));
|
||||
} else if (OB_FAIL(schemas.push_back(&table_schema))
|
||||
|| OB_FAIL(need_create_empty_majors.push_back(need_create_empty_major_sstable))) {
|
||||
LOG_WARN("failed to push_back", KR(ret), K(table_schema), K(need_create_empty_major_sstable));
|
||||
} else if (OB_FAIL(add_create_tablets_of_tables_arg_(
|
||||
schemas, NULL, ls_id_array))) {
|
||||
schemas, NULL, ls_id_array, tenant_data_version, need_create_empty_majors))) {
|
||||
LOG_WARN("failed to add create tablet arg", KR(ret), K(table_schema));
|
||||
}
|
||||
return ret;
|
||||
@ -139,9 +148,17 @@ int ObTableCreator::add_create_tablets_of_table_arg(
|
||||
|
||||
int ObTableCreator::add_create_tablets_of_tables_arg(
|
||||
const common::ObIArray<const share::schema::ObTableSchema*> &schemas,
|
||||
const common::ObIArray<share::ObLSID> &ls_id_array)
|
||||
const common::ObIArray<share::ObLSID> &ls_id_array,
|
||||
const uint64_t tenant_data_version,
|
||||
const common::ObIArray<bool> &need_create_empty_majors)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(tenant_data_version <= 0
|
||||
|| schemas.count() != need_create_empty_majors.count())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid args", K(ret), K(tenant_data_version), "count_schemas", schemas.count(),
|
||||
"count_need_create_empty_majors", need_create_empty_majors.count());
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < schemas.count(); ++i) {
|
||||
const share::schema::ObTableSchema *table_schema = schemas.at(i);
|
||||
if (OB_ISNULL(table_schema)) {
|
||||
@ -166,7 +183,7 @@ int ObTableCreator::add_create_tablets_of_tables_arg(
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(add_create_tablets_of_tables_arg_(
|
||||
schemas, NULL, ls_id_array))) {
|
||||
schemas, NULL, ls_id_array, tenant_data_version, need_create_empty_majors))) {
|
||||
LOG_WARN("fail to add_create_tablets_of_tables_arg_", KR(ret), K(schemas));
|
||||
}
|
||||
return ret;
|
||||
@ -178,13 +195,17 @@ int ObTableCreator::add_create_tablets_of_tables_arg(
|
||||
int ObTableCreator::add_create_tablets_of_tables_arg_(
|
||||
const common::ObIArray<const share::schema::ObTableSchema*> &schemas,
|
||||
const share::schema::ObTableSchema *data_table_schema,
|
||||
const common::ObIArray<share::ObLSID> &ls_id_array)
|
||||
const common::ObIArray<share::ObLSID> &ls_id_array,
|
||||
const uint64_t tenant_data_version,
|
||||
const common::ObIArray<bool> &need_create_empty_majors)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const int64_t schema_cnt = schemas.count();
|
||||
if (OB_UNLIKELY(schema_cnt < 1)) {
|
||||
if (OB_UNLIKELY(schema_cnt < 1 || tenant_data_version <= 0
|
||||
|| schema_cnt != need_create_empty_majors.count())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("schemas count is less 1", KR(ret), K(schema_cnt));
|
||||
LOG_WARN("schemas count is less 1", KR(ret), K(schema_cnt), K(tenant_data_version),
|
||||
"create_major_flag_cnt", need_create_empty_majors.count());
|
||||
} else if (OB_ISNULL(schemas.at(0))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("NULL ptr", KR(ret), K(schemas));
|
||||
@ -268,7 +289,9 @@ int ObTableCreator::add_create_tablets_of_tables_arg_(
|
||||
pairs,
|
||||
OB_INVALID_INDEX,
|
||||
OB_INVALID_INDEX,
|
||||
is_create_bind_hidden_tablets))) {
|
||||
is_create_bind_hidden_tablets,
|
||||
tenant_data_version,
|
||||
need_create_empty_majors))) {
|
||||
LOG_WARN("fail to generate_create_tablet_arg",
|
||||
K(table_schema), K(schemas), KR(ret), K(is_create_bind_hidden_tablets));
|
||||
}
|
||||
@ -292,7 +315,9 @@ int ObTableCreator::add_create_tablets_of_tables_arg_(
|
||||
pairs,
|
||||
i,
|
||||
OB_INVALID_INDEX,
|
||||
is_create_bind_hidden_tablets))) {
|
||||
is_create_bind_hidden_tablets,
|
||||
tenant_data_version,
|
||||
need_create_empty_majors))) {
|
||||
LOG_WARN("fail to generate_create_tablet_arg",
|
||||
K(table_schema), K(schemas), KR(ret), K(i), K(is_create_bind_hidden_tablets));
|
||||
}
|
||||
@ -316,7 +341,9 @@ int ObTableCreator::add_create_tablets_of_tables_arg_(
|
||||
pairs,
|
||||
i,
|
||||
j,
|
||||
is_create_bind_hidden_tablets))) {
|
||||
is_create_bind_hidden_tablets,
|
||||
tenant_data_version,
|
||||
need_create_empty_majors))) {
|
||||
LOG_WARN("fail to generate_create_tablet_arg",
|
||||
K(table_schema), K(schemas), KR(ret), K(i), K(j), K(is_create_bind_hidden_tablets));
|
||||
}
|
||||
@ -355,7 +382,9 @@ int ObTableCreator::generate_create_tablet_arg_(
|
||||
common::ObIArray<share::ObTabletTablePair> &pairs,
|
||||
const int64_t part_idx,
|
||||
const int64_t subpart_idx,
|
||||
const bool is_create_bind_hidden_tablets)
|
||||
const bool is_create_bind_hidden_tablets,
|
||||
const uint64_t tenant_data_version,
|
||||
const common::ObIArray<bool> &need_create_empty_majors)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletID data_tablet_id;
|
||||
@ -416,7 +445,9 @@ int ObTableCreator::generate_create_tablet_arg_(
|
||||
data_tablet_id,
|
||||
schemas,
|
||||
mode,
|
||||
is_create_bind_hidden_tablets))) {
|
||||
is_create_bind_hidden_tablets,
|
||||
tenant_data_version,
|
||||
need_create_empty_majors))) {
|
||||
LOG_WARN("fail to init create tablet arg", KR(ret), K(schemas), K(is_create_bind_hidden_tablets));
|
||||
} else if (OB_FAIL(tablet_creator_.add_create_tablet_arg(create_tablet_arg))) {
|
||||
LOG_WARN("fail to add create tablet arg", KR(ret), K(create_tablet_arg));
|
||||
|
||||
Reference in New Issue
Block a user