commands/e2e: drop topologyVersion from the handshake; rename to mongo-lite
Advertising topologyVersion in the hello reply is what tells a driver the server speaks the streaming (awaitable) hello protocol — in the Node driver it is the only condition checked. From the second heartbeat on, the driver then monitored with an exhaust hello (exhaustAllowed + maxAwaitTimeMS) and waited for a stream of replies carrying moreToCome. We answered once with the flag clear and went back to reading, so every heartbeat failed with "Server ended moreToCome unexpectedly", destroying the connection and clearing the pool. MongoDB Compass showed this as a connect/disconnect loop once per heartbeat. We do not implement streaming hello, so we must not claim to. Omitting the field keeps monitoring on the polling path, and agrees with the maxWireVersion 8 we report: streaming hello arrived in wire version 9. The existing e2e files all passed against the broken server — they issue their commands and exit before the second heartbeat — so e2e5 watches SDAM heartbeats on an idle connection instead. Also renames mongo-light to mongo-lite throughout (binary, log messages, docs, gitVersion). Unrelated to the fix above, but squashed in at request rather than left as a commit whose message described only the fix.
This commit is contained in:
@@ -91,21 +91,21 @@ pub const Log = struct {
|
||||
|
||||
while (true) {
|
||||
const len_read = self.file.readPositionalAll(self.io, chunk[0..4], pos) catch |err| {
|
||||
std.debug.print("mongo-light: log read error at {d}: {s}\n", .{ pos, @errorName(err) });
|
||||
std.debug.print("mongo-lite: log read error at {d}: {s}\n", .{ pos, @errorName(err) });
|
||||
return error.InvalidLog;
|
||||
};
|
||||
if (len_read == 0) return; // clean end
|
||||
if (len_read < 4) return; // torn tail
|
||||
const total: u32 = std.mem.readInt(u32, chunk[0..4], .little);
|
||||
if (total < header_len) {
|
||||
std.debug.print("mongo-light: corrupt record length {d} at {d}\n", .{ total, pos });
|
||||
std.debug.print("mongo-lite: corrupt record length {d} at {d}\n", .{ total, pos });
|
||||
return error.InvalidLog;
|
||||
}
|
||||
const payload_len: usize = total - 4;
|
||||
// Documents up to maxBsonObjectSize are legal; anything larger is
|
||||
// corruption. Covers a hostile length prefix from a truncated file.
|
||||
if (payload_len > max_record_payload) {
|
||||
std.debug.print("mongo-light: record too large at {d}\n", .{pos});
|
||||
std.debug.print("mongo-lite: record too large at {d}\n", .{pos});
|
||||
return error.InvalidLog;
|
||||
}
|
||||
const payload = if (payload_len <= chunk.len) chunk[0..payload_len] else blk: {
|
||||
@@ -132,7 +132,7 @@ pub const Log = struct {
|
||||
const doc = try self.gpa.create(bson.Document);
|
||||
doc.* = bson.Document.parse(self.gpa, doc_bytes) catch {
|
||||
self.gpa.destroy(doc);
|
||||
std.debug.print("mongo-light: unparseable doc in log at {d}\n", .{pos});
|
||||
std.debug.print("mongo-lite: unparseable doc in log at {d}\n", .{pos});
|
||||
return error.InvalidLog;
|
||||
};
|
||||
try callback(ctx, .{
|
||||
|
||||
Reference in New Issue
Block a user