Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/DocLayer.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Future<Void> processRequest(Reference<ExtConnection> ec,
fprintf(stderr, "C -> S: %s\n\n", msg->toString().c_str());
return msg->run(ec);
} catch (Error& e) {
TraceEvent(SevWarnAlways, "BD_processRequest").detail("errorUnknownOpCode", header->opCode);
TraceEvent(SevWarnAlways, "BD_processRequest").detail("opcode", header->opCode).error(e);
return Void();
}
}
Expand Down Expand Up @@ -473,7 +473,7 @@ ACTOR void setup(NetworkAddress na,
state Reference<Transaction> tr3(new Transaction(db));
Optional<FDB::FDBStandalone<StringRef>> clusterFilePath =
wait(tr3->get(LiteralStringRef("\xff\xff/cluster_file_path")));
TraceEvent("StartupConfig").detail("clusterfile", clusterFilePath.get().toString());
TraceEvent("StartupConfig").detail("clusterFile", clusterFilePath.get().toString());
} catch (Error& e) {
if (e.code() != error_code_key_outside_legal_range) // KV-store 2.0
throw;
Expand Down Expand Up @@ -505,6 +505,7 @@ ACTOR void setup(NetworkAddress na,
try {
Void _ = wait(tr2->onError(e));
} catch (Error& e) {
TraceEvent(SevError, "ConnectionFailure").error(e);
fprintf(stderr, "Failed to connect to FDB connection! Error: %s\n", e.what());
_exit(FDB_EXIT_ERROR);
}
Expand Down Expand Up @@ -954,6 +955,9 @@ int main(int argc, char** argv) {
}
#endif
if (metricPluginPath && metricPluginPath[0]) {
TraceEvent(SevInfo, "MetricsInit")
.detail("pluginPath", metricPluginPath)
.detail("config", metricReporterConfig);
DocumentLayer::metricReporter = IMetricReporter::init(metricPluginPath, metricReporterConfig.c_str());
} else {
// default to use `ConsoleMetric` plugin
Expand Down
16 changes: 7 additions & 9 deletions src/ExtMsg.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,15 @@ ACTOR static Future<int32_t> addDocumentsFromCursor(Reference<Cursor> cursor,

while (!numberToReturn || remaining) {
try {

if ((returned <= DOCLAYER_KNOBS->MAX_RETURNABLE_DOCUMENTS ||
returnedSize <= DOCLAYER_KNOBS->DEFAULT_RETURNABLE_DATA_SIZE) &&
returnedSize <= DOCLAYER_KNOBS->MAX_RETURNABLE_DATA_SIZE) {

Reference<ScanReturnedContext> doc = waitNext(cursor->docs);
bson::BSONObj obj =
doc->toDataValue()
.get()
.getPackedObject()
.getOwned(); // Note that this call to get() is safe here but not in general, because we know
// that doc is wrapping a BsonContext, which means toDataValue() is synchronous.

// Note that this call to get() is safe here but not in general, because we know
// that doc is wrapping a BsonContext, which means toDataValue() is synchronous.
bson::BSONObj obj = doc->toDataValue().get().getPackedObject().getOwned();
cursor->checkpoint->getDocumentFinishedLock()->release();
reply->addDocument(obj);

Expand All @@ -361,7 +359,7 @@ ACTOR static Future<int32_t> addDocumentsFromCursor(Reference<Cursor> cursor,
stop = false;
break;
}
TraceEvent(SevError, "BD_runQuery2").detail("error", e.what());
TraceEvent(SevError, "BD_runQuery2").error(e);
throw;
}
}
Expand Down Expand Up @@ -469,7 +467,7 @@ ACTOR static Future<Void> runQuery(Reference<ExtConnection> ec,
}

// If EXHAUST not set OR it is but we got <=0 results, stop.
if (!(msg->flags & EXHAUST) || returned <= 0)
if (!exhaust || returned <= 0)
break;

++replies;
Expand Down
16 changes: 3 additions & 13 deletions src/QLContext.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ ACTOR static Future<Void> FDBPlugin_getDescendants(DataKey key,
state std::string end = std::move(prefix);
end += relEnd;

// if (verboseLogging)
// TraceEvent("BD_getDescendents").detail("from", printable(StringRef(begin)).c_str()).detail("to",
// printable(StringRef(end)).c_str());

try {
state GetRangeLimits limit(GetRangeLimits::ROW_LIMIT_UNLIMITED, 80000);
state Future<FDBStandalone<RangeResultRef>> nextRead = tr->tr->getRange(KeyRangeRef(begin, end), limit);
Expand Down Expand Up @@ -178,7 +174,7 @@ ACTOR static Future<Void> FDBPlugin_getDescendants(DataKey key,
throw end_of_stream();
} catch (Error& e) {
if (e.code() != error_code_end_of_stream && e.code() != error_code_operation_cancelled)
TraceEvent(SevError, "BD_getDescendants").detail("error", e.what());
TraceEvent(SevError, "BD_getDescendants").error(e);
if (e.code() != error_code_operation_cancelled)
output.sendError(e);
throw;
Expand Down Expand Up @@ -325,8 +321,6 @@ struct CompoundIndexPlugin : IndexPlugin, ReferenceCounted<CompoundIndexPlugin>,
state Future<Void> writes_finished = dd->writes_finished.getFuture();

try {
// TraceEvent("BD_doIndexUpdateStart");

dd->snapshotLock.use();

std::vector<Future<std::vector<DataValue>>> f_old_values;
Expand Down Expand Up @@ -433,7 +427,7 @@ struct CompoundIndexPlugin : IndexPlugin, ReferenceCounted<CompoundIndexPlugin>,
}

} catch (Error& e) {
TraceEvent(SevError, "BD_doIndexUpdate").detail("error", e.what());
TraceEvent(SevError, "BD_doIndexUpdate").error(e);
throw;
}

Expand Down Expand Up @@ -475,8 +469,6 @@ struct SimpleIndexPlugin : IndexPlugin, ReferenceCounted<SimpleIndexPlugin>, Fas
state Reference<QueryContext> doc(new QueryContext(self->next, tr, documentPath));
state Future<Void> writes_finished = dd->writes_finished.getFuture();
try {
// TraceEvent("BD_doIndexUpdateStart");

dd->snapshotLock.use();

state std::vector<DataValue> old_values =
Expand Down Expand Up @@ -536,14 +528,12 @@ struct SimpleIndexPlugin : IndexPlugin, ReferenceCounted<SimpleIndexPlugin>, Fas
}
// clear any existing index entries
for (DataValue& v : old_values) {
// fprintf(stderr, "Old value: %s\n", printable(StringRef(v.encode_key_part())).c_str());
DataKey old_key(self->indexPath);
old_key.append(v.encode_key_part()).append(documentPath[documentPath.size() - 1]);
tr->tr->clear(getFDBKey(old_key));
}
// write the new/updated index entries
for (DataValue& v : new_values) {
// fprintf(stderr, "New value: %s\n", printable(StringRef(v.encode_key_part())).c_str());
DataKey new_key(self->indexPath);
new_key.append(v.encode_key_part()).append(documentPath[documentPath.size() - 1]);
if (new_key.byteSize() > DocLayerConstants::INDEX_KEY_LENGTH_LIMIT) {
Expand All @@ -555,7 +545,7 @@ struct SimpleIndexPlugin : IndexPlugin, ReferenceCounted<SimpleIndexPlugin>, Fas
tr->tr->set(getFDBKey(new_key), StringRef());
}
} catch (Error& e) {
TraceEvent(SevError, "BD_doIndexUpdate").detail("error", e.what());
TraceEvent(SevError, "BD_doIndexUpdate").error(e);
throw;
}

Expand Down
6 changes: 3 additions & 3 deletions src/QLPlan.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ ACTOR static Future<Void> toDocInfo(PlanCheckpoint* checkpoint,
throw;
}
if (e.code() != error_code_end_of_stream)
TraceEvent(SevError, "BD_toDocInfo_error").detail("error", e.what());
TraceEvent(SevError, "BD_toDocInfo_error").error(e);
dis.sendError(e);
throw;
}
Expand Down Expand Up @@ -1516,7 +1516,7 @@ ACTOR static Future<Void> doSort(PlanCheckpoint* outerCheckpoint,
if (e.code() == error_code_end_of_stream) {
break;
}
TraceEvent(SevError, "BD_runQuery2").detail("error", e.what());
TraceEvent(SevError, "BD_runQuery2").error(e);
throw;
}
}
Expand All @@ -1535,7 +1535,7 @@ ACTOR static Future<Void> doSort(PlanCheckpoint* outerCheckpoint,
ref(new BsonContext(returnProjections[i].getObjectField("doc").getOwned(), false)), -1, Key())));
}
} catch (Error& e) {
TraceEvent(SevError, "BD_runQuery2").detail("error", e.what());
TraceEvent(SevError, "BD_runQuery2").error(e);
throw;
}
innerCheckpoint->stop();
Expand Down
2 changes: 1 addition & 1 deletion src/QLProjection.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ACTOR Future<bson::BSONObj> projectDocument_impl(Reference<IReadContext> doc, Re
return currentPath[0].build().getOwned();
} catch (Error& e) {
if (e.code() != error_code_actor_cancelled)
TraceEvent(SevError, "BD_projectDocument").detail("error", e.what());
TraceEvent(SevError, "BD_projectDocument").error(e);
throw;
}
}
Expand Down