absurdfarce commented on code in PR #575:
URL: 
https://github.com/apache/cassandra-cpp-driver/pull/575#discussion_r3012193078


##########
src/cluster_config.cpp:
##########
@@ -295,11 +296,13 @@ CassError 
cass_cluster_set_load_balance_dc_aware_n(CassCluster* cluster, const c
                                                    size_t local_dc_length,
                                                    unsigned 
used_hosts_per_remote_dc,
                                                    cass_bool_t 
allow_remote_dcs_for_local_cl) {
-  if (local_dc == NULL || local_dc_length == 0) {
-    return CASS_ERROR_LIB_BAD_PARAMS;
-  }
+  // If local_dc is NULL or length is 0, we use an empty string which causes 
the driver
+  // to use the DC of the first connected node
+  String dc_name = (local_dc != NULL && local_dc_length > 0) ? 
+                    String(local_dc, local_dc_length) : String();
+  

Review Comment:
   The duplicate null and empty checks do indeed look redundant.  I removed 
those but decided to keep the local dc_name var; I think it makes the resulting 
function easier to read.
   
   Built and ran the unit tests locally with that change and everything passed 
so there's no obvious hidden bug waiting for us there.  I'll kick off a full 
Jenkins run once this change goes in to explicitly confirm.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to