-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Review Hannah, some more changes + two more TODOs
- Loading branch information
Hannah Bast
committed
Nov 8, 2024
1 parent
15edb4d
commit 2647790
Showing
7 changed files
with
79 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
// Copyright 2011, University of Freiburg, | ||
// Chair of Algorithms and Data Structures. | ||
// Author: | ||
// 2011-2017 Björn Buchhold ([email protected]) | ||
// 2018- Johannes Kalmbach ([email protected]) | ||
// Copyright 2011 - 2024, University of Freiburg | ||
// Chair of Algorithms and Data Structures | ||
// Authors: Björn Buchhold <[email protected]> [2011 - 2017] | ||
// Johannes Kalmbach <[email protected]> [2017 - 2024] | ||
|
||
#pragma once | ||
|
||
|
@@ -127,9 +126,10 @@ class QueryExecutionContext { | |
private: | ||
const Index& _index; | ||
|
||
// When the `QueryExecutionContext` is constructed, get a stable snapshot of | ||
// the current UPDATE status from the `DeltaTriplesManager`, which can then by | ||
// used by the query without interfering with concurrent UPDATEs. | ||
// When the `QueryExecutionContext` is constructed, get a stable read-only | ||
// snapshot of the current (located) delta triples. These can then be used | ||
// by the respective query without interfering with further incoming | ||
// update operations. | ||
SharedLocatedTriplesSnapshot sharedLocatedTriplesSnapshot{ | ||
_index.deltaTriplesManager().getCurrentSnapshot()}; | ||
QueryResultCache* const _subtreeCache; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
// Copyright 2015, University of Freiburg, | ||
// Chair of Algorithms and Data Structures. | ||
// Author: | ||
// 2015-2017 Björn Buchhold ([email protected]) | ||
// 2018- Johannes Kalmbach ([email protected]) | ||
// Copyright 2015 - 2024, University of Freiburg | ||
// Chair of Algorithms and Data Structures | ||
// Authors: Björn Buchhold <[email protected]> [2015 - 2017] | ||
// Johannes Kalmbach <[email protected]> [2017 - 2024] | ||
|
||
#include "./QueryExecutionTree.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
// Copyright 2015, University of Freiburg, | ||
// Chair of Algorithms and Data Structures. | ||
// Author: Björn Buchhold ([email protected]) | ||
// Copyright 2015 - 2024, University of Freiburg | ||
// Chair of Algorithms and Data Structures | ||
// Authors: Björn Buchhold <[email protected]> | ||
// Johannes Kalmbach <[email protected]> | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
// Copyright 2023 - 2024, University of Freiburg | ||
// Chair of Algorithms and Data Structures. | ||
// Authors: | ||
// 2023 Hannah Bast <bast@cs.uni-freiburg.de> | ||
// 2024 Julian Mundhahs <mundhahj@tf.uni-freiburg.de> | ||
// Chair of Algorithms and Data Structures | ||
// Authors: Hannah Bast <[email protected]> | ||
// Julian Mundhahs <mundhahj@tf.uni-freiburg.de> | ||
// Johannes Kalmbach <kalmbach@cs.uni-freiburg.de> | ||
|
||
#include "index/DeltaTriples.h" | ||
|
||
|
@@ -179,8 +179,9 @@ LocatedTriplesSnapshot::getLocatedTriplesForPermutation( | |
|
||
// ____________________________________________________________________________ | ||
SharedLocatedTriplesSnapshot DeltaTriples::getSnapshot() const { | ||
// Note: Semantically, both the members are copied, but the `localVocab_` has | ||
// no explicit copy constructor, hence the explicit `clone`. | ||
// NOTE: Both members of the `LocatedTriplesSnapshot` are copied, but the | ||
// `localVocab_` has no copy constructor (in order to avoid accidental | ||
// copies), hence the explicit `clone`. | ||
return SharedLocatedTriplesSnapshot{std::make_shared<LocatedTriplesSnapshot>( | ||
locatedTriples(), localVocab_.clone())}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
// Copyright 2023 - 2024, University of Freiburg | ||
// Chair of Algorithms and Data Structures. | ||
// Authors: | ||
// 2023 Hannah Bast <bast@cs.uni-freiburg.de> | ||
// 2024 Julian Mundhahs <mundhahj@tf.uni-freiburg.de> | ||
// Chair of Algorithms and Data Structures | ||
// Authors: Hannah Bast <[email protected]> | ||
// Julian Mundhahs <mundhahj@tf.uni-freiburg.de> | ||
// Johannes Kalmbach <kalmbach@cs.uni-freiburg.de> | ||
|
||
#pragma once | ||
|
||
|
@@ -31,8 +31,8 @@ struct LocatedTriplesSnapshot { | |
Permutation::Enum permutation) const; | ||
}; | ||
|
||
// A `shared_ptr` to a const `LocatedTriplesSnapshot`, but as an explicit class, | ||
// s.t. it can be forward-declared. | ||
// A shared pointer to a constant `LocatedTriplesSnapshot`, but as an explicit | ||
// class, such that it can be forward-declared. | ||
class SharedLocatedTriplesSnapshot | ||
: public std::shared_ptr<const LocatedTriplesSnapshot> {}; | ||
|
||
|
@@ -194,21 +194,13 @@ class DeltaTriplesManager { | |
explicit DeltaTriplesManager(const IndexImpl& index); | ||
FRIEND_TEST(DeltaTriplesTest, DeltaTriplesManager); | ||
|
||
// Modify the underlying `DeltaTriples` by applying the `function` to them. | ||
// Then update the current snapshot, s.t. subsequent calls to | ||
// `getCurrentSnapshot` will observe the modifications. All this is done in a | ||
// thread-safe way, meaning that there can be only one call to `modify` at the | ||
// same time. | ||
// Modify the underlying `DeltaTriples` by applying `function` and then update | ||
// the current snapshot. Concurrent calls to `modify` will be serialized, and | ||
// each call to `getCurrentSnapshot` will either return the snapshot before or | ||
// after a modification, but never one of an ongoing modification. | ||
void modify(std::function<void(DeltaTriples&)> function); | ||
|
||
// Return a `SharedLocatedTriplesSnapshot` that contains a deep copy of the | ||
// state of the underlying `DeltaTriples` after the last completed UPDATE, and | ||
// thus is not affected by future UPDATE requests. It can therefore be used to | ||
// execute a query in a consistent way. | ||
// Return a shared pointer to a deep copy of the current snapshot. This can | ||
// be safely used to execute a query without interfering with future updates. | ||
SharedLocatedTriplesSnapshot getCurrentSnapshot() const; | ||
}; | ||
|
||
// DELTA TRIPLES AND THE CACHE | ||
// | ||
// Changes to the DeltaTriples invalidate all cache results that have an index | ||
// scan in their subtree, which is almost all entries in practice. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
// Copyright 2018, University of Freiburg, | ||
// Chair of Algorithms and Data Structures. | ||
// Author: Johannes Kalmbach<joka921> ([email protected]) | ||
// Copyright 2018 - 2024, University of Freiburg | ||
// Chair of Algorithms and Data Structures | ||
// Author: Johannes Kalmbach <[email protected]> | ||
|
||
#pragma once | ||
|
||
#include <array> | ||
|
@@ -148,20 +149,21 @@ class Permutation { | |
const Permutation& getActualPermutation(const ScanSpecification& spec) const; | ||
const Permutation& getActualPermutation(Id id) const; | ||
|
||
// From the given snapshot, get the located triples for this permutation. | ||
const LocatedTriplesPerBlock& getLocatedTriplesForPermutation( | ||
const LocatedTriplesSnapshot& locatedTriplesSnapshot) const; | ||
|
||
const CompressedRelationReader& reader() const { return reader_.value(); } | ||
|
||
private: | ||
// for Log output, e.g. "POS" | ||
// Readable name for this permutation, e.g., `POS`. | ||
std::string readableName_; | ||
// e.g. ".pos" | ||
// File name suffix for this permutation, e.g., `.pos`. | ||
std::string fileSuffix_; | ||
// order of the 3 keys S(0), P(1), and O(2) for which this permutation is | ||
// sorted, for example {1, 0, 2} for PSO. | ||
// The order of the three components (S=0, P=1, O=2) in this permutation, | ||
// e.g., `{1, 0, 2}` for `PSO`. | ||
array<size_t, 3> keyOrder_; | ||
|
||
// The metadata for this permutation. | ||
MetaData meta_; | ||
|
||
// This member is `optional` because we initialize it in a deferred way in the | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters