Vladsz83 commented on a change in pull request #9313:
URL: https://github.com/apache/ignite/pull/9313#discussion_r703448656



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
##########
@@ -3778,43 +3780,50 @@ private void checkReadOnlyState(
 
         GridPlainClosure2<Collection<byte[]>, byte[], 
IgniteInternalFuture<Boolean>> startCacheClsr =
             (grpKeys, masterKeyDigest) -> {
-            List<DynamicCacheChangeRequest> srvReqs = null;
-            Map<String, DynamicCacheChangeRequest> clientReqs = null;
-
-            Iterator<byte[]> grpKeysIter = grpKeys.iterator();
-
-            for (StoredCacheData ccfg : storedCacheDataList) {
-                assert !ccfg.config().isEncryptionEnabled() || 
grpKeysIter.hasNext();
-
-                DynamicCacheChangeRequest req = prepareCacheChangeRequest(
-                    ccfg.config(),
-                    ccfg.config().getName(),
-                    null,
-                    resolveCacheType(ccfg.config()),
-                    ccfg.sql(),
-                    failIfExists,
-                    true,
-                    restartId,
-                    disabledAfterStart,
-                    ccfg.queryEntities(),
-                    ccfg.config().isEncryptionEnabled() ? grpKeysIter.next() : 
null,
-                    ccfg.config().isEncryptionEnabled() ? masterKeyDigest : 
null);
-
-                if (req != null) {
-                    if (req.clientStartOnly()) {
-                        if (clientReqs == null)
-                            clientReqs = 
U.newLinkedHashMap(storedCacheDataList.size());
-
-                        clientReqs.put(req.cacheName(), req);
-                    }
-                    else {
-                        if (srvReqs == null)
-                            srvReqs = new 
ArrayList<>(storedCacheDataList.size());
+                List<DynamicCacheChangeRequest> srvReqs = null;
+                Map<String, DynamicCacheChangeRequest> clientReqs = null;
+
+                Iterator<byte[]> grpKeysIter = grpKeys.iterator();
+
+                for (StoredCacheData ccfg : storedCacheDataList) {
+                    assert ccfg.grpKeyEncrypted() == null || 
ccfg.config().isEncryptionEnabled();
+
+                    // Reuse encription key if passed for this group. Take 
next generated otherwise.
+                    GroupKeyEncrypted encrKey = 
ccfg.config().isEncryptionEnabled() ? (ccfg.grpKeyEncrypted() != null ?
+                        ccfg.grpKeyEncrypted() : new GroupKeyEncrypted(0, 
grpKeysIter.next())) : null;
+
+                    DynamicCacheChangeRequest req = prepareCacheChangeRequest(
+                        ccfg.config(),
+                        ccfg.config().getName(),
+                        null,
+                        resolveCacheType(ccfg.config()),
+                        ccfg.sql(),
+                        failIfExists,
+                        true,
+                        restartId,
+                        disabledAfterStart,
+                        ccfg.queryEntities(),
+                        encrKey != null ? encrKey.key() : null,
+                        encrKey != null ? masterKeyDigest : null);
+
+                    if (encrKey != null)
+                        req.encryptionKeyId(encrKey.id());

Review comment:
       Fixed




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


Reply via email to