|
|
@@ -112,6 +112,13 @@ static int write() {
|
|
|
{"_updated_at", 6}, {"_created_by", "mallory"}, {"_updated_by", "mallory"},
|
|
|
{"_vector", vecFor(5000)}},
|
|
|
"shadow");
|
|
|
+ // Payload edges, against the e2e server's 2 MB send limit: 300 KB rows
|
|
|
+ // must be cut into byte-bounded batches; a 3 MB row cannot be sent at all.
|
|
|
+ const std::string k300(300 * 1024, 'x');
|
|
|
+ for (int i = 0; i < 20; ++i) c.insert("wide", {{"n", i}, {"blob", k300}}, id3("k", i));
|
|
|
+ c.insert("big", {{"n", 0}}, "b0");
|
|
|
+ c.insert("big", {{"n", 1}, {"blob", std::string(3 * 1024 * 1024, 'y')}}, "b1");
|
|
|
+ c.insert("big", {{"n", 2}}, "b2");
|
|
|
ck(c.createCollection("plain"), "create plain (no dimension)");
|
|
|
for (int i = 0; i < 3; ++i) c.insert("plain", {{"n", i}}, id3("q", i));
|
|
|
return 0;
|
|
|
@@ -253,6 +260,28 @@ static void check() {
|
|
|
catch (const Client::Error& err) { nf = err.code() == Client::ErrorCode::NotFound; }
|
|
|
ck(nf, "export of a missing collection throws NotFound");
|
|
|
|
|
|
+ // --- payload edges
|
|
|
+ auto wide = runExport(c, "wide", false, "", 0, 1024);
|
|
|
+ ck(wide.summary.complete && wide.rows.size() == 20,
|
|
|
+ "300 KB rows: byte-bounded batches deliver all 20 under a 2 MB send limit");
|
|
|
+ std::vector<Client::ExportRow> bigRows;
|
|
|
+ std::string bigReason, bigId;
|
|
|
+ Client::ErrorCode bigCode = Client::ErrorCode::Ok;
|
|
|
+ try {
|
|
|
+ c.exportCollection("big", false, "", nullptr,
|
|
|
+ [&](Client::ExportRow&& r) { bigRows.push_back(std::move(r)); return true; });
|
|
|
+ } catch (const Client::Error& err) {
|
|
|
+ bigCode = err.code();
|
|
|
+ if (auto* d = Client::errorDetail(err)) { bigReason = d->reason; bigId = d->conflictingId; }
|
|
|
+ }
|
|
|
+ ck(bigCode == Client::ErrorCode::ResourceExhausted && bigReason == "row_too_large" && bigId == "b1",
|
|
|
+ "a row no message can carry: ResourceExhausted, row_too_large, naming b1 (got " +
|
|
|
+ std::to_string(int(bigCode)) + " " + bigReason + " " + bigId + ")");
|
|
|
+ ck(bigRows.size() == 1 && bigRows[0].id == "b0", "the rows before it were delivered");
|
|
|
+ auto afterBig = runExport(c, "big", false, "b1");
|
|
|
+ ck(afterBig.summary.complete && afterBig.rows.size() == 1 && afterBig.rows[0].id == "b2",
|
|
|
+ "resuming after the named row completes the rest");
|
|
|
+
|
|
|
// --- file calls report a reason
|
|
|
Client::Failure ff;
|
|
|
ck(!c.setFileTtl("no-such-file", 60, ff) && ff.code == Client::ErrorCode::NotFound,
|