rabbitmq-server icon indicating copy to clipboard operation
rabbitmq-server copied to clipboard

Improve the error message when fail to create a super stream

Open Gsantomaggio opened this issue 1 year ago • 0 comments

Describe the bug

by protocol, I could create a super stream with the same partitions name:

  const string SuperStream = "my_super_stream_with_2_partitions";
  var partitions = new List<string> { "partition_0", "partition_0" }; //// <---- partition names are equals 
  var bindingKeys = new List<string>() { "0", "1" };
  var args = new Dictionary<string, string> { { "queue-leader-locator", "least-leaders"},
                { "max-length-bytes", "10000"}, {"max-age", "30000s"}};
  var response = await client.CreateSuperStream(SuperStream, partitions, bindingKeys, args);
  Assert.Equal(ResponseCode.Ok, response.ResponseCode);

In this case, the server error side is :

2024-02-12 10:16:51.981857+00:00 [warning] <0.970.0> Error while trying to create super stream <<"my_super_stream_with_2_partitions">>: reference_already_exists

That is not correct since my_super_stream_with_2_partitions does not exist.

Do you think we can improve the server-side log with something like the following:

 <0.970.0> Error while trying to create super stream <<"my_super_stream_with_2_partitions">> the partition `partition_0` _already_exists

The error sent back is internalError, which seems scary.

I would send a precondition failure

Reproduction steps

Create a super stream with two partitions with the same name.

Expected behavior

Change the server-side log. Change the error returned to precondition failure

Additional context

No response

Gsantomaggio avatar Feb 12 '24 10:02 Gsantomaggio