Fix tests

This commit is contained in:
kssenii 2021-08-28 19:09:35 +03:00
parent cc90d787f8
commit 378e1f74aa
6 changed files with 12 additions and 7 deletions

View File

@ -23,7 +23,7 @@ ENGINE = MaterializedPostgreSQL('host:port', ['database' | database], 'user', 'p
- `user` — PostgreSQL user.
- `password` — User password.
## Dynamicaly adding new tables to replication
## Dynamically adding new tables to replication
``` sql
ATTACH TABLE postgres_database.new_table;
@ -31,7 +31,7 @@ ATTACH TABLE postgres_database.new_table;
It will work as well if there is a setting `materialized_postgresql_tables_list`.
## Dynamicaly removing tables from replication
## Dynamically removing tables from replication
``` sql
DETACH TABLE postgres_database.table_to_remove;

View File

@ -71,9 +71,10 @@ enum class AccessType
M(ALTER_FETCH_PARTITION, "ALTER FETCH PART, FETCH PARTITION", TABLE, ALTER_TABLE) \
M(ALTER_FREEZE_PARTITION, "FREEZE PARTITION, UNFREEZE", TABLE, ALTER_TABLE) \
\
M(ALTER_DATABASE_SETTINGS, "ALTER DATABASE SETTING, ALTER MODIFY DATABASE SETTING, MODIFY DATABASE SETTING", TABLE, ALTER_TABLE) /* allows to execute ALTER MODIFY SETTING */\
M(ALTER_DATABASE_SETTINGS, "ALTER DATABASE SETTING, ALTER MODIFY DATABASE SETTING, MODIFY DATABASE SETTING", DATABASE, ALTER_DATABASE) /* allows to execute ALTER MODIFY SETTING */\
\
M(ALTER_TABLE, "", GROUP, ALTER) \
M(ALTER_DATABASE, "", GROUP, ALTER) \
\
M(ALTER_VIEW_REFRESH, "ALTER LIVE VIEW REFRESH, REFRESH VIEW", VIEW, ALTER_VIEW) \
M(ALTER_VIEW_MODIFY_QUERY, "ALTER TABLE MODIFY QUERY", VIEW, ALTER_VIEW) \

View File

@ -34,6 +34,7 @@ namespace ErrorCodes
extern const int LOGICAL_ERROR;
extern const int QUERY_NOT_ALLOWED;
extern const int UNKNOWN_TABLE;
extern const int BAD_ARGUMENTS;
}
DatabaseMaterializedPostgreSQL::DatabaseMaterializedPostgreSQL(

View File

@ -48,7 +48,7 @@ BlockIO InterpreterAlterQuery::execute()
else if (alter.alter_object == ASTAlterQuery::AlterObjectType::TABLE
|| alter.alter_object == ASTAlterQuery::AlterObjectType::LIVE_VIEW)
return executeToTable(alter);
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unknown alter object type");
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unknown alter object type");
}

View File

@ -166,7 +166,8 @@ void PostgreSQLReplicationHandler::startSynchronization(bool throw_on_error)
auto * materialized_storage = storage->as <StorageMaterializedPostgreSQL>();
try
{
/// TODO: THIS IS INCORRENT, we might get here if there is no nested, need to check and reload.
/// FIXME: Looks like it is possible we might get here if there is no nested storage or at least nested storage id field might be empty.
/// Caught it somehow when doing something else incorrectly, but do not see any reason how it could happen.
/// Try load nested table, set materialized table metadata.
nested_storages[table_name] = materialized_storage->prepare();
}
@ -617,7 +618,7 @@ PostgreSQLTableStructurePtr PostgreSQLReplicationHandler::fetchTableStructure(
void PostgreSQLReplicationHandler::addTableToReplication(StorageMaterializedPostgreSQL * materialized_storage, const String & postgres_table_name)
{
/// Note: we have to ensure that replication consumer task is stopped when we reload table, because otherwise
/// it can read wal beyond start lsn position (from which this table is being loaded), which will result in loosing data.
/// it can read wal beyond start lsn position (from which this table is being loaded), which will result in losing data.
consumer_task->deactivate();
try
{
@ -663,7 +664,7 @@ void PostgreSQLReplicationHandler::addTableToReplication(StorageMaterializedPost
throw Exception(ErrorCodes::POSTGRESQL_REPLICATION_INTERNAL_ERROR,
"Failed to add table `{}` to replication. Info: {}", postgres_table_name, error_message);
}
consumer_task->schedule();
consumer_task->activateAndSchedule();
}

View File

@ -35,7 +35,9 @@ ALTER SETTINGS ['ALTER SETTING','ALTER MODIFY SETTING','MODIFY SETTING','RESET S
ALTER MOVE PARTITION ['ALTER MOVE PART','MOVE PARTITION','MOVE PART'] TABLE ALTER TABLE
ALTER FETCH PARTITION ['ALTER FETCH PART','FETCH PARTITION'] TABLE ALTER TABLE
ALTER FREEZE PARTITION ['FREEZE PARTITION','UNFREEZE'] TABLE ALTER TABLE
ALTER DATABASE SETTINGS ['ALTER DATABASE SETTING','ALTER MODIFY DATABASE SETTING','MODIFY DATABASE SETTING'] DATABASE ALTER DATABASE
ALTER TABLE [] \N ALTER
ALTER DATABASE [] \N ALTER
ALTER VIEW REFRESH ['ALTER LIVE VIEW REFRESH','REFRESH VIEW'] VIEW ALTER VIEW
ALTER VIEW MODIFY QUERY ['ALTER TABLE MODIFY QUERY'] VIEW ALTER VIEW
ALTER VIEW [] \N ALTER