From 02c50574f8965f715c407c78a60421888ac36917 Mon Sep 17 00:00:00 2001 From: Ralf Date: Tue, 2 Jan 2024 10:02:15 +0100 Subject: [PATCH] [FSTORE-1126] python mysql client sometimes failed when user name is too long (#1441) --- .../FeaturestoreJdbcConnectorController.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/jdbc/FeaturestoreJdbcConnectorController.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/jdbc/FeaturestoreJdbcConnectorController.java index fb1ac73e67..a705d42886 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/jdbc/FeaturestoreJdbcConnectorController.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/jdbc/FeaturestoreJdbcConnectorController.java @@ -136,7 +136,7 @@ public FeaturestoreJdbcConnectorDTO getJdbcConnectorDTO(Users user, Project proj if(featurestoreJdbcConnectorDTO.getName() .equals(onlineFeaturestoreController.onlineDbUsername(project, user) + FeaturestoreConstants.ONLINE_FEATURE_STORE_CONNECTOR_SUFFIX)) { - setPasswordPlainTextForOnlineJdbcConnector(user, featurestoreJdbcConnectorDTO, project.getName()); + setPasswordPlainTextForOnlineJdbcConnector(user, featurestoreJdbcConnectorDTO, project); } replaceOnlineFsConnectorUrl(featurestoreJdbcConnectorDTO); replaceOfflineFsConnectorUrl(featurestoreJdbcConnectorDTO); @@ -147,17 +147,17 @@ public FeaturestoreJdbcConnectorDTO getJdbcConnectorDTO(Users user, Project proj /** * Gets the plain text password for the connector from the secret * @param user - * @param projectName + * @param project * @return */ - private String getConnectorPlainPasswordFromSecret(Users user, String projectName){ - String secretName = projectName.concat("_").concat(user.getUsername()); + private String getConnectorPlainPasswordFromSecret(Users user, Project project){ + String secretName = onlineFeaturestoreController.onlineDbUsername(project, user); try { SecretPlaintext plaintext = secretsController.get(user, secretName); return plaintext.getPlaintext(); } catch (UserException e) { LOGGER.log(Level.SEVERE, "Could not get the online jdbc connector password for project: " + - projectName + ", " + "user: " + user.getEmail()); + project.getName() + ", " + "user: " + user.getEmail()); return null; } } @@ -166,13 +166,13 @@ private String getConnectorPlainPasswordFromSecret(Users user, String projectNam * Set the password in argument to plain text only if the connector is an online feature store connector * @param user * @param featurestoreJdbcConnectorDTO - * @param projectName + * @param project * @returnsetPasswordInArgumentToPlainText */ private void setPasswordPlainTextForOnlineJdbcConnector(Users user, FeaturestoreJdbcConnectorDTO featurestoreJdbcConnectorDTO, - String projectName) { - String connectorPassword = getConnectorPlainPasswordFromSecret(user, projectName); + Project project) { + String connectorPassword = getConnectorPlainPasswordFromSecret(user, project); if(!Strings.isNullOrEmpty(storageConnectorUtil.fromOptions(featurestoreJdbcConnectorDTO.getArguments())) && !Strings.isNullOrEmpty(connectorPassword)) { List arguments = featurestoreJdbcConnectorDTO.getArguments();