[flaky-tests] AdminApiSchemaTest#testSchemaInfoApi - #14508
Conversation
I wonder why |
|
/pulsarbot rerun-failure-checks |
|
|
||
| // leave INT32 instance unchanged | ||
| final Schema<Integer> integerSchema = Schema.INT32.clone(); | ||
| final Schema<Integer> integerSchema = DefaultImplementation.getDefaultImplementation().newIntSchema(); |
There was a problem hiding this comment.
This is not good.
it means that users that use the public API Schema.INT32 and use clone() see surprises.
I believe that the problem is that clone() is not working properly
Schema are stateful objects in Pulsar and clone() is very important
There was a problem hiding this comment.
if you don't want to open the Pandora box of clone() then please use Schema.JSON() that is guaranteed to always return a new instance
There was a problem hiding this comment.
I don't believe this solution works. SCHEMA_INFO is static, so any modification of it in one test will affect other tests. This is a design flaw.
A larger question for me is why we're letting users modify the SCHEMA_INFO object. It is static, so cloning isn't going to do anything.
There was a problem hiding this comment.
@michaeljmarshall good catch! you're right
I think the test issue can be just fixed as @eolivelli suggested, using a JSON schema. The type of the schema is not relevant for test itself.
I agree that the clone() method returnsthis because, probably, the initial intention was to keep it immutable.
Moving the getter to return an immutable map may be the right solution, even if it can be considered a breaking change because can cause runtime error while upgrading the client
There was a problem hiding this comment.
Great point. In order to get this test passing, we can avoid the mutability issues for Schema.INT32.
There was a problem hiding this comment.
@lhotari - it's likely that clone returns this because it is supposed to be immutable. Unfortunately, the SCHEMA_INFO is static and mutable, so this bug would exist even if clone worked properly.
@nicoloboschi - great work identifying this issue. I think we'll need to discuss a large solution. In my mind, the SCHEMA_INFO shouldn't be modifiable in this case.
|
|
||
| // leave INT32 instance unchanged | ||
| final Schema<Integer> integerSchema = Schema.INT32.clone(); | ||
| final Schema<Integer> integerSchema = DefaultImplementation.getDefaultImplementation().newIntSchema(); |
There was a problem hiding this comment.
I don't believe this solution works. SCHEMA_INFO is static, so any modification of it in one test will affect other tests. This is a design flaw.
A larger question for me is why we're letting users modify the SCHEMA_INFO object. It is static, so cloning isn't going to do anything.
|
Note also that the properties map (the original issue from #12461) is a mutable map that is likely passed among threads: Depending on how we access this map, that could be its own issue. That |
|
@michaeljmarshall @eolivelli I created this issue #14522 for continuing the discussion |
|
/pulsarbot rerun-failure-checks |
|
i think primitive schema also can implement clone |
There will be some components inside and will change. When the user wants to use the component at that time, we need the clone method to get the current schema, and it will not affect the original schema. Doesn't seem to be of much use in primitive schema as they are all the same |
* [flaky-tests] AdminApiSchemaTest#testSchemaInfoApi * use custom json schema * remove old comment ### Motivation This is the same fix applied here #12461. The problem with the other pull is that the `AbstractSchema#clone()` method does return the same instance, so the fix is not useful at all. I see this test also failing in 2.8 and 2.9 branch, I recommend to cherry-pick it. ### Modifications * Create a new INT schema for the test purpose - [x] `no-need-doc` (cherry picked from commit 32c3cd1)
* [flaky-tests] AdminApiSchemaTest#testSchemaInfoApi * use custom json schema * remove old comment ### Motivation This is the same fix applied here #12461. The problem with the other pull is that the `AbstractSchema#clone()` method does return the same instance, so the fix is not useful at all. I see this test also failing in 2.8 and 2.9 branch, I recommend to cherry-pick it. ### Modifications * Create a new INT schema for the test purpose - [x] `no-need-doc` (cherry picked from commit 32c3cd1)
* [flaky-tests] AdminApiSchemaTest#testSchemaInfoApi * use custom json schema * remove old comment ### Motivation This is the same fix applied here #12461. The problem with the other pull is that the `AbstractSchema#clone()` method does return the same instance, so the fix is not useful at all. I see this test also failing in 2.8 and 2.9 branch, I recommend to cherry-pick it. ### Modifications * Create a new INT schema for the test purpose - [x] `no-need-doc` (cherry picked from commit 32c3cd1)
* [flaky-tests] AdminApiSchemaTest#testSchemaInfoApi * use custom json schema * remove old comment ### Motivation This is the same fix applied here apache#12461. The problem with the other pull is that the `AbstractSchema#clone()` method does return the same instance, so the fix is not useful at all. I see this test also failing in 2.8 and 2.9 branch, I recommend to cherry-pick it. ### Modifications * Create a new INT schema for the test purpose - [x] `no-need-doc` (cherry picked from commit 32c3cd1) (cherry picked from commit 0f72a4f)
* [flaky-tests] AdminApiSchemaTest#testSchemaInfoApi * use custom json schema * remove old comment ### Motivation This is the same fix applied here apache#12461. The problem with the other pull is that the `AbstractSchema#clone()` method does return the same instance, so the fix is not useful at all. I see this test also failing in 2.8 and 2.9 branch, I recommend to cherry-pick it. ### Modifications * Create a new INT schema for the test purpose - [x] `no-need-doc` (cherry picked from commit 32c3cd1) (cherry picked from commit 0f72a4f)
* [flaky-tests] AdminApiSchemaTest#testSchemaInfoApi * use custom json schema * remove old comment ### Motivation This is the same fix applied here apache#12461. The problem with the other pull is that the `AbstractSchema#clone()` method does return the same instance, so the fix is not useful at all. I see this test also failing in 2.8 and 2.9 branch, I recommend to cherry-pick it. ### Modifications * Create a new INT schema for the test purpose - [x] `no-need-doc`
* [flaky-tests] AdminApiSchemaTest#testSchemaInfoApi * use custom json schema * remove old comment ### Motivation This is the same fix applied here apache#12461. The problem with the other pull is that the `AbstractSchema#clone()` method does return the same instance, so the fix is not useful at all. I see this test also failing in 2.8 and 2.9 branch, I recommend to cherry-pick it. ### Modifications * Create a new INT schema for the test purpose - [x] `no-need-doc`
Motivation
This is the same fix applied here #12461. The problem with the other pull is that the
AbstractSchema#clone()method does return the same instance, so the fix is not useful at all.I see this test also failing in 2.8 and 2.9 branch, I recommend to cherry-pick it.
Modifications
no-need-doc