rpuch commented on code in PR #2228:
URL: https://github.com/apache/ignite-3/pull/2228#discussion_r1238416697


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogServiceImpl.java:
##########
@@ -773,11 +783,21 @@ private void registerCatalog(Catalog newCatalog) {
         catalogByTs.put(newCatalog.time(), newCatalog);
     }
 
-    private CompletableFuture<Void> saveUpdate(UpdateProducer updateProducer) {
-        return saveUpdate(updateProducer, 0);
+    private CompletableFuture<Void> 
saveUpdateAndWaitForActivation(UpdateProducer updateProducer) {
+        return saveUpdate(updateProducer, 0)
+                .thenCompose(newVersion -> versionTracker.waitFor(newVersion)
+                        .thenCompose(unused -> {
+                            Catalog catalog = catalogByVer.get(newVersion);
+                            HybridTimestamp activationTs = 
HybridTimestamp.hybridTimestamp(catalog.time());
+                            HybridTimestamp clusterWideEnsuredActivationTs = 
activationTs.addPhysicalTime(
+                                    HybridTimestamp.maxClockSkew()

Review Comment:
   The IEP says the following:
   
   > Before an update is reported as installed to the client, an additional 
wait happens to make sure that the client’s request on any node will see the 
installed update after the installation call returns. The required wait is 
until the schema update activation becomes non-future on all nodes (taking 
clock skew into account, so the client must wait for at least Now ≥ Tu+CSmax).
   
   Here, Tu is activation moment of the schema update and CSMax is max clock 
skew, so the code reflects what IEP prescribes.
   
   Actual propagation time might be anything, we cannot bound it, but it's not 
a problem. When the client (after issuing a CREATE TABLE) sends a request to 
any cluster node, the HLC at the node is guaranteed (by the boundedness of 
CSMax) to be ahead of the activation moment; the node will take HLC.now as the 
client's operation ts T, and then it will wait till it gets all the schema 
updates required to process operation at timestamp T, so HERE we'll account for 
a possible MetaStorage lag of the node, not when installing the update.



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