[Tarantool-patches] [PATCH 2/3] box: forbid to update/replace _space_sequence

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat Feb 22 19:16:49 MSK 2020


Thanks for the review!

On 21/02/2020 16:29, Nikita Pettik wrote:
> On 17 Feb 21:57, Vladislav Shpilevoy wrote:
>> diff --git a/src/box/alter.cc b/src/box/alter.cc
>> index 64af71c61..50121c79c 100644
>> --- a/src/box/alter.cc
>> +++ b/src/box/alter.cc
>> @@ -4713,9 +4713,13 @@ on_replace_dd_space_sequence(struct trigger * /* trigger */, void *event)
>>  		return -1;
>>  	}
> 
> LGTM
> 
> Nit: as always I'd only add brief comment like:

Done. New hunk is below. Also I changed

    (stmt->new_tuple != NULL) == (stmt->old_tuple != NULL)

to

    stmt->new_tuple != NULL && stmt->old_tuple != NULL

Because both of the tuples can't be NULL anyway.

diff --git a/src/box/alter.cc b/src/box/alter.cc
index 64af71c61..d73679fb8 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -4712,10 +4712,17 @@ on_replace_dd_space_sequence(struct trigger * /* trigger */, void *event)
 		diag_set(ClientError, ER_NO_SUCH_SEQUENCE, int2str(sequence_id));
 		return -1;
 	}
-
+	if (stmt->new_tuple != NULL && stmt->old_tuple != NULL) {
+		/*
+		 * Makes no sense to support update, it would
+		 * complicate the code, and won't simplify
+		 * anything else.
+		 */
+		diag_set(ClientError, ER_UNSUPPORTED,
+			 "space \"_space_sequence\"", "update");
+		return -1;
+	}
 	enum priv_type priv_type = stmt->new_tuple ? PRIV_C : PRIV_D;
-	if (stmt->new_tuple && stmt->old_tuple)
-		priv_type = PRIV_A;


More information about the Tarantool-patches mailing list