Skip to content

Commit

Permalink
check schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Heng Qin committed Jun 5, 2024
1 parent d5ca7e7 commit 219641e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import static com.datastrato.gravitino.rel.expressions.transforms.Transforms.EMPTY_TRANSFORM;

import com.datastrato.gravitino.EntityStore;
import com.datastrato.gravitino.GravitinoEnv;
import com.datastrato.gravitino.NameIdentifier;
import com.datastrato.gravitino.Namespace;
import com.datastrato.gravitino.StringIdentifier;
Expand Down Expand Up @@ -88,8 +89,12 @@ public Table loadTable(NameIdentifier ident) throws NoSuchTableException {
return table;
}

TreeLockUtils.doWithTreeLock(
NameIdentifier.of(ident.namespace().levels()), LockType.WRITE, () -> importTable(ident));
if (GravitinoEnv.getInstance()
.schemaDispatcher()
.schemaExists(NameIdentifier.of(ident.namespace().levels()))) {
TreeLockUtils.doWithTreeLock(
NameIdentifier.of(ident.namespace().levels()), LockType.WRITE, () -> importTable(ident));
}

return table;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static com.datastrato.gravitino.catalog.PropertiesMetadataHelpers.validatePropertyForCreate;

import com.datastrato.gravitino.EntityStore;
import com.datastrato.gravitino.GravitinoEnv;
import com.datastrato.gravitino.NameIdentifier;
import com.datastrato.gravitino.Namespace;
import com.datastrato.gravitino.StringIdentifier;
Expand Down Expand Up @@ -79,8 +80,12 @@ public Topic loadTopic(NameIdentifier ident) throws NoSuchTopicException {
return topic;
}

TreeLockUtils.doWithTreeLock(
NameIdentifier.of(ident.namespace().levels()), LockType.WRITE, () -> importTopic(ident));
if (GravitinoEnv.getInstance()
.schemaDispatcher()
.schemaExists(NameIdentifier.of(ident.namespace().levels()))) {
TreeLockUtils.doWithTreeLock(
NameIdentifier.of(ident.namespace().levels()), LockType.WRITE, () -> importTopic(ident));
}
return topic;
}

Expand Down

0 comments on commit 219641e

Please sign in to comment.