timoninmaxim commented on code in PR #319:
URL: https://github.com/apache/ignite-extensions/pull/319#discussion_r2281760829


##########
modules/cdc-ext/src/main/java/org/apache/ignite/cdc/postgresql/IgniteToPostgreSqlCdcApplier.java:
##########
@@ -367,24 +275,30 @@ public long applyCacheEvents(Iterator<CdcCacheEvent> 
evts, boolean createTables)
             if (evt.queryEntities().size() != 1)
                 throw new IgniteException("There should be exactly 1 
QueryEntity for cacheId: " + evt.cacheId());
 
-            entity = evt.queryEntities().iterator().next();
+            try {
+                entity = evt.queryEntities().iterator().next();
 
-            if (createTables)
-                createTableIfNotExists(entity);
+                if (createTables)
+                    createTableIfNotExists(entity);
 
-            cacheIdToUpsertQry.put(evt.cacheId(), getUpsertSqlQry(entity));
+                cacheIdToUpsertQry.put(evt.cacheId(), getUpsertSqlQry(entity));
 
-            cacheIdToDeleteQry.put(evt.cacheId(), getDeleteSqlQry(entity));
+                cacheIdToDeleteQry.put(evt.cacheId(), getDeleteSqlQry(entity));
 
-            cacheIdToPrimaryKeys.put(evt.cacheId(), getPrimaryKeys(entity));
+                cacheIdToPrimaryKeys.put(evt.cacheId(), 
getPrimaryKeys(entity));
 
-            cacheIdToFields.put(evt.cacheId(), entity.getFields().keySet());
+                cacheIdToFields.put(evt.cacheId(), 
entity.getFields().keySet());
 
-            if (createTables && log.isInfoEnabled())
-                log.info("Cache table created [tableName=" + 
entity.getTableName() +
-                    ", columns=" + entity.getFields().keySet() + ']');
+                if (createTables && log.isInfoEnabled())
+                    log.info("Cache table created [tableName=" + 
entity.getTableName() +
+                        ", columns=" + entity.getFields().keySet() + ']');
 
-            cnt++;
+                cnt++;
+            }
+            catch (IgniteException e) {
+                throw new IgniteException("Error occurred while creating 
PostgreSQL table for CdcCacheEvent [cacheId=" +

Review Comment:
   what if IgniteException will be thrown when user set `createTable = false`?



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to