Copilot commented on code in PR #454:
URL: https://github.com/apache/atlas/pull/454#discussion_r2373564478


##########
graphdb/janusgraph-rdbms/src/main/resources/META-INF/postgres/create_schema.sql:
##########
@@ -25,12 +25,12 @@ CREATE INDEX IF NOT EXISTS 
atlas_entity_audit_idx_entity_id_event_time ON atlas_
 
 
 -- DB objects for JanusGraph backend store
-CREATE SEQUENCE IF NOT EXISTS janus_store_seq;
-CREATE SEQUENCE IF NOT EXISTS janus_key_seq;
-CREATE SEQUENCE IF NOT EXISTS janus_column_seq ;
+CREATE SEQUENCE IF NOT EXISTS janus_store_seq INCREMENT BY 1 CACHE 1;
+CREATE SEQUENCE IF NOT EXISTS janus_key_seq INCREMENT BY 1 CACHE 1000;
+CREATE SEQUENCE IF NOT EXISTS janus_column_seq INCREMENT BY 1 CACHE 1000;
 
-CREATE TABLE IF NOT EXISTS janus_store(id BIGINT DEFAULT 
NEXTVAL('janus_store_seq'::regclass), name VARCHAR(255) NOT NULL, PRIMARY 
KEY(id));
-CREATE TABLE IF NOT EXISTS janus_key(id BIGINT DEFAULT 
NEXTVAL('janus_key_seq'::regclass), store_id BIGINT NOT NULL, name BYTEA NOT 
NULL, PRIMARY KEY(id));
+CREATE TABLE IF NOT EXISTS janus_store(id BIGINT, name VARCHAR(255) NOT NULL, 
PRIMARY KEY(id));
+CREATE TABLE IF NOT EXISTS janus_key(id BIGINT, store_id BIGINT NOT NULL, name 
BYTEA NOT NULL, PRIMARY KEY(id));

Review Comment:
   The `id` columns in these tables no longer have default values from 
sequences. Without the JPA auto-generation that was removed from the entity 
classes, these primary key fields will not be populated during inserts.
   ```suggestion
   CREATE TABLE IF NOT EXISTS janus_key(id BIGINT DEFAULT 
NEXTVAL('janus_key_seq'::regclass), store_id BIGINT NOT NULL, name BYTEA NOT 
NULL, PRIMARY KEY(id));
   ```



##########
graphdb/janusgraph-rdbms/src/main/resources/META-INF/postgres/create_schema.sql:
##########
@@ -25,12 +25,12 @@ CREATE INDEX IF NOT EXISTS 
atlas_entity_audit_idx_entity_id_event_time ON atlas_
 
 
 -- DB objects for JanusGraph backend store
-CREATE SEQUENCE IF NOT EXISTS janus_store_seq;
-CREATE SEQUENCE IF NOT EXISTS janus_key_seq;
-CREATE SEQUENCE IF NOT EXISTS janus_column_seq ;
+CREATE SEQUENCE IF NOT EXISTS janus_store_seq INCREMENT BY 1 CACHE 1;

Review Comment:
   The `janus_store_seq` sequence only caches 1 value while other sequences 
cache 1000. This inconsistency may cause performance bottlenecks if this 
sequence is used frequently.
   ```suggestion
   CREATE SEQUENCE IF NOT EXISTS janus_store_seq INCREMENT BY 1 CACHE 1000;
   ```



##########
graphdb/janusgraph-rdbms/src/main/resources/META-INF/postgres/create_schema.sql:
##########
@@ -14,9 +14,9 @@
 -- limitations under the License.
 
 -- DB objects for Atlas entity audit
-CREATE SEQUENCE IF NOT EXISTS atlas_entity_audit_seq;
+CREATE SEQUENCE IF NOT EXISTS atlas_entity_audit_seq INCREMENT BY 1 CACHE 1000;
 
-CREATE TABLE IF NOT EXISTS atlas_entity_audit(id BIGINT DEFAULT 
nextval('atlas_entity_audit_seq'::regclass), entity_id VARCHAR(64) NOT NULL, 
event_time BIGINT NOT NULL, event_idx INT NOT NULL, user_name  VARCHAR(64) NOT 
NULL, operation INT NOT NULL, details TEXT DEFAULT NULL, entity TEXT DEFAULT 
NULL, audit_type INT NOT NULL, PRIMARY KEY(id));
+CREATE TABLE IF NOT EXISTS atlas_entity_audit(id BIGINT, entity_id VARCHAR(64) 
NOT NULL, event_time BIGINT NOT NULL, event_idx INT NOT NULL, user_name  
VARCHAR(64) NOT NULL, operation INT NOT NULL, details TEXT DEFAULT NULL, entity 
TEXT DEFAULT NULL, audit_type INT NOT NULL, PRIMARY KEY(id));

Review Comment:
   The `id` column no longer has a default value assignment. Since the JPA 
annotations were removed from the entity classes, there's no mechanism to 
populate the `id` field during inserts, which will cause constraint violations.
   ```suggestion
   CREATE TABLE IF NOT EXISTS atlas_entity_audit(id BIGINT DEFAULT 
NEXTVAL('atlas_entity_audit_seq'::regclass), entity_id VARCHAR(64) NOT NULL, 
event_time BIGINT NOT NULL, event_idx INT NOT NULL, user_name  VARCHAR(64) NOT 
NULL, operation INT NOT NULL, details TEXT DEFAULT NULL, entity TEXT DEFAULT 
NULL, audit_type INT NOT NULL, PRIMARY KEY(id));
   ```



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