From 4ac66597fc8e855901b595c8ad4e4e87553177af Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja@tarantool.org> Date: Wed, 14 May 2014 00:14:41 +0400 Subject: [PATCH] Minor tweaks (wrapping up review changes for alter.cc). --- src/box/alter.cc | 16 +++++++++++----- src/errcode.h | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/box/alter.cc b/src/box/alter.cc index d1d86885c8..8af36e6927 100644 --- a/src/box/alter.cc +++ b/src/box/alter.cc @@ -1283,7 +1283,7 @@ func_cache_remove_func(struct trigger * /* trigger */, void *event) static struct trigger drop_func_trigger = { rlist_nil, func_cache_remove_func, NULL, NULL }; -/** Remove a function from function cache */ +/** Replace a function in the function cache */ static void func_cache_replace_func(struct trigger * /* trigger */, void *event) { @@ -1533,7 +1533,11 @@ on_replace_dd_schema(struct trigger * /* trigger */, void *event) } } -/** Remove a function from function cache */ +/** + * A record with id of the new node has been synced to the + * write ahead log. Update the cluster configuration with + * a new node. + */ static void on_commit_dd_cluster(struct trigger *trigger, void *event) { @@ -1552,7 +1556,7 @@ static struct trigger commit_cluster_trigger = * A trigger invoked on replace in the space _cluster, * which contains cluster configuration. * - * The space is modified by JOIN command in IPROTO + * This space is modified by JOIN command in IPROTO * protocol. * * The trigger updates the cluster configuration cache @@ -1579,10 +1583,12 @@ on_replace_dd_cluster(struct trigger *trigger, void *event) /* Check fields */ uint32_t node_id = tuple_field_u32(new_tuple, 0); if (cnode_id_is_reserved(node_id)) - tnt_raise(IllegalParams, "Invalid Node-Id"); + tnt_raise(ClientError, ER_NODE_ID_IS_RESERVED, + (unsigned) node_id); tt_uuid node_uuid = tuple_field_uuid(new_tuple, 1); if (tt_uuid_is_nil(&node_uuid)) - tnt_raise(ClientError, ER_INVALID_UUID, tt_uuid_str(&node_uuid)); + tnt_raise(ClientError, ER_INVALID_UUID, + tt_uuid_str(&node_uuid)); trigger_set(&txn->on_commit, &commit_cluster_trigger); } diff --git a/src/errcode.h b/src/errcode.h index 1130318193..51dcb096d5 100644 --- a/src/errcode.h +++ b/src/errcode.h @@ -116,6 +116,7 @@ enum { TNT_ERRMSG_MAX = 512 }; /* 64 */_(ER_INVALID_UUID, 2, "Invalid UUID: %s") \ /* 65 */_(ER_CLUSTER_ID_IS_RO, 2, "Can't reset cluster id: it is already assigned") \ /* 66 */_(ER_NODE_ID_IS_RO, 2, "Can't reset node id") \ + /* 67 */_(ER_NODE_ID_IS_RESERVED, 2, "Can't initialize node id with a reserved value %u") \ /* * !IMPORTANT! Please follow instructions at start of the file -- GitLab