Changeset: 8fe70405acd1 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8fe70405acd1 Modified Files: sql/backends/monet5/sql_scenario.c Branch: default Log Message:
Merged from Aug2011 (no changes) diffs (truncated from 391 to 300 lines): diff --git a/clients/ChangeLog.Aug2011 b/clients/ChangeLog.Aug2011 --- a/clients/ChangeLog.Aug2011 +++ b/clients/ChangeLog.Aug2011 @@ -1,6 +1,11 @@ # ChangeLog file for clients # This file is updated with Maddlog +* Fri Oct 7 2011 Sjoerd Mullender <[email protected]> +- Fixed bug 2897 where slow (network) reads could cause blocks to not + be fully read in one go, causing errors in the subsequent use of + those blocks. With thanks to Rémy Chibois. + * Tue Sep 27 2011 Fabian Groffen <[email protected]> - Fixed a bug in mclient where processing queries from files could result in ghost empty results to be reported in the output diff --git a/clients/perl/Mapi.pm b/clients/perl/Mapi.pm --- a/clients/perl/Mapi.pm +++ b/clients/perl/Mapi.pm @@ -375,6 +375,24 @@ sub getReply { } +sub readFromSocket { + my ($self, $ref, $count) = @_; + + die "invalid buffer reference" unless (ref($ref) eq 'SCALAR'); + + my $rcount = 0; + $$ref ||= ""; + + while ($count > 0) { + $rcount = $self->{socket}->sysread($$ref, $count, length($$ref)); + + die "read error: $!" unless (defined($rcount)); + die "no more data on socket" if ($rcount == 0); + + $count -= $rcount; + } +} + sub getblock { my ($self) = @_; @@ -384,7 +402,7 @@ sub getblock { do { my $flag; - $self->{socket}->sysread( $flag, 2 ); # read block info + $self->readFromSocket(\$flag, 2); # read block info my $unpacked = unpack( 'v', $flag ); # unpack (little endian short) my $len = ( $unpacked >> 1 ); # get length @@ -393,7 +411,7 @@ sub getblock { print "getblock: $last_block $len\n" if ($self->{trace}); if ($len > 0 ) { my $data; - $self->{socket}->sysread( $data, $len );# read + $self->readFromSocket(\$data, $len); # read $result .= $data; print "getblock: $data\n" if ($self->{trace}); } diff --git a/sql/test/BugTracker-2011/Tests/All b/sql/test/BugTracker-2011/Tests/All --- a/sql/test/BugTracker-2011/Tests/All +++ b/sql/test/BugTracker-2011/Tests/All @@ -44,3 +44,4 @@ div_by_zero.Bug-2887 cast-crash.Bug-2678 div_zero_problem.Bug-2893 non-stable-select-bug.Bug-2894 +HAVE_PERL?perl-short-read-bug.Bug-2897 diff --git a/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.SQL.bat b/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.SQL.bat new file mode 100755 --- /dev/null +++ b/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.SQL.bat @@ -0,0 +1,6 @@ +@echo off + +prompt # $t $g +echo on + +perl "%TSTSRCDIR%\perl-short-read-bug.Bug-2897.pl" %MAPIPORT% %TSTDB% %HOST% diff --git a/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.SQL.sh b/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.SQL.sh new file mode 100755 --- /dev/null +++ b/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.SQL.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +Mlog -x "perl $TSTSRCDIR/perl-short-read-bug.Bug-2897.pl $MAPIPORT $TSTDB $HOST" diff --git a/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.pl b/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.pl new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.pl @@ -0,0 +1,191 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +$|++; + +use DBI(); + +my $dbh = DBI->connect( + "dbi:monetdb:host=$ARGV[2];port=$ARGV[0];database=$ARGV[1]", 'monetdb', 'monetdb' +); + +my $query = qq{ +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +UNION ALL +SELECT * FROM tables +}; + +my $sth = $dbh->prepare($query); +$sth->execute; + +my $r = $sth->fetchall_arrayref(); + +$dbh->disconnect(); diff --git a/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.stable.err b/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2011/Tests/perl-short-read-bug.Bug-2897.stable.err @@ -0,0 +1,42 @@ +stderr of test 'perl-short-read-bug.Bug-2897` in directory 'test/BugTracker-2011` itself: + + +# 16:13:38 > +# 16:13:38 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "gdk_dbfarm=/ufs/sjoerd/Monet-candidate/var/MonetDB" "--set" "mapi_open=true" "--set" "mapi_port=34748" "--set" "monet_prompt=" "--trace" "--forcemito" "--set" "mal_listing=2" "--dbname=mTests_test_BugTracker-2011" "--set" "mal_listing=0" +# 16:13:38 > + +# builtin opt gdk_dbname = demo +# builtin opt gdk_dbfarm = /ufs/sjoerd/Monet-candidate/var/monetdb5/dbfarm +# builtin opt gdk_debug = 0 +# builtin opt gdk_alloc_map = no _______________________________________________ Checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
