[ 
https://issues.apache.org/jira/browse/CASSANDRA-20450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17936590#comment-17936590
 ] 

Stefan Miklosovic commented on CASSANDRA-20450:
-----------------------------------------------

[CASSANDRA-20450-5.0|https://github.com/instaclustr/cassandra/tree/CASSANDRA-20450-5.0]
{noformat}
java17_pre-commit_tests                         
java17_separate_tests                            
java11_pre-commit_tests                         
  ✓ j11_build                                        9m 47s
  ✓ j11_cqlsh_dtests_py311                           9m 15s
  ✓ j11_cqlsh_dtests_py311_vnode                     7m 55s
  ✓ j11_cqlsh_dtests_py38                            7m 44s
  ✓ j11_cqlsh_dtests_py38_vnode                      9m 40s
  ✓ j11_cqlshlib_cython_tests                       10m 50s
  ✓ j11_cqlshlib_tests                               9m 56s
  ✓ j11_dtests_latest                               44m 30s
  ✓ j11_dtests_vnode                                 44m 5s
  ✓ j11_jvm_dtests                                  23m 15s
  ✓ j11_jvm_dtests_latest_vnode                     22m 26s
  ✓ j11_simulator_dtests                             6m 15s
  ✓ j11_unit_tests                                   19m 0s
  ✓ j11_utests_latest                                19m 4s
  ✓ j11_utests_oa                                   18m 27s
  ✓ j11_utests_system_keyspace_directory            17m 48s
  ✓ j17_cqlsh_dtests_py311                           6m 50s
  ✓ j17_cqlsh_dtests_py311_vnode                     6m 35s
  ✓ j17_cqlsh_dtests_py38                            6m 34s
  ✓ j17_cqlsh_dtests_py38_vnode                      7m 29s
  ✓ j17_cqlshlib_cython_tests                        7m 58s
  ✓ j17_cqlshlib_tests                               6m 57s
  ✓ j17_dtests_latest                               40m 11s
  ✓ j17_jvm_dtests                                  19m 53s
  ✓ j17_jvm_dtests_latest_vnode                     18m 12s
  ✓ j17_unit_tests                                   15m 2s
  ✓ j17_utests_latest                                17m 8s
  ✓ j17_utests_oa                                   15m 49s
  ✕ j11_dtests                                      58m 10s
      refresh_test.TestRefresh test_refresh_deadlock_startup
  ✕ j17_dtests                                       36m 9s
      refresh_test.TestRefresh test_refresh_deadlock_startup
  ✕ j17_dtests_vnode                                42m 33s
      bootstrap_test.TestBootstrap test_decommissioned_wiped_node_can_join
java11_separate_tests                            
  ✓ j11_build                                         6m 8s
  ✓ j11_simulator_dtests                             5m 42s
{noformat}

[java17_pre-commit_tests|https://app.circleci.com/pipelines/github/instaclustr/cassandra/5643/workflows/d24b7563-1cc9-48a5-8d34-8f4b38b5343f]
[java11_separate_tests|https://app.circleci.com/pipelines/github/instaclustr/cassandra/5643/workflows/c4a200dd-7f21-471a-bd17-292de49beded]


> Fix simulator dtests after CASSANDRA-20368
> ------------------------------------------
>
>                 Key: CASSANDRA-20450
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20450
>             Project: Apache Cassandra
>          Issue Type: Bug
>          Components: Legacy/Testing
>            Reporter: Stefan Miklosovic
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 5.0.x, 5.x
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> After CASSANDRA-20368 was merged, we are getting this in simulator dtests:
> {code:java}
> Caused by: java.lang.ClassCastException: class 
> org.apache.cassandra.auth.AllowAllAuthenticator cannot be cast to class 
> org.apache.cassandra.auth.IAuthenticator 
> (org.apache.cassandra.auth.AllowAllAuthenticator is in unnamed module of 
> loader 'app'; org.apache.cassandra.auth.IAuthenticator is in unnamed module 
> of loader org.apache.cassandra.distributed.shared.InstanceClassLoader 
> @740abb5)
>       at org.apache.cassandra.auth.AuthConfig.applyAuth(AuthConfig.java:54)
>       at 
> org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:284)
>       at 
> org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:269)
>       at 
> org.apache.cassandra.distributed.impl.Instance.partialStartup(Instance.java:710)
>  {code}
> The problem is that after that was merged, we started to do this:
> {code:java}
> private static <T> T authInstantiate(ParameterizedClass authCls, Class<T> 
> defaultCls) {
>     if (authCls != null && authCls.class_name != null)
>     {
>         String authPackage = AuthConfig.class.getPackage().getName();
>         return ParameterizedClass.newInstance(authCls, List.of("", 
> authPackage));
>     }
>     return ParameterizedClass.newInstance(new 
> ParameterizedClass(defaultCls.getName()), List.of());
> }{code}
> while previously it was this
> {code:java}
> private static <T> T authInstantiate(ParameterizedClass authCls, Class<T> 
> defaultCls) {
>     if (authCls != null && authCls.class_name != null)
>     {
>         String authPackage = AuthConfig.class.getPackage().getName();
>         return ParameterizedClass.newInstance(authCls, List.of("", 
> authPackage));
>     }
>     try
>     {
>         return defaultCls.newInstance();
>     }
>     catch (InstantiationException | IllegalAccessException  e)
>     {
>         throw new ConfigurationException("Failed to instantiate " + 
> defaultCls.getName(), e);
>     }
> } {code}
> I am not completely sure what's the problem as "normally" it just works, but 
> when using this code in connection with simulator, my suspicion is that it is 
> using a different class loader and then creating an instance via 
> ParameterizedClass.newInstance just messes it up on all the casts etc. 
> The easy solution here is to just revert to "what was". The only functional 
> difference here is that when a user does e.g. this in yaml
> {code}
> authorizer:
> {code}
> that means, setting authorizer literally to nothing (null), then what the 
> current trunk code does (which broke the simulator tests) is that it will 
> take AllowAllAuthorizer, checks what constructor it has and if it has map 
> constructor it will prefer that one. If it does not have any map constructor, 
> it will create an instance using no-arg constructor.
> I do not think there is any practical difference here so we might just revert 
> to "what was". 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to