sanpwc commented on a change in pull request #160:
URL: https://github.com/apache/ignite-3/pull/160#discussion_r646338116



##########
File path: 
modules/runner/src/main/java/org/apache/ignite/internal/storage/DistributedConfigurationStorage.java
##########
@@ -82,43 +85,41 @@
      *
      * @param metaStorageMgr MetaStorage Manager.
      */
-    public DistributedConfigurationStorage(MetaStorageManager metaStorageMgr) {
+    public DistributedConfigurationStorage(MetaStorageManager metaStorageMgr, 
VaultManager vaultMgr) {
         this.metaStorageMgr = metaStorageMgr;
+
+        this.vaultMgr = vaultMgr;
     }
 
     /** {@inheritDoc} */
     @Override public synchronized Data readAll() throws StorageException {
         HashMap<String, Serializable> data = new HashMap<>();
 
-        Iterator<Entry> entries = allDistributedConfigKeys().iterator();
+        var entries = allStoredDstCfgKeysFromVault();
 
-        long maxRevision = 0L;
+        long appliedRevision = 0L;
 
         if (!entries.hasNext())
             return new Data(data, ver.get());
 
-        Entry entryForMasterKey = entries.next();
-
-        // First key must be the masterKey because it's supposed to be the 
first in lexicographical order
-        assert entryForMasterKey.key().equals(MASTER_KEY);
-
         while (entries.hasNext()) {
-            Entry entry = entries.next();
+            var entry = entries.next();
 
-            
data.put(entry.key().toString().substring((DISTRIBUTED_PREFIX).length()), 
(Serializable)ByteUtils.fromBytes(entry.value()));
+            if (entry.key().equals(MetaStorageManager.APPLIED_REV)) {
+                appliedRevision = 
ByteUtils.bytesToLong(Objects.requireNonNull(entry.value()), 0);
 
-            // Move to stream
-            if (maxRevision < entry.revision())
-                maxRevision = entry.revision();
+                continue;
+            }
 
+            
data.put(entry.key().toString().substring((DISTRIBUTED_PREFIX).length()), 
(Serializable)ByteUtils.fromBytes(entry.value()));
         }
 
         if (!data.isEmpty()) {
-            assert maxRevision == entryForMasterKey.revision();
+            assert appliedRevision > 0;
 
-            assert maxRevision >= ver.get();
+            assert appliedRevision >= ver.get();

Review comment:
       Let's add meaningful messages here that will clarify why it's invalid to 
have `appliedRevision < ver.get()`




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

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


Reply via email to