diff options
| author | ilnaz <[email protected]> | 2022-11-22 17:23:18 +0300 | 
|---|---|---|
| committer | ilnaz <[email protected]> | 2022-11-22 17:23:18 +0300 | 
| commit | dd4ffeb56028ad3e05c8510b8605464980bb64fb (patch) | |
| tree | 5e112895db55a594b1ef70b52b6ab7369fdd571e | |
| parent | b7301c3bf939dde1edb6cdf453c21b3270f8b426 (diff) | |
Translate InvalidParameter to BAD_REQUEST
| -rw-r--r-- | ydb/core/grpc_services/rpc_scheme_base.h | 5 | ||||
| -rw-r--r-- | ydb/core/kqp/ut/kqp_not_null_columns_ut.cpp | 2 | ||||
| -rw-r--r-- | ydb/core/kqp/ut/kqp_scheme_ut.cpp | 12 | ||||
| -rw-r--r-- | ydb/core/tx/replication/ydb_proxy/ydb_proxy_ut.cpp | 2 | ||||
| -rw-r--r-- | ydb/services/persqueue_v1/persqueue_ut.cpp | 2 | ||||
| -rw-r--r-- | ydb/services/ydb/ydb_logstore_ut.cpp | 12 | ||||
| -rw-r--r-- | ydb/services/ydb/ydb_table_ut.cpp | 2 | ||||
| -rw-r--r-- | ydb/tests/functional/limits/test_schemeshard_limits.py | 4 | ||||
| -rw-r--r-- | ydb/tests/functional/scheme_shard/test_alter_ops.py | 6 | 
9 files changed, 25 insertions, 22 deletions
| diff --git a/ydb/core/grpc_services/rpc_scheme_base.h b/ydb/core/grpc_services/rpc_scheme_base.h index 0be68e802e1..6d18d778869 100644 --- a/ydb/core/grpc_services/rpc_scheme_base.h +++ b/ydb/core/grpc_services/rpc_scheme_base.h @@ -96,6 +96,9 @@ protected:                      case NKikimrScheme::EStatus::StatusMultipleModifications: {                          return this->ReplyWithResult(Ydb::StatusIds::OVERLOADED, issueMessage, ctx);                      } +                    case NKikimrScheme::EStatus::StatusInvalidParameter: { +                        return this->ReplyWithResult(Ydb::StatusIds::BAD_REQUEST, issueMessage, ctx); +                    }                      case NKikimrScheme::EStatus::StatusSchemeError:                      case NKikimrScheme::EStatus::StatusNameConflict:                      case NKikimrScheme::EStatus::StatusPathDoesNotExist: { @@ -105,7 +108,7 @@ protected:                          // FIXME: clients may start aggressive retries when receiving 'overloaded'                          return this->ReplyWithResult(Ydb::StatusIds::OVERLOADED, issueMessage, ctx);                      } -                   case NKikimrScheme::EStatus::StatusResourceExhausted: +                    case NKikimrScheme::EStatus::StatusResourceExhausted:                      case NKikimrScheme::EStatus::StatusPreconditionFailed: {                          return this->ReplyWithResult(Ydb::StatusIds::PRECONDITION_FAILED, issueMessage, ctx);                      } diff --git a/ydb/core/kqp/ut/kqp_not_null_columns_ut.cpp b/ydb/core/kqp/ut/kqp_not_null_columns_ut.cpp index c37ed10f0a5..b7ee6f8dd24 100644 --- a/ydb/core/kqp/ut/kqp_not_null_columns_ut.cpp +++ b/ydb/core/kqp/ut/kqp_not_null_columns_ut.cpp @@ -491,7 +491,7 @@ Y_UNIT_TEST_SUITE(KqpNotNullColumns) {          {              const auto query = Q_("ALTER TABLE `/Root/TestAddNotNullColumn` ADD COLUMN Value2 String NOT NULL");              auto result = session.ExecuteSchemeQuery(query).ExtractValueSync(); -            UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::GENERIC_ERROR, result.GetIssues().ToString()); +            UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::BAD_REQUEST, result.GetIssues().ToString());          }      } diff --git a/ydb/core/kqp/ut/kqp_scheme_ut.cpp b/ydb/core/kqp/ut/kqp_scheme_ut.cpp index 1062f6c1d49..8466b74a075 100644 --- a/ydb/core/kqp/ut/kqp_scheme_ut.cpp +++ b/ydb/core/kqp/ut/kqp_scheme_ut.cpp @@ -1497,17 +1497,17 @@ Y_UNIT_TEST_SUITE(KqpScheme) {              EStatus::GENERIC_ERROR, "Interval value cannot be negative");          AlterTableSetttings(session, tableName, {{"TTL", R"(Interval("P0D") ON CreatedAt)"}}, compat, -            EStatus::GENERIC_ERROR, "Cannot enable TTL on unknown column"); +            EStatus::BAD_REQUEST, "Cannot enable TTL on unknown column");          AlterTableSetttings(session, tableName, {{"TTL", R"(Interval("P0D") ON StringValue)"}}, compat, -            EStatus::GENERIC_ERROR, "Unsupported column type"); +            EStatus::BAD_REQUEST, "Unsupported column type");          AlterTableSetttings(session, tableName, {{"TTL", R"(Interval("P0D") ON Uint32Value)"}}, compat, -            EStatus::GENERIC_ERROR, "'ValueSinceUnixEpochModeSettings' should be specified"); +            EStatus::BAD_REQUEST, "'ValueSinceUnixEpochModeSettings' should be specified");          AlterTableSetttings(session, tableName, {{"TTL", R"(Interval("P0D") ON Uint64Value)"}}, compat, -            EStatus::GENERIC_ERROR, "'ValueSinceUnixEpochModeSettings' should be specified"); +            EStatus::BAD_REQUEST, "'ValueSinceUnixEpochModeSettings' should be specified");          AlterTableSetttings(session, tableName, {{"TTL", R"(Interval("P0D") ON DyNumberValue)"}}, compat, -            EStatus::GENERIC_ERROR, "'ValueSinceUnixEpochModeSettings' should be specified"); +            EStatus::BAD_REQUEST, "'ValueSinceUnixEpochModeSettings' should be specified");          AlterTableSetttings(session, tableName, {{"TTL", R"(Interval("P0D") ON Ts)"}}, compat);          { @@ -1526,7 +1526,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {                  --!syntax_v1                  ALTER TABLE `)" << tableName << R"(` DROP COLUMN Ts;)";              auto result = session.ExecuteSchemeQuery(query).GetValueSync(); -            UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::GENERIC_ERROR, result.GetIssues().ToString()); +            UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::BAD_REQUEST, result.GetIssues().ToString());              UNIT_ASSERT_STRING_CONTAINS(result.GetIssues().ToString(), "Can't drop TTL column");          } diff --git a/ydb/core/tx/replication/ydb_proxy/ydb_proxy_ut.cpp b/ydb/core/tx/replication/ydb_proxy/ydb_proxy_ut.cpp index d536a6db195..95ab198fc88 100644 --- a/ydb/core/tx/replication/ydb_proxy/ydb_proxy_ut.cpp +++ b/ydb/core/tx/replication/ydb_proxy/ydb_proxy_ut.cpp @@ -365,7 +365,7 @@ Y_UNIT_TEST_SUITE(YdbProxyTests) {                  new TEvYdbProxy::TEvAlterTableRequest("/Root/table", settings));              UNIT_ASSERT(ev);              UNIT_ASSERT(!ev->Get()->Result.IsSuccess()); -            UNIT_ASSERT_VALUES_EQUAL(ev->Get()->Result.GetStatus(), NYdb::EStatus::GENERIC_ERROR); +            UNIT_ASSERT_VALUES_EQUAL(ev->Get()->Result.GetStatus(), NYdb::EStatus::BAD_REQUEST);          }      } diff --git a/ydb/services/persqueue_v1/persqueue_ut.cpp b/ydb/services/persqueue_v1/persqueue_ut.cpp index ae10b8922ba..5e9d38d837f 100644 --- a/ydb/services/persqueue_v1/persqueue_ut.cpp +++ b/ydb/services/persqueue_v1/persqueue_ut.cpp @@ -3932,7 +3932,7 @@ Y_UNIT_TEST_SUITE(TPersQueueTest) {          request.mutable_set_retention_period()->set_seconds(TDuration::Days(2).Seconds());          request.mutable_alter_partitioning_settings()->set_set_min_active_partitions(1);          alter(request, Ydb::StatusIds::SCHEME_ERROR, true); -        alter(request, Ydb::StatusIds::GENERIC_ERROR, false); +        alter(request, Ydb::StatusIds::BAD_REQUEST, false);          request.mutable_alter_partitioning_settings()->set_set_min_active_partitions(3);          request.set_set_retention_storage_mb(-2);          alter(request, Ydb::StatusIds::BAD_REQUEST, false); diff --git a/ydb/services/ydb/ydb_logstore_ut.cpp b/ydb/services/ydb/ydb_logstore_ut.cpp index 906fbbad88b..6fb1cc73c93 100644 --- a/ydb/services/ydb/ydb_logstore_ut.cpp +++ b/ydb/services/ydb/ydb_logstore_ut.cpp @@ -465,7 +465,7 @@ Y_UNIT_TEST_SUITE(YdbLogStore) {              NYdb::NLogStore::TAlterLogTableSettings alterLogTableSettings;              alterLogTableSettings.AlterTtlSettings(NYdb::NTable::TAlterTtlSettings::Set("uint_timestamp", NYdb::NTable::TTtlSettings::EUnit::MilliSeconds, TDuration::Seconds(3600)));              auto res = logStoreClient.AlterLogTable("/Root/LogStore/log1", std::move(alterLogTableSettings)).GetValueSync(); -            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::GENERIC_ERROR, res.GetIssues().ToString()); +            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::BAD_REQUEST, res.GetIssues().ToString());          }          {              auto res = logStoreClient.DescribeLogTable("/Root/LogStore/log1").GetValueSync(); @@ -480,7 +480,7 @@ Y_UNIT_TEST_SUITE(YdbLogStore) {              NYdb::NLogStore::TAlterLogTableSettings alterLogTableSettings;              alterLogTableSettings.AlterTtlSettings(NYdb::NTable::TAlterTtlSettings::Set("ingested_at", TDuration::Seconds(86400)));              auto res = logStoreClient.AlterLogTable("/Root/LogStore/log2", std::move(alterLogTableSettings)).GetValueSync(); -            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::GENERIC_ERROR, res.GetIssues().ToString()); +            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::BAD_REQUEST, res.GetIssues().ToString());          }          {              auto res = logStoreClient.DescribeLogTable("/Root/LogStore/log2").GetValueSync(); @@ -514,7 +514,7 @@ Y_UNIT_TEST_SUITE(YdbLogStore) {              NYdb::NLogStore::TAlterLogTableSettings alterLogTableSettings;              alterLogTableSettings.AlterTtlSettings(NYdb::NTable::TAlterTtlSettings::Drop());              auto res = logStoreClient.AlterLogTable("/Root/LogStore/log2", std::move(alterLogTableSettings)).GetValueSync(); -            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::GENERIC_ERROR, res.GetIssues().ToString()); +            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::BAD_REQUEST, res.GetIssues().ToString());          }          {              auto res = logStoreClient.DescribeLogTable("/Root/LogStore/log2").GetValueSync(); @@ -532,7 +532,7 @@ Y_UNIT_TEST_SUITE(YdbLogStore) {              NYdb::NLogStore::TLogTableSharding sharding(NYdb::NLogStore::HASH_TYPE_LOGS_SPECIAL, {"timestamp", "uid"}, 4);              NYdb::NLogStore::TLogTableDescription tableDescr("default", sharding, ttlSettings);              auto res = logStoreClient.CreateLogTable("/Root/LogStore/log3", std::move(tableDescr)).GetValueSync(); -            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::GENERIC_ERROR, res.GetIssues().ToString()); +            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::BAD_REQUEST, res.GetIssues().ToString());          }          // Use column of invalid type for TTL @@ -541,7 +541,7 @@ Y_UNIT_TEST_SUITE(YdbLogStore) {              NYdb::NLogStore::TLogTableSharding sharding(NYdb::NLogStore::HASH_TYPE_LOGS_SPECIAL, {"timestamp", "uid"}, 4);              NYdb::NLogStore::TLogTableDescription tableDescr("default", sharding, ttlSettings);              auto res = logStoreClient.CreateLogTable("/Root/LogStore/log4", std::move(tableDescr)).GetValueSync(); -            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::GENERIC_ERROR, res.GetIssues().ToString()); +            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::BAD_REQUEST, res.GetIssues().ToString());          }          // Use non-Timestamp column for TTL @@ -550,7 +550,7 @@ Y_UNIT_TEST_SUITE(YdbLogStore) {              NYdb::NLogStore::TLogTableSharding sharding(NYdb::NLogStore::HASH_TYPE_LOGS_SPECIAL, {"timestamp", "uid"}, 4);              NYdb::NLogStore::TLogTableDescription tableDescr("default", sharding, ttlSettings);              auto res = logStoreClient.CreateLogTable("/Root/LogStore/log5", std::move(tableDescr)).GetValueSync(); -            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::GENERIC_ERROR, res.GetIssues().ToString()); +            UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::BAD_REQUEST, res.GetIssues().ToString());          }      }  } diff --git a/ydb/services/ydb/ydb_table_ut.cpp b/ydb/services/ydb/ydb_table_ut.cpp index 16faebbed76..8ee196614a8 100644 --- a/ydb/services/ydb/ydb_table_ut.cpp +++ b/ydb/services/ydb/ydb_table_ut.cpp @@ -3163,7 +3163,7 @@ R"___(<main>: Error: Transaction not found: , code: 2015                                       , {"/Root/Table-1", "/Root/Table-10"}}                                       ).ExtractValueSync();              UNIT_ASSERT_EQUAL(result.IsTransportError(), false); -            UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::GENERIC_ERROR, result.GetStatus()); +            UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::BAD_REQUEST, result.GetStatus());          }          { diff --git a/ydb/tests/functional/limits/test_schemeshard_limits.py b/ydb/tests/functional/limits/test_schemeshard_limits.py index 71d8efc3420..430e853b2c0 100644 --- a/ydb/tests/functional/limits/test_schemeshard_limits.py +++ b/ydb/tests/functional/limits/test_schemeshard_limits.py @@ -67,7 +67,7 @@ class TestSchemeShardLimitsCase0(Base):          assert_that(              callee,              raises( -                ydb.GenericError, +                ydb.BadRequest,                  "ACL size limit exceeded"              )          ) @@ -103,7 +103,7 @@ class TestSchemeShardLimitsCase1(Base):          assert_that(              callee,              raises( -                ydb.GenericError, +                ydb.BadRequest,                  "ACL size limit exceeded"              )          ) diff --git a/ydb/tests/functional/scheme_shard/test_alter_ops.py b/ydb/tests/functional/scheme_shard/test_alter_ops.py index d3869272bf2..60e11f0fffe 100644 --- a/ydb/tests/functional/scheme_shard/test_alter_ops.py +++ b/ydb/tests/functional/scheme_shard/test_alter_ops.py @@ -69,7 +69,7 @@ class TestSchemeShardAlterTest(object):          assert_that(              callee,              raises( -                ydb.GenericError, +                ydb.BadRequest,                  "Cannot alter type for column"              )          ) @@ -157,7 +157,7 @@ class TestSchemeShardAlterTest(object):          assert_that(              callee,              raises( -                ydb.GenericError, +                ydb.BadRequest,                  "drop key column:"              )          ) @@ -208,7 +208,7 @@ class TestSchemeShardAlterTest(object):          assert_that(              callee,              raises( -                ydb.GenericError, +                ydb.BadRequest,                  "drop key column:"              )          ) | 
