JAkutenshi commented on code in PR #6712:
URL: https://github.com/apache/ignite-3/pull/6712#discussion_r2452802124
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CreateTableCommand.java:
##########
@@ -127,13 +139,36 @@ public List<UpdateEntry> get(UpdateContext updateContext)
{
ensureNoTableIndexOrSysViewExistsWithGivenName(schema, tableName);
+ int id = catalog.objectIdGenState();
+ int tableId = id++;
+ int pkIndexId = id++;
+
+ // We will have at max 5 entries if there is lazy default data zone
creation action is needed.
+ List<UpdateEntry> updateEntries = new ArrayList<>(5);
+
CatalogZoneDescriptor zone;
if (zoneName == null) {
if (catalog.defaultZone() == null) {
- throw new CatalogValidationException("The zone is not
specified. Please specify zone explicitly or set default one.");
+ int zoneId = id++;
+
+ zone = new CatalogZoneDescriptor(
Review Comment:
New tests are added:
- `testCreateDefaultZoneLazilyIfNoZonesProvided`
- `testDefaultZoneCreationIsIdempotent`
- `testDefaultZoneCannotBeCreatedIfDefaultNameIsAlreadyInUse`
Previous tests' changes in the same test class are reverted.
##########
modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItZonesSystemViewTest.java:
##########
@@ -49,6 +49,10 @@ public class ItZonesSystemViewTest extends
AbstractSystemViewTest {
@Test
public void systemViewDefaultZone() {
IgniteImpl node = unwrapIgniteImpl(CLUSTER.aliveNode());
+
+ // Table for default zone creation
Review Comment:
Good idea, I've added checks before and after create table through zone
system view check. Thanks!
##########
modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java:
##########
@@ -592,6 +581,10 @@ private static int defaultZoneId(CatalogManager catalog) {
return
catalog.catalog(catalog.latestCatalogVersion()).defaultZone().id();
}
+ private static boolean isDefaultZoneExists(CatalogManager catalog) {
Review Comment:
Fair point. Fixed.
##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogZoneTest.java:
##########
@@ -53,13 +53,21 @@
import org.apache.ignite.internal.catalog.events.CreateZoneEventParameters;
import org.apache.ignite.internal.catalog.events.DropZoneEventParameters;
import org.apache.ignite.internal.event.EventListener;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/** Tests for zone related commands. */
public class CatalogZoneTest extends BaseCatalogManagerTest {
+ private static final String DEFAULT_ZONE_TABLE = "DEFAULT_ZONE_TABLE";
+
private static final String TEST_ZONE_NAME = "TEST_ZONE_NAME";
+ @BeforeEach
+ public void createTableWithLazyDefaultZone() {
Review Comment:
In the base class after each tests components correct stopping process and
before each recreates every components again, catalog manager too. I see no
reason to drop table and zone manually if they'll be deleted on base class
level.
--
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]