aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-08-27 10:26:54 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-08-27 10:26:54 +0000
commit6a31dd20690d94bbdb12e9f6b1e94b2517fa4c5a (patch)
treea339a654f0f1c68e4cfd38fdba572194722baee0 /searchcore
parentdc2b32f81cc58c2ca03ee67a25526bab03a12d63 (diff)
Improve comments and unify naming.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.h25
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp8
2 files changed, 24 insertions, 9 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.h b/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.h
index e23f7de3408..477918aae9c 100644
--- a/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.h
+++ b/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.h
@@ -9,7 +9,11 @@
namespace proton {
-/** Interface for tracking lids in the feed pipeline */
+/** Interface for tracking lids in the feed pipeline.
+ * A token is created with produce(lid).
+ * Once the token goes out of scope the lid is then consumed.
+ * This is used to track which lids are inflight in the feed pipeline.
+ */
class IPendingLidTracker {
public:
class Token {
@@ -37,7 +41,11 @@ private:
};
/**
- * This is an interface for checking/waiting the state of a lid in the feedpipeline
+ * This is an interface for checking/waiting the state of a lid in the feed pipeline
+ * The lid might need a commit (NEED_COMMIT), but if visibility-delay is zero it will go directly to WAITING
+ * as no explicit commit is needed.
+ * After a commit has been started the lid is transferred to WAITING.
+ * Once the commit has gone through the lid is in state COMPLETED.
*/
class ILidCommitState {
public:
@@ -57,7 +65,12 @@ private:
};
/**
- * Base class for doing 2 phase lidtracking.
+ * Base class for doing 2 phased lid tracking. The first phase is from when the feed operation
+ * is in progress and lasts until the OperationDoneContext goes out of scope. This might include commit
+ * when visibility-delay is zero.
+ * When a commit is started a snapshot containing all lids in state NEED_COMMIT are taken,
+ * while also moving the lids to WAITING. Once the snapshot goes out of scope when the commit is complete,
+ * it will cleanup and move all lids from WAITING to COMPLETE.
*/
class PendingLidTrackerBase : public IPendingLidTracker,
public ILidCommitState
@@ -84,7 +97,8 @@ protected:
};
/**
- * Use for tracking lids in a single phase.
+ * Use for tracking lids whenn visibility-delay is zero and commit is implicit.
+ * In this case lids go directly to WAITING and the second phase is a noop.
*/
class PendingLidTracker : public PendingLidTrackerBase
{
@@ -105,7 +119,8 @@ namespace common::internal {
class CommitList;
}
/**
- * Use for tracking lids in 2 phases.
+ * Use for tracking lids in 2 phases which is needed when visibility-delay is non-zero.
+ * It tracks lids that are in feed pipeline, lids where commit has been started and when they fully complete.
*/
class TwoPhasePendingLidTracker : public PendingLidTrackerBase
{
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
index 1fa677ee406..69fbe592515 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
@@ -318,7 +318,7 @@ StoreOnlyFeedView::internalPut(FeedToken token, const PutOperation &putOp)
_params._subDbId, doc->toString(true).size(), doc->toString(true).c_str());
PendingNotifyRemoveDone pendingNotifyRemoveDone = adjustMetaStore(putOp, docId.getGlobalId(), docId);
- auto commitToken = _pendingLidsForCommit->produce(putOp.getLid());
+ auto unconmitted = _pendingLidsForCommit->produce(putOp.getLid());
considerEarlyAck(token);
bool docAlreadyExists = putOp.getValidPrevDbdId(_params._subDbId);
@@ -327,7 +327,7 @@ StoreOnlyFeedView::internalPut(FeedToken token, const PutOperation &putOp)
bool immediateCommit = needCommit();
const document::GlobalId &gid = docId.getGlobalId();
std::shared_ptr<PutDoneContext> onWriteDone =
- createPutDoneContext(std::move(token), std::move(commitToken),
+ createPutDoneContext(std::move(token), std::move(uncommitted),
_gidToLidChangeHandler, doc, gid, putOp.getLid(), serialNum,
putOp.changedDbdId() && useDocumentMetaStore(serialNum));
putSummary(serialNum, putOp.getLid(), doc, onWriteDone);
@@ -477,11 +477,11 @@ StoreOnlyFeedView::internalUpdate(FeedToken token, const UpdateOperation &updOp)
(void) updateOk;
_metaStore.commit(serialNum, serialNum);
}
- auto commitToken = _pendingLidsForCommit->produce(updOp.getLid());
+ auto uncommitted = _pendingLidsForCommit->produce(updOp.getLid());
considerEarlyAck(token);
bool immediateCommit = needCommit();
- auto onWriteDone = createUpdateDoneContext(std::move(token), std::move(commitToken), updOp.getUpdate());
+ auto onWriteDone = createUpdateDoneContext(std::move(token), std::move(uncommitted), updOp.getUpdate());
UpdateScope updateScope(*_schema, upd);
updateAttributes(serialNum, lid, upd, immediateCommit, onWriteDone, updateScope);