Skip to content

Commit

Permalink
call updateIfAbsent() for schema insert
Browse files Browse the repository at this point in the history
Change-Id: I02989962791fa369600f8dedbfd56e2b40c79077
  • Loading branch information
javeme committed Jun 6, 2022
1 parent 73c7fb8 commit 40a5196
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected void registerMetaHandlers() {
public void updateIfPresent(Session session, Entry entry) {
// TODO: use fine-grained row lock
synchronized (this.table) {
assert !session.hasChanges();
assert session == null || !session.hasChanges();
if (this.queryExist(session, entry)) {
this.insert(session, entry);
if (session != null) {
Expand All @@ -82,7 +82,7 @@ public void updateIfPresent(Session session, Entry entry) {
public void updateIfAbsent(Session session, Entry entry) {
// TODO: use fine-grained row lock
synchronized (this.table) {
assert !session.hasChanges();
assert session == null || !session.hasChanges();
if (!this.queryExist(session, entry)) {
this.insert(session, entry);
if (session != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,11 @@ private void saveSchema(SchemaElement schema, boolean update) {

if (update) {
this.doUpdateIfPresent(entry);
// TODO: support updateIfPresent
// TODO: also support updateIfPresent for index-update
this.indexTx.updateNameIndex(schema, false);
} else {
// TODO: support updateIfAbsentProperty
this.doInsert(entry);
// TODO: support updateIfAbsentProperty (property: label name)
this.doUpdateIfAbsent(entry);
this.indexTx.updateNameIndex(schema, false);
}

Expand Down

0 comments on commit 40a5196

Please sign in to comment.