Changeset: 71c58dec7201 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=71c58dec7201
Modified Files:
clients/mapiclient/mclient.c
common/stream/stream.c
gdk/gdk_logger.c
sql/test/Tests/All
sql/test/leaks/Tests/check0.stable.out.int128
sql/test/leaks/Tests/check3.stable.out
sql/test/leaks/Tests/check3.stable.out.int128
sql/test/leaks/Tests/check4.stable.out
sql/test/leaks/Tests/check4.stable.out.int128
sql/test/leaks/Tests/check5.stable.out
sql/test/leaks/Tests/check5.stable.out.int128
Branch: transaction-replication
Log Message:
Merge with default branch
diffs (truncated from 367 to 300 lines):
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1817,6 +1817,9 @@ doRequest(Mapi mid, const char *buf)
return 1;
}
+ if (mapi_needmore(hdl) == MMORE)
+ return 0;
+
format_result(mid, hdl, 0);
if (mapi_get_active(mid) == NULL)
@@ -1881,7 +1884,7 @@ doFileBulk(Mapi mid, FILE *fp)
buf = malloc(bufsize + 1);
if (!buf) {
fprintf(stderr, "cannot allocate memory for send buffer\n");
- if (fp != stdin)
+ if (fp != stdin && fp != NULL)
fclose(fp);
return 1;
}
@@ -1889,7 +1892,12 @@ doFileBulk(Mapi mid, FILE *fp)
timerStart();
do {
timerPause();
- if ((length = fread(buf, 1, bufsize, fp)) == 0) {
+ if (fp == NULL) {
+ if (hdl == NULL)
+ break;
+ length = 0;
+ buf[0] = 0;
+ } else if ((length = fread(buf, 1, bufsize, fp)) == 0) {
/* end of file */
if (fp != stdin) {
fclose(fp);
@@ -1962,8 +1970,9 @@ doFileBulk(Mapi mid, FILE *fp)
mapi_query_part(hdl, buf, length);
CHECK_RESULT(mid, hdl, buf, continue, buf);
- /* make sure there is a newline in the buffer */
- if (strchr(buf, '\n') == NULL)
+ /* if not at EOF, make sure there is a newline in the
+ * buffer */
+ if (length > 0 && strchr(buf, '\n') == NULL)
continue;
assert(hdl != NULL);
@@ -3345,7 +3354,8 @@ main(int argc, char **argv)
c |= doFile(mid, argv[optind], useinserts, interactive,
save_history);
optind++;
}
- }
+ } else if (command && mapi_get_active(mid))
+ c = doFileBulk(mid, NULL);
if (!has_fileargs && command == NULL)
c = doFile(mid, "-", useinserts, interactive, save_history);
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -1110,6 +1110,9 @@ open_bzstream(const char *filename, cons
bzp->b = BZ2_bzReadOpen(&err, bzp->f, 0, 0,
NULL, 0);
}
}
+ } else if (flags[0] == 'r') {
+ bzp->b = BZ2_bzReadOpen(&err, bzp->f, 0, 0, NULL, 0);
+ s->access = ST_READ;
} else {
bzp->b = BZ2_bzWriteOpen(&err, bzp->f, 9, 0, 30);
s->access = ST_WRITE;
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1127,9 +1127,9 @@ logger_commit(logger *lg)
/* cleanup old snapshots */
if (BATcount(lg->snapshots_bid)) {
- BATclear(lg->snapshots_bid, FALSE);
- BATclear(lg->snapshots_tid, FALSE);
- BATclear(lg->dsnapshots, FALSE);
+ BATclear(lg->snapshots_bid, TRUE);
+ BATclear(lg->snapshots_tid, TRUE);
+ BATclear(lg->dsnapshots, TRUE);
BATcommit(lg->snapshots_bid);
BATcommit(lg->snapshots_tid);
BATcommit(lg->dsnapshots);
@@ -1166,6 +1166,34 @@ check_version(logger *lg, FILE *fp)
return GDK_SUCCEED;
}
+static BAT *
+bm_tids(BAT *b, BAT *d)
+{
+ BUN sz = BATcount(b);
+ BAT *tids = BATnew(TYPE_void, TYPE_void, 0, TRANSIENT);
+
+ tids->H->seq = 0;
+ tids->T->seq = 0;
+ BATsetcount(tids, sz);
+ tids->H->revsorted = 0;
+ tids->T->revsorted = 0;
+
+ tids->T->key = 1;
+ tids->T->dense = 1;
+ tids->H->key = 1;
+ tids->H->dense = 1;
+
+ if (BATcount(d)) {
+ BAT *diff = BATkdiff(tids, BATmirror(d));
+
+ logbat_destroy(tids);
+ tids = BATmirror(BATmark(diff, 0));
+ logbat_destroy(diff);
+ }
+ return tids;
+}
+
+
static gdk_return
bm_subcommit(BAT *list_bid, BAT *list_nme, BAT *catalog_bid, BAT *catalog_nme,
BAT *dcatalog, BAT *extra, int debug)
{
@@ -1208,6 +1236,21 @@ bm_subcommit(BAT *list_bid, BAT *list_nm
n[i++] = abs(catalog_nme->batCacheid);
n[i++] = abs(dcatalog->batCacheid);
assert((BUN) i <= nn);
+ if (BATcount(dcatalog) && catalog_bid == list_bid && catalog_nme ==
list_nme) {
+ BAT *bids, *nmes, *tids = bm_tids(catalog_bid, dcatalog);
+
+ bids = BATproject(tids, catalog_bid);
+ nmes = BATproject(tids, catalog_nme);
+ logbat_destroy(tids);
+ BATclear(catalog_bid, TRUE);
+ BATclear(catalog_nme, TRUE);
+ BATclear(dcatalog, TRUE);
+
+ BATappend(catalog_bid, bids, FALSE);
+ BATappend(catalog_nme, nmes, FALSE);
+ logbat_destroy(bids);
+ logbat_destroy(nmes);
+ }
BATcommit(catalog_bid);
BATcommit(catalog_nme);
BATcommit(dcatalog);
@@ -2401,34 +2444,6 @@ pre_allocate(logger *lg)
return GDK_SUCCEED;
}
-static BAT *
-bm_tids(BAT *b, BAT *d)
-{
- BUN sz = BATcount(b);
- BAT *tids = BATnew(TYPE_void, TYPE_void, 0, TRANSIENT);
-
- tids->H->seq = 0;
- tids->T->seq = 0;
- BATsetcount(tids, sz);
- tids->H->revsorted = 0;
- tids->T->revsorted = 0;
-
- tids->T->key = 1;
- tids->T->dense = 1;
- tids->H->key = 1;
- tids->H->dense = 1;
-
- if (BATcount(d)) {
- BAT *diff = BATkdiff(tids, BATmirror(d));
-
- logbat_destroy(tids);
- tids = BATmirror(BATmark(diff, 0));
- logbat_destroy(diff);
- }
- return tids;
-}
-
-
int
log_tend(logger *lg)
{
diff --git a/sql/test/Tests/All b/sql/test/Tests/All
--- a/sql/test/Tests/All
+++ b/sql/test/Tests/All
@@ -94,6 +94,6 @@ copy_into
antiselect
median_stdev
-HAVE_GEOM?trace
+#HAVE_GEOM?trace
HAVE_JDBCCLIENT_JAR?bogus-auto-generated-keys
diff --git a/sql/test/leaks/Tests/check0.stable.out.int128
b/sql/test/leaks/Tests/check0.stable.out.int128
--- a/sql/test/leaks/Tests/check0.stable.out.int128
+++ b/sql/test/leaks/Tests/check0.stable.out.int128
@@ -79,7 +79,7 @@ Ready.
% L1, L2 # name
% char, wrd # type
% 9, 3 # length
-[ "transient", 450 ]
+[ "transient", 434 ]
#select 'persistent', count(*) from bbp() as bbp where kind like 'pers%';
% .L1, .L2 # table_name
% L1, L2 # name
diff --git a/sql/test/leaks/Tests/check3.stable.out
b/sql/test/leaks/Tests/check3.stable.out
--- a/sql/test/leaks/Tests/check3.stable.out
+++ b/sql/test/leaks/Tests/check3.stable.out
@@ -177,9 +177,9 @@ Ready.
[ "oid", "oid", 0 ]
[ "oid", "oid", 0 ]
[ "oid", "oid", 0 ]
+[ "oid", "oid", 0 ]
[ "oid", "oid", 1 ]
[ "oid", "oid", 2 ]
-[ "oid", "oid", 3 ]
[ "oid", "sht", 0 ]
[ "oid", "sht", 0 ]
[ "oid", "sht", 0 ]
@@ -266,7 +266,7 @@ Ready.
[ "oid", "str", 54 ]
[ "oid", "str", 54 ]
[ "oid", "str", 110 ]
-[ "oid", "str", 248 ]
+[ "oid", "str", 245 ]
[ "oid", "str", 360 ]
[ "oid", "str", 360 ]
[ "oid", "str", 360 ]
diff --git a/sql/test/leaks/Tests/check3.stable.out.int128
b/sql/test/leaks/Tests/check3.stable.out.int128
--- a/sql/test/leaks/Tests/check3.stable.out.int128
+++ b/sql/test/leaks/Tests/check3.stable.out.int128
@@ -110,7 +110,7 @@ Ready.
[ "oid", "int", 54 ]
[ "oid", "int", 237 ]
[ "oid", "int", 237 ]
-[ "oid", "int", 248 ]
+[ "oid", "int", 245 ]
[ "oid", "int", 360 ]
[ "oid", "int", 360 ]
[ "oid", "int", 360 ]
@@ -177,9 +177,9 @@ Ready.
[ "oid", "oid", 0 ]
[ "oid", "oid", 0 ]
[ "oid", "oid", 0 ]
+[ "oid", "oid", 0 ]
[ "oid", "oid", 1 ]
[ "oid", "oid", 2 ]
-[ "oid", "oid", 3 ]
[ "oid", "sht", 0 ]
[ "oid", "sht", 0 ]
[ "oid", "sht", 0 ]
@@ -266,7 +266,7 @@ Ready.
[ "oid", "str", 54 ]
[ "oid", "str", 54 ]
[ "oid", "str", 110 ]
-[ "oid", "str", 248 ]
+[ "oid", "str", 245 ]
[ "oid", "str", 360 ]
[ "oid", "str", 360 ]
[ "oid", "str", 360 ]
diff --git a/sql/test/leaks/Tests/check4.stable.out
b/sql/test/leaks/Tests/check4.stable.out
--- a/sql/test/leaks/Tests/check4.stable.out
+++ b/sql/test/leaks/Tests/check4.stable.out
@@ -177,9 +177,9 @@ Ready.
[ "oid", "oid", 0 ]
[ "oid", "oid", 0 ]
[ "oid", "oid", 0 ]
+[ "oid", "oid", 0 ]
[ "oid", "oid", 2 ]
[ "oid", "oid", 4 ]
-[ "oid", "oid", 6 ]
[ "oid", "sht", 0 ]
[ "oid", "sht", 0 ]
[ "oid", "sht", 0 ]
@@ -266,7 +266,7 @@ Ready.
[ "oid", "str", 55 ]
[ "oid", "str", 55 ]
[ "oid", "str", 110 ]
-[ "oid", "str", 251 ]
+[ "oid", "str", 245 ]
[ "oid", "str", 362 ]
[ "oid", "str", 362 ]
[ "oid", "str", 362 ]
diff --git a/sql/test/leaks/Tests/check4.stable.out.int128
b/sql/test/leaks/Tests/check4.stable.out.int128
--- a/sql/test/leaks/Tests/check4.stable.out.int128
+++ b/sql/test/leaks/Tests/check4.stable.out.int128
@@ -110,7 +110,7 @@ Ready.
[ "oid", "int", 55 ]
[ "oid", "int", 237 ]
[ "oid", "int", 237 ]
-[ "oid", "int", 251 ]
+[ "oid", "int", 245 ]
[ "oid", "int", 362 ]
[ "oid", "int", 362 ]
[ "oid", "int", 362 ]
@@ -177,9 +177,9 @@ Ready.
[ "oid", "oid", 0 ]
[ "oid", "oid", 0 ]
[ "oid", "oid", 0 ]
+[ "oid", "oid", 0 ]
[ "oid", "oid", 2 ]
[ "oid", "oid", 4 ]
-[ "oid", "oid", 6 ]
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list