Skip to content

Commit

Permalink
add missing transaction argument, this allows it to be transaction aware
Browse files Browse the repository at this point in the history
  • Loading branch information
Tishj committed Oct 29, 2023
1 parent 1ded9f6 commit 3470d05
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
19 changes: 10 additions & 9 deletions src/catalog/catalog_entry/dependency_set_catalog_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ void DependencySetCatalogEntry::ScanSetInternal(CatalogTransaction transaction,

// Assert some invariants of the connections
if (dependencies) {
D_ASSERT(other_connections.IsDependencyOf(*this));
D_ASSERT(other_connections.IsDependencyOf(transaction, *this));
} else {
D_ASSERT(other_connections.HasDependencyOn(*this, other_entry.Type()));
D_ASSERT(other_connections.HasDependencyOn(transaction, *this, other_entry.Type()));
}
callback(other_entry);
};
Expand Down Expand Up @@ -140,7 +140,7 @@ static bool SkipDependencyRemoval(CatalogEntry &dependency) {
void DependencySetCatalogEntry::RemoveDependency(CatalogTransaction transaction, CatalogEntry &dependency) {
D_ASSERT(dependency.type == CatalogType::DEPENDENCY_ENTRY || dependency.type == CatalogType::DEPENDENCY_SET);
if (SkipDependencyRemoval(dependency)) {
D_ASSERT(!HasDependencyOnInternal(dependency));
D_ASSERT(!HasDependencyOnInternal(transaction, dependency));
return;
}
auto &name = dependency.name;
Expand All @@ -154,9 +154,9 @@ void DependencySetCatalogEntry::RemoveDependent(CatalogTransaction transaction,
dependents.DropEntry(transaction, name, false);
}

bool DependencySetCatalogEntry::IsDependencyOf(CatalogEntry &entry) {
bool DependencySetCatalogEntry::IsDependencyOf(CatalogTransaction transaction, CatalogEntry &entry) {
bool is_dependency_of = false;
dependents.Scan([&](CatalogEntry &dependent) {
dependents.Scan(transaction, [&](CatalogEntry &dependent) {
auto &dependent_entry = dependent.Cast<DependencyCatalogEntry>();
if (dependent_entry.MangledName() != DependencyManager::MangleName(entry)) {
return;
Expand All @@ -167,9 +167,9 @@ bool DependencySetCatalogEntry::IsDependencyOf(CatalogEntry &entry) {
return is_dependency_of;
}

bool DependencySetCatalogEntry::HasDependencyOnInternal(CatalogEntry &entry) {
bool DependencySetCatalogEntry::HasDependencyOnInternal(CatalogTransaction transaction, CatalogEntry &entry) {
bool has_dependency_on = false;
dependencies.Scan([&](CatalogEntry &dependency) {
dependencies.Scan(transaction, [&](CatalogEntry &dependency) {
auto &dependency_entry = dependency.Cast<DependencyCatalogEntry>();
if (dependency_entry.MangledName() != DependencyManager::MangleName(entry)) {
return;
Expand All @@ -180,13 +180,14 @@ bool DependencySetCatalogEntry::HasDependencyOnInternal(CatalogEntry &entry) {
return has_dependency_on;
}

bool DependencySetCatalogEntry::HasDependencyOn(CatalogEntry &entry, DependencyType dependent_type) {
bool DependencySetCatalogEntry::HasDependencyOn(CatalogTransaction transaction, CatalogEntry &entry,
DependencyType dependent_type) {
if (dependent_type == DependencyType::DEPENDENCY_OWNS) {
// This link is deliberately left uncompleted
return true;
}

return HasDependencyOnInternal(entry);
return HasDependencyOnInternal(transaction, entry);
}

static string FormatString(string input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ class DependencySetCatalogEntry : public InCatalogEntry {
void RemoveDependent(CatalogTransaction transaction, CatalogEntry &dependent);

public:
bool HasDependencyOn(CatalogEntry &entry, DependencyType type);
bool IsDependencyOf(CatalogEntry &entry);
bool HasDependencyOn(CatalogTransaction transaction, CatalogEntry &entry, DependencyType type);
bool IsDependencyOf(CatalogTransaction transaction, CatalogEntry &entry);

private:
//! Skips the exemption for DEPENDENCY_OWNS, use 'HasDependencyOn' instead for that
bool HasDependencyOnInternal(CatalogEntry &entry);
bool HasDependencyOnInternal(CatalogTransaction transaction, CatalogEntry &entry);
void ScanSetInternal(CatalogTransaction transaction, bool dependencies, dependency_callback_t &callback);

public:
Expand Down

0 comments on commit 3470d05

Please sign in to comment.