Changeset: f62e1800a9af for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f62e1800a9af
Modified Files:
sql/backends/monet5/sql.c
Branch: copybinary
Log Message:
Synchronize the MAPI stream after encountering an error
diffs (41 lines):
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -3369,15 +3369,34 @@ mvc_bin_import_table_wrap(Client cntxt,
}
assert(isa_block_stream(rs));
assert(isa_block_stream(ws));
+ bool eof = false;
set_prompting(rs, PROMPT2, ws);
- msg = BATattach_stream(&c,
col->type.type->localtype, rs, cnt, &be->mvc->scanner.rs->eof);
+ msg = BATattach_stream(&c,
col->type.type->localtype, rs, cnt, &eof);
set_prompting(rs, NULL, NULL);
- if (msg != NULL)
- goto bailout;
+ if (!eof) {
+ // Didn't read everything, probably due
to an error.
+ // Read until message boundary.
+ char buf[8190];
+ while (1) {
+ ssize_t nread = mnstr_read(rs,
buf, 1, sizeof(buf));
+ if (nread > 0)
+ continue;
+ if (nread < 0) {
+ // do not overwrite
existing error message
+ if (msg == NULL)
+ msg =
createException(
+ SQL,
"mvc_bin_import_table_wrap",
+ "while
syncing read stream: %s", mnstr_peek_error(rs));
+ }
+ break;
+ }
+ }
mnstr_write(ws, PROMPT3, sizeof(PROMPT3)-1, 1);
mnstr_flush(ws, MNSTR_FLUSH_DATA);
joeri_log("mvc_bin_import_table_wrap: onclient
done\n");
joeri_role(NULL);
+ if (msg != NULL)
+ goto bailout;
} else {
c = BATattach(tpe, fname, TRANSIENT);
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list