GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — Bump metrics.version from 4.2.2 to 4.2.3 by dependabot[bot] · Pull Request #6 · ArcadeData/arcadedb Conversation
|
|
@dependabot rebase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Bumps `metrics.version` from 4.2.2 to 4.2.3. Updates `metrics-core` from 4.2.2 to 4.2.3 - [Release notes](https://github.com/dropwizard/metrics/releases) - [Commits](dropwizard/metrics@v4.2.2...v4.2.3) Updates `metrics-jmx` from 4.2.2 to 4.2.3 - [Release notes](https://github.com/dropwizard/metrics/releases) - [Commits](dropwizard/metrics@v4.2.2...v4.2.3) --- updated-dependencies: - dependency-name: io.dropwizard.metrics:metrics-core dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.dropwizard.metrics:metrics-jmx dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]>
68e0b2f to
1e1c6f0
Compare
…n-4.2.3 Bump metrics.version from 4.2.2 to 4.2.3
…crosses record kinds (#12063) Fixes #12028 Fixes #12029 Both issues are missing refusals in the same place: the checks a super type link is asked before anything changes (`LocalDocumentType.checkCanAddSuperType`, which `ALTER TYPE ... SUPERTYPE +`, `Schema` API `addSuperType` and `TypeBuilder` on an existing type all go through). So they are fixed together, in one PR. ### What changes - **Cycle (#12028)**: `checkCanAddSuperType` refuses, first and for every linkage, a super type that is the type itself or already one of its sub types (`DocumentType.isSubTypeOf`, which only walks up the super type lists and so ends). The statement is refused with a `SchemaException` (HTTP 400) before the link is made, so nothing is left in memory. It used to link, overflow the stack in the post-link steps (a `StackOverflowError` is not the `RuntimeException` the unlink guard catches), and keep the cycle. - **Load**: a `schema.json` that already holds a cycle (the next schema save after the old 500 could write one) still opens. The inheritance restore leaves out the link that would close the cycle and logs a warning naming it. Before, every polymorphic walk over the loaded cycle overflowed. - **Record kind (#12029)**: a new linkage refuses a graph super type of another kind (a document or edge type under a vertex type, a vertex or document type under an edge type), in `checkCanAddSuperType` for ALTER and in `TypeBuilder` for a new type (`CREATE ... TYPE ... EXTENDS` and the Java builder). A DOCUMENT super type stays legal for a vertex or an edge type: existing schemas use it to share properties (`SchemaTest.dropNonExistentIndexThenCreateProperty` has `CREATE VERTEX TYPE ... EXTENDS <document type>`), and a vertex or an edge is a document, so a scan of the super type reads nothing it cannot hold. Linkages that already hold (schema load, re-attachment after `DROP TYPE`) are not asked, so a database written before the check still opens. ### Tests `SuperTypeAdmissionTest` (new, engine, one nested class per issue): - cycle refused through SQL (direct and two levels down), the Java API and the type builder; schema unchanged, `SELECT FROM A` and `CREATE PROPERTY A.y` work after; - a hand-edited `schema.json` holding a cycle opens, keeps two of the three links, scans and saves; - ALTER refuses document under vertex, vertex under edge, edge under vertex; same kind, and vertex or edge under document, stay legal; Cypher `MATCH (v:V)` answers; - `CREATE DOCUMENT TYPE ... EXTENDS <vertex>`, `CREATE EDGE TYPE ... EXTENDS <vertex>`, `CREATE VERTEX TYPE ... EXTENDS <edge>` and `buildDocumentType().withSuperType(<vertex>)` refused, no type created; `CREATE VERTEX TYPE ... EXTENDS <document>` and an edge type built over a document type stay legal; - a hand-edited `schema.json` with a cross-kind link still opens. ### Results Engine tests (Docker, maven:3.9-eclipse-temurin-21): - failing-first with `engine/src/main` from origin/main: `SuperTypeAdmissionTest` 6 run, 5 fail (4 failures, 1 error: `aSchemaFileWithACycleStillOpens` StackOverflowError). - `-Dtest='com/arcadedb/schema/**/*Test,SuperTypeAdmissionTest' -DexcludedGroups=slow`: 1812 tests, 0 failures, 0 errors, 0 skipped. - whole engine module, `-pl engine test -DexcludedGroups=slow`: 27969 tests, 2 failures, 3 errors, 22 skipped. None is from this change: `ParallelSafeExpressionsStateTest` (1 failure) and `CypherCallInTransactionsOnErrorIssue11595Test` (3 errors) fail the same way with `engine/src/main` from origin/main; `ReplicatedApplyPublicationTest` (1 failure) passed on origin/main and passed again alone on this branch (timing-dependent). - server module, `-pl server -am test -Dtest='com/arcadedb/server/**/*Http*Test,com/arcadedb/server/**/*Command*Test,com/arcadedb/server/**/*Schema*Test'`: 263 tests, 0 failures, 0 errors, 0 skipped. - server ITs that send DDL and assert HTTP statuses (28 classes, among them `HTTPDocumentIT`, `HTTPGraphIT`, `RemoteDatabaseIT`, `SchemaMutationAuthorizationIT`, `FacetsSubtypeAclIT`, `TestLinkedPropertiesSchemaReloadIT`): 187 tests, 0 failures, 0 errors, 0 skipped. End to end, HTTP against a server built from main (`s12028` repro): Server with the main jars (a7304ab): version 200 == cycle: A <- B <- C, then ALTER TYPE A SUPERTYPE +C 200 CREATE VERTEX TYPE A -> [{"operation": "create vertex type", "typeName": "A", "created": true}] 200 CREATE VERTEX TYPE B EXTENDS A -> [{"operation": "create vertex type", "typeName": "B", "created": true}] 200 CREATE VERTEX TYPE C EXTENDS B -> [{"operation": "create vertex type", "typeName": "C", "created": true}] 200 INSERT INTO C SET x = 1 -> [{"@Rid": "#7:0", "@type": "C", "@cat": "v", "x": 1}] 500 ALTER TYPE A SUPERTYPE +C -> "DatabaseOperationException: Error during write lock -> StackOverflowError" 200 SELECT name, parentTypes FROM schema:types ORDER BY name -> [{"name": "A", "parentTypes": ["C"]}, {"name": "B", "parentTypes": ["A"]}, {"name": "C", "parentTypes": ["B"]}] 200 SELECT count(*) FROM A -> [{"count(*)": 1}] 500 SELECT FROM A -> "StackOverflowError: java.lang.StackOverflowError" 500 CREATE PROPERTY A.y INTEGER -> "DatabaseOperationException: Error during write lock -> StackOverflowError" 400 INSERT INTO A SET x = 2 -> "CommandSQLParsingException: The statement is nested or chained too deeply to be executed (the thread stack overflowed while building the plan) -> StackOverflowError" == cross kind: document type D gets vertex super type V; vertex type W gets edge super type E 200 CREATE VERTEX TYPE V -> [{"operation": "create vertex type", "typeName": "V", "created": true}] 200 CREATE DOCUMENT TYPE D -> [{"operation": "create document type", "typeName": "D", "created": true}] 200 CREATE EDGE TYPE E -> [{"operation": "create edge type", "typeName": "E", "created": true}] 200 CREATE VERTEX TYPE W -> [{"operation": "create vertex type", "typeName": "W", "created": true}] 200 INSERT INTO V SET n = 1 -> [{"@Rid": "#1:0", "@type": "V", "@cat": "v", "n": 1}] 200 INSERT INTO D SET n = 2 -> [{"@Rid": "#4:0", "@type": "D", "@cat": "d", "n": 2}] 200 INSERT INTO W SET n = 3 -> [{"@Rid": "#6:0", "@type": "W", "@cat": "v", "n": 3}] 200 ALTER TYPE D SUPERTYPE +V -> [{"supertype": ["V"], "operation": "ALTER TYPE", "typeName": "D", "result": "OK"}] 200 ALTER TYPE W SUPERTYPE +E -> [{"supertype": ["E"], "operation": "ALTER TYPE", "typeName": "W", "result": "OK"}] 200 SELECT name, type, parentTypes FROM schema:types ORDER BY name -> [{"name": "D", "type": "document", "parentTypes": ["V"]}, {"name": "E", "type": "edge", "parentTypes": []}, {"name": "V", "type": "vertex", "parentTypes": []}, {"name": "W", "type": "vertex", "parentTypes": ["E"]}] 200 SELECT @Rid, @type, @cat, n FROM V -> [{"@Rid": "#1:0", "@type": "V", "@cat": "v", "n": 1}, {"@Rid": "#4:0", "@type": "D", "@cat": "d", "n": 2}] 500 MATCH (v:V) RETURN v.n -> "ClassCastException: Cannot cast the document #4:0 to a vertex" 200 SELECT @Rid, @type, @cat, n FROM E -> [{"@Rid": "#6:0", "@type": "W", "@cat": "v", "n": 3}] 200 MATCH ()-[e:E]->() RETURN count(e) -> [{"count(e)": 0}] Same server, engine jar built from this branch: version 200 == cycle: A <- B <- C, then ALTER TYPE A SUPERTYPE +C 200 CREATE VERTEX TYPE A -> [{"operation": "create vertex type", "typeName": "A", "created": true}] 200 CREATE VERTEX TYPE B EXTENDS A -> [{"operation": "create vertex type", "typeName": "B", "created": true}] 200 CREATE VERTEX TYPE C EXTENDS B -> [{"operation": "create vertex type", "typeName": "C", "created": true}] 200 INSERT INTO C SET x = 1 -> [{"@Rid": "#7:0", "@type": "C", "@cat": "v", "x": 1}] 400 ALTER TYPE A SUPERTYPE +C -> "SchemaException: Cannot make type 'A' a sub type of 'C': 'C' is already a sub type of 'A', and a type hierarchy cannot have a cycle" 200 SELECT name, parentTypes FROM schema:types ORDER BY name -> [{"name": "A", "parentTypes": []}, {"name": "B", "parentTypes": ["A"]}, {"name": "C", "parentTypes": ["B"]}] 200 SELECT count(*) FROM A -> [{"count(*)": 1}] 200 SELECT FROM A -> [{"@Rid": "#7:0", "@type": "C", "@cat": "v", "x": 1}] 200 CREATE PROPERTY A.y INTEGER -> [{"operation": "create property", "typeName": "A", "propertyName": "y", "created": true}] 200 INSERT INTO A SET x = 2 -> [{"@Rid": "#1:0", "@type": "A", "@cat": "v", "x": 2}] == cross kind: document type D gets vertex super type V; vertex type W gets edge super type E 200 CREATE VERTEX TYPE V -> [{"operation": "create vertex type", "typeName": "V", "created": true}] 200 CREATE DOCUMENT TYPE D -> [{"operation": "create document type", "typeName": "D", "created": true}] 200 CREATE EDGE TYPE E -> [{"operation": "create edge type", "typeName": "E", "created": true}] 200 CREATE VERTEX TYPE W -> [{"operation": "create vertex type", "typeName": "W", "created": true}] 200 INSERT INTO V SET n = 1 -> [{"@Rid": "#1:0", "@type": "V", "@cat": "v", "n": 1}] 200 INSERT INTO D SET n = 2 -> [{"@Rid": "#4:0", "@type": "D", "@cat": "d", "n": 2}] 200 INSERT INTO W SET n = 3 -> [{"@Rid": "#6:0", "@type": "W", "@cat": "v", "n": 3}] 400 ALTER TYPE D SUPERTYPE +V -> "SchemaException: Cannot make the document type 'D' a sub type of the vertex type 'V': a type can only extend a document type or a type of its own kind" 400 ALTER TYPE W SUPERTYPE +E -> "SchemaException: Cannot make the vertex type 'W' a sub type of the edge type 'E': a type can only extend a document type or a type of its own kind" 200 SELECT name, type, parentTypes FROM schema:types ORDER BY name -> [{"name": "D", "type": "document", "parentTypes": []}, {"name": "E", "type": "edge", "parentTypes": []}, {"name": "V", "type": "vertex", "parentTypes": []}, {"name": "W", "type": "vertex", "parentTypes": []}] 200 SELECT @Rid, @type, @cat, n FROM V -> [{"@Rid": "#1:0", "@type": "V", "@cat": "v", "n": 1}] 200 MATCH (v:V) RETURN v.n -> [{"v.n": 1}] 200 SELECT @Rid, @type, @cat, n FROM E -> [] 200 MATCH ()-[e:E]->() RETURN count(e) -> [{"count(e)": 0}] Overlap note: separate PRs for #12031, #12032, #12035, #12036, #12038 and #12039 are being prepared in the same area (`LocalDocumentType`, `LocalSchema`, `ExistingRecordsCheck`, the ALTER/CREATE TYPE statements). Textual merge conflicts with them are possible; the changes are meant to be independent. This PR and the one for #12030 both add a step at the end of `LocalDocumentType.checkCanAddSuperType`, so the second to merge needs a small rebase. ### Merge note: #12067 This PR conflicts textually with #12067 in `LocalDocumentType.java`, around line 3496. Both add private methods directly after `checkCanAddSuperType`. This PR adds `checkNoCycle`, `checkSameRecordKind` and `recordKindName`; #12067 adds `checkStoredRecordsMeetInheritedProperties`. To resolve it, keep both blocks. One ordering rule applies after the merge. #12067's stored-record scan (`checkStoredRecordsMeetInheritedProperties`, which walks `superType.getPolymorphicProperties()`) has to stay after the `checkNoCycle` call that this PR puts at the head of `checkCanAddSuperType`. Run before it, that walk could follow a cycle before the cycle check refuses it. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Schema inheritance now rejects cycles and incompatible record types, preventing invalid parent-child relationships from being created through SQL commands or builders. * Existing schema files with cyclic or incompatible inheritance links can still load; invalid links are skipped. * Type removal now refuses to proceed when reattaching child types would create an incompatible relationship. Same-kind inheritance and document supertypes for graph types remain supported. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: lvca <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.