pvary commented on code in PR #3372:
URL: https://github.com/apache/hive/pull/3372#discussion_r897738904


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PersistenceManagerProvider.java:
##########
@@ -231,21 +240,24 @@ private static PersistenceManagerFactory 
initPMF(Configuration conf, boolean for
     DataSourceProvider dsp = 
DataSourceProviderFactory.tryGetDataSourceProviderOrNull(conf);
     PersistenceManagerFactory pmf;
 
+    // Any preexisting datanucleus property should be passed along
+    Map<Object, Object> dsProp = new HashMap<>(prop);
+    int maxPoolSize = -1;
+    
+    if (forCompactor) {
+      maxPoolSize = MetastoreConf.getIntVar(conf, 
ConfVars.HIVE_COMPACTOR_CONNECTION_POOLING_MAX_CONNECTIONS);
+      dsProp.put(ConfVars.CONNECTION_POOLING_MAX_CONNECTIONS.getVarname(), 
maxPoolSize);
+    }
     if (dsp == null) {
-      pmf = JDOHelper.getPersistenceManagerFactory(prop);
+      pmf = JDOHelper.getPersistenceManagerFactory(dsProp);
     } else {
       try {
-        DataSource ds =
-                forCompactor ? dsp.create(conf, MetastoreConf.getIntVar(conf, 
ConfVars.HIVE_COMPACTOR_CONNECTION_POOLING_MAX_CONNECTIONS)) :
-                        dsp.create(conf);
-        Map<Object, Object> dsProperties = new HashMap<>();
-        //Any preexisting datanucleus property should be passed along
-        dsProperties.putAll(prop);
-        dsProperties.put(PropertyNames.PROPERTY_CONNECTION_FACTORY, ds);
-        dsProperties.put(PropertyNames.PROPERTY_CONNECTION_FACTORY2, ds);
-        dsProperties.put(ConfVars.MANAGER_FACTORY_CLASS.getVarname(),
+        DataSource ds = (maxPoolSize > 0) ? dsp.create(conf, maxPoolSize) : 
dsp.create(conf);
+        dsProp.put(PropertyNames.PROPERTY_CONNECTION_FACTORY, ds);

Review Comment:
   My question was aimed the change that with the original code we had a new, 
copied property set instead of modifying the original property set. It might 
cause issues in other places of the code. I was trying to find out if this was 
intentional



-- 
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