Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
d4daeeae
Commit
d4daeeae
authored
Nov 20, 2009
by
Kristofer Pettersson
Browse files
Options
Browse Files
Download
Plain Diff
automerge
parents
eb50550e
2b666513
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
131 additions
and
53 deletions
+131
-53
configure.in
configure.in
+1
-1
include/violite.h
include/violite.h
+2
-2
mysql-test/r/range.result
mysql-test/r/range.result
+17
-0
mysql-test/t/range.test
mysql-test/t/range.test
+21
-0
mysys/typelib.c
mysys/typelib.c
+1
-1
sql/mysqld.cc
sql/mysqld.cc
+11
-5
sql/opt_range.cc
sql/opt_range.cc
+31
-2
vio/vio.c
vio/vio.c
+18
-22
vio/viosocket.c
vio/viosocket.c
+29
-20
No files found.
configure.in
View file @
d4daeeae
...
...
@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
#
# When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version().
AM_INIT_AUTOMAKE
(
mysql, 5.1.4
1
)
AM_INIT_AUTOMAKE
(
mysql, 5.1.4
2
)
AM_CONFIG_HEADER
([
include/config.h:config.h.in]
)
# Request support for automake silent-rules if available.
...
...
include/violite.h
View file @
d4daeeae
...
...
@@ -224,8 +224,8 @@ struct st_vio
#endif
/* HAVE_SMEM */
#ifdef _WIN32
OVERLAPPED
pipe_overlapped
;
DWORD
read_timeout_m
illi
s
;
DWORD
write_timeout_m
illi
s
;
DWORD
read_timeout_ms
;
DWORD
write_timeout_ms
;
#endif
};
#endif
/* vio_violite_h_ */
mysql-test/r/range.result
View file @
d4daeeae
...
...
@@ -1603,4 +1603,21 @@ SELECT str_to_date('', '%Y-%m-%d');
str_to_date('', '%Y-%m-%d')
0000-00-00
DROP TABLE t1, t2;
#
# Bug #48665: sql-bench's insert test fails due to wrong result
#
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a));
INSERT INTO t1 VALUES (0,0), (1,1);
EXPLAIN
SELECT * FROM t1 FORCE INDEX (PRIMARY)
WHERE (a>=1 AND a<=2) OR (a>=4 AND a<=5) OR (a>=0 AND a <=10);
id select_type table type possible_keys key key_len ref rows Extra
@ @ @ range @ @ @ @ @ @
# Should return 2 rows
SELECT * FROM t1 FORCE INDEX (PRIMARY)
WHERE (a>=1 AND a<=2) OR (a>=4 AND a<=5) OR (a>=0 AND a <=10);
a b
0 0
1 1
DROP TABLE t1;
End of 5.1 tests
mysql-test/t/range.test
View file @
d4daeeae
...
...
@@ -1260,4 +1260,25 @@ SELECT str_to_date('', '%Y-%m-%d');
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# Bug #48665: sql-bench's insert test fails due to wrong result
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
PRIMARY
KEY
(
a
));
INSERT
INTO
t1
VALUES
(
0
,
0
),
(
1
,
1
);
--
replace_column
1
@
2
@
3
@
5
@
6
@
7
@
8
@
9
@
10
@
EXPLAIN
SELECT
*
FROM
t1
FORCE
INDEX
(
PRIMARY
)
WHERE
(
a
>=
1
AND
a
<=
2
)
OR
(
a
>=
4
AND
a
<=
5
)
OR
(
a
>=
0
AND
a
<=
10
);
--
echo
# Should return 2 rows
SELECT
*
FROM
t1
FORCE
INDEX
(
PRIMARY
)
WHERE
(
a
>=
1
AND
a
<=
2
)
OR
(
a
>=
4
AND
a
<=
5
)
OR
(
a
>=
0
AND
a
<=
10
);
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
mysys/typelib.c
View file @
d4daeeae
...
...
@@ -184,7 +184,7 @@ my_ulonglong find_typeset(char *x, TYPELIB *lib, int *err)
i
=
x
;
while
(
*
x
&&
*
x
!=
field_separator
)
x
++
;
if
(
x
[
0
]
&&
x
[
1
])
/
/ skip separator if found
if
(
x
[
0
]
&&
x
[
1
])
/
* skip separator if found */
x
++
;
if
((
find
=
find_type
(
i
,
lib
,
2
|
8
)
-
1
)
<
0
)
DBUG_RETURN
(
0
);
...
...
sql/mysqld.cc
View file @
d4daeeae
...
...
@@ -5224,12 +5224,16 @@ pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused)))
pthread_handler_t
handle_connections_namedpipes
(
void
*
arg
)
{
HANDLE
hConnectedPipe
;
OVERLAPPED
connectOverlapped
=
{
0
};
OVERLAPPED
connectOverlapped
=
{
0
};
THD
*
thd
;
my_thread_init
();
DBUG_ENTER
(
"handle_connections_namedpipes"
);
connectOverlapped
.
hEvent
=
CreateEvent
(
NULL
,
TRUE
,
FALSE
,
NULL
);
connectOverlapped
.
hEvent
=
CreateEvent
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
!
connectOverlapped
.
hEvent
)
{
sql_print_error
(
"Can't create event, last error=%u"
,
GetLastError
());
unireg_abort
(
1
);
}
DBUG_PRINT
(
"general"
,(
"Waiting for named pipe connections."
));
while
(
!
abort_loop
)
{
...
...
@@ -5252,7 +5256,8 @@ pthread_handler_t handle_connections_namedpipes(void *arg)
{
CloseHandle
(
hPipe
);
if
((
hPipe
=
CreateNamedPipe
(
pipe_name
,
PIPE_ACCESS_DUPLEX
|
FILE_FLAG_OVERLAPPED
,
PIPE_ACCESS_DUPLEX
|
FILE_FLAG_OVERLAPPED
,
PIPE_TYPE_BYTE
|
PIPE_READMODE_BYTE
|
PIPE_WAIT
,
...
...
@@ -5272,7 +5277,8 @@ pthread_handler_t handle_connections_namedpipes(void *arg)
hConnectedPipe
=
hPipe
;
/* create new pipe for new connection */
if
((
hPipe
=
CreateNamedPipe
(
pipe_name
,
PIPE_ACCESS_DUPLEX
|
FILE_FLAG_OVERLAPPED
,
PIPE_ACCESS_DUPLEX
|
FILE_FLAG_OVERLAPPED
,
PIPE_TYPE_BYTE
|
PIPE_READMODE_BYTE
|
PIPE_WAIT
,
...
...
sql/opt_range.cc
View file @
d4daeeae
...
...
@@ -6671,6 +6671,7 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
else
if
((
cmp
=
tmp
->
cmp_max_to_min
(
key2
))
<
0
)
{
// Found tmp.max < key2.min
SEL_ARG
*
next
=
tmp
->
next
;
/* key1 on the left of key2 non-overlapping */
if
(
cmp
==
-
2
&&
eq_tree
(
tmp
->
next_key_part
,
key2
->
next_key_part
))
{
// Join near ranges like tmp.max < 0 and key2.min >= 0
...
...
@@ -6699,6 +6700,7 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
int
tmp_cmp
;
if
((
tmp_cmp
=
tmp
->
cmp_min_to_max
(
key2
))
>
0
)
// if tmp.min > key2.max
{
/* tmp is on the right of key2 non-overlapping */
if
(
tmp_cmp
==
2
&&
eq_tree
(
tmp
->
next_key_part
,
key2
->
next_key_part
))
{
// ranges are connected
tmp
->
copy_min_to_min
(
key2
);
...
...
@@ -6733,25 +6735,52 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
}
}
// tmp.max >= key2.min && tmp.min <= key.max (overlapping ranges)
/*
tmp.min >= key2.min && tmp.min <= key.max (overlapping ranges)
key2.min <= tmp.min <= key2.max
*/
if
(
eq_tree
(
tmp
->
next_key_part
,
key2
->
next_key_part
))
{
if
(
tmp
->
is_same
(
key2
))
{
/*
Found exact match of key2 inside key1.
Use the relevant range in key1.
*/
tmp
->
merge_flags
(
key2
);
// Copy maybe flags
key2
->
increment_use_count
(
-
1
);
// Free not used tree
}
else
{
SEL_ARG
*
last
=
tmp
;
SEL_ARG
*
first
=
tmp
;
/*
Find the last range in tmp that overlaps key2 and has the same
condition on the rest of the keyparts.
*/
while
(
last
->
next
&&
last
->
next
->
cmp_min_to_max
(
key2
)
<=
0
&&
eq_tree
(
last
->
next
->
next_key_part
,
key2
->
next_key_part
))
{
/*
We've found the last overlapping key1 range in last.
This means that the ranges between (and including) the
first overlapping range (tmp) and the last overlapping range
(last) are fully nested into the current range of key2
and can safely be discarded. We just need the minimum endpoint
of the first overlapping range (tmp) so we can compare it with
the minimum endpoint of the enclosing key2 range.
*/
SEL_ARG
*
save
=
last
;
last
=
last
->
next
;
key1
=
key1
->
tree_delete
(
save
);
}
last
->
copy_min
(
tmp
);
/*
The tmp range (the first overlapping range) could have been discarded
by the previous loop. We should re-direct tmp to the new united range
that's taking its place.
*/
tmp
=
last
;
last
->
copy_min
(
first
);
bool
full_range
=
last
->
copy_min
(
key2
);
if
(
!
full_range
)
{
...
...
vio/vio.c
View file @
d4daeeae
...
...
@@ -62,10 +62,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio
->
timeout
=
vio_win32_timeout
;
/* Set default timeout */
vio
->
read_timeout_millis
=
INFINITE
;
vio
->
write_timeout_millis
=
INFINITE
;
memset
(
&
(
vio
->
pipe_overlapped
),
0
,
sizeof
(
OVERLAPPED
));
vio
->
read_timeout_ms
=
INFINITE
;
vio
->
write_timeout_ms
=
INFINITE
;
vio
->
pipe_overlapped
.
hEvent
=
CreateEvent
(
NULL
,
TRUE
,
FALSE
,
NULL
);
DBUG_VOID_RETURN
;
}
...
...
@@ -90,8 +88,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
/* Currently, shared memory is on Windows only, hence the below is ok*/
vio
->
timeout
=
vio_win32_timeout
;
/* Set default timeout */
vio
->
read_timeout_m
illi
s
=
INFINITE
;
vio
->
write_timeout_m
illi
s
=
INFINITE
;
vio
->
read_timeout_ms
=
INFINITE
;
vio
->
write_timeout_ms
=
INFINITE
;
DBUG_VOID_RETURN
;
}
#endif
...
...
@@ -115,22 +113,20 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
DBUG_VOID_RETURN
;
}
#endif
/* HAVE_OPENSSL */
{
vio
->
viodelete
=
vio_delete
;
vio
->
vioerrno
=
vio_errno
;
vio
->
read
=
(
flags
&
VIO_BUFFERED_READ
)
?
vio_read_buff
:
vio_read
;
vio
->
write
=
vio_write
;
vio
->
fastsend
=
vio_fastsend
;
vio
->
viokeepalive
=
vio_keepalive
;
vio
->
should_retry
=
vio_should_retry
;
vio
->
was_interrupted
=
vio_was_interrupted
;
vio
->
vioclose
=
vio_close
;
vio
->
peer_addr
=
vio_peer_addr
;
vio
->
in_addr
=
vio_in_addr
;
vio
->
vioblocking
=
vio_blocking
;
vio
->
is_blocking
=
vio_is_blocking
;
vio
->
timeout
=
vio_timeout
;
}
vio
->
viodelete
=
vio_delete
;
vio
->
vioerrno
=
vio_errno
;
vio
->
read
=
(
flags
&
VIO_BUFFERED_READ
)
?
vio_read_buff
:
vio_read
;
vio
->
write
=
vio_write
;
vio
->
fastsend
=
vio_fastsend
;
vio
->
viokeepalive
=
vio_keepalive
;
vio
->
should_retry
=
vio_should_retry
;
vio
->
was_interrupted
=
vio_was_interrupted
;
vio
->
vioclose
=
vio_close
;
vio
->
peer_addr
=
vio_peer_addr
;
vio
->
in_addr
=
vio_in_addr
;
vio
->
vioblocking
=
vio_blocking
;
vio
->
is_blocking
=
vio_is_blocking
;
vio
->
timeout
=
vio_timeout
;
DBUG_VOID_RETURN
;
}
...
...
vio/viosocket.c
View file @
d4daeeae
...
...
@@ -415,14 +415,14 @@ void vio_timeout(Vio *vio, uint which, uint timeout)
/*
Finish pending IO on pipe. Honor wait timeout
*/
static
int
pipe_complete_io
(
Vio
*
vio
,
char
*
buf
,
size_t
size
,
DWORD
timeout_milli
s
)
static
size_t
pipe_complete_io
(
Vio
*
vio
,
char
*
buf
,
size_t
size
,
DWORD
timeout_m
s
)
{
DWORD
length
;
DWORD
ret
;
DBUG_ENTER
(
"pipe_complete_io"
);
ret
=
WaitForSingleObject
(
vio
->
pipe_overlapped
.
hEvent
,
timeout_m
illi
s
);
ret
=
WaitForSingleObject
(
vio
->
pipe_overlapped
.
hEvent
,
timeout_ms
);
/*
WaitForSingleObjects will normally return WAIT_OBJECT_O (success, IO completed)
or WAIT_TIMEOUT.
...
...
@@ -431,14 +431,14 @@ static int pipe_complete_io(Vio* vio, char* buf, size_t size, DWORD timeout_mill
{
CancelIo
(
vio
->
hPipe
);
DBUG_PRINT
(
"error"
,(
"WaitForSingleObject() returned %d"
,
ret
));
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
(
size_t
)
-
1
);
}
if
(
!
GetOverlappedResult
(
vio
->
hPipe
,
&
(
vio
->
pipe_overlapped
),
&
length
,
FALSE
))
{
DBUG_PRINT
(
"error"
,(
"GetOverlappedResult() returned last error %d"
,
GetLastError
()));
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
(
size_t
)
-
1
);
}
DBUG_RETURN
(
length
);
...
...
@@ -448,12 +448,17 @@ static int pipe_complete_io(Vio* vio, char* buf, size_t size, DWORD timeout_mill
size_t
vio_read_pipe
(
Vio
*
vio
,
uchar
*
buf
,
size_t
size
)
{
DWORD
bytes_read
;
size_t
retval
;
DBUG_ENTER
(
"vio_read_pipe"
);
DBUG_PRINT
(
"enter"
,
(
"sd: %d buf: 0x%lx size: %u"
,
vio
->
sd
,
(
long
)
buf
,
(
uint
)
size
));
if
(
!
ReadFile
(
vio
->
hPipe
,
buf
,
(
DWORD
)
size
,
&
bytes_read
,
if
(
ReadFile
(
vio
->
hPipe
,
buf
,
(
DWORD
)
size
,
&
bytes_read
,
&
(
vio
->
pipe_overlapped
)))
{
retval
=
bytes_read
;
}
else
{
if
(
GetLastError
()
!=
ERROR_IO_PENDING
)
{
...
...
@@ -461,23 +466,28 @@ size_t vio_read_pipe(Vio * vio, uchar *buf, size_t size)
GetLastError
()));
DBUG_RETURN
((
size_t
)
-
1
);
}
bytes_read
=
pipe_complete_io
(
vio
,
buf
,
size
,
vio
->
read_timeout_milli
s
);
retval
=
pipe_complete_io
(
vio
,
buf
,
size
,
vio
->
read_timeout_m
s
);
}
DBUG_PRINT
(
"exit"
,
(
"%
d"
,
bytes_read
));
DBUG_RETURN
(
bytes_read
);
DBUG_PRINT
(
"exit"
,
(
"%
lld"
,
(
longlong
)
retval
));
DBUG_RETURN
(
retval
);
}
size_t
vio_write_pipe
(
Vio
*
vio
,
const
uchar
*
buf
,
size_t
size
)
{
DWORD
bytes_written
;
size_t
retval
;
DBUG_ENTER
(
"vio_write_pipe"
);
DBUG_PRINT
(
"enter"
,
(
"sd: %d buf: 0x%lx size: %u"
,
vio
->
sd
,
(
long
)
buf
,
(
uint
)
size
));
if
(
!
WriteFile
(
vio
->
hPipe
,
buf
,
(
DWORD
)
size
,
&
bytes_written
,
if
(
WriteFile
(
vio
->
hPipe
,
buf
,
(
DWORD
)
size
,
&
bytes_written
,
&
(
vio
->
pipe_overlapped
)))
{
retval
=
bytes_written
;
}
else
{
if
(
GetLastError
()
!=
ERROR_IO_PENDING
)
{
...
...
@@ -485,12 +495,11 @@ size_t vio_write_pipe(Vio * vio, const uchar* buf, size_t size)
GetLastError
()));
DBUG_RETURN
((
size_t
)
-
1
);
}
bytes_written
=
pipe_complete_io
(
vio
,
(
char
*
)
buf
,
size
,
vio
->
write_timeout_millis
);
retval
=
pipe_complete_io
(
vio
,
(
char
*
)
buf
,
size
,
vio
->
write_timeout_ms
);
}
DBUG_PRINT
(
"exit"
,
(
"%
d"
,
bytes_written
));
DBUG_RETURN
(
bytes_written
);
DBUG_PRINT
(
"exit"
,
(
"%
lld"
,
(
longlong
)
retval
));
DBUG_RETURN
(
retval
);
}
...
...
@@ -515,21 +524,21 @@ int vio_close_pipe(Vio * vio)
void
vio_win32_timeout
(
Vio
*
vio
,
uint
which
,
uint
timeout_sec
)
{
DWORD
timeout_m
illi
s
;
DWORD
timeout_ms
;
/*
Windows is measuring timeouts in milliseconds. Check for possible int
overflow.
*/
if
(
timeout_sec
>
UINT_MAX
/
1000
)
timeout_m
illi
s
=
INFINITE
;
timeout_ms
=
INFINITE
;
else
timeout_m
illi
s
=
timeout_sec
*
1000
;
timeout_ms
=
timeout_sec
*
1000
;
/* which == 1 means "write", which == 0 means "read".*/
if
(
which
)
vio
->
write_timeout_m
illis
=
timeout_milli
s
;
vio
->
write_timeout_m
s
=
timeout_m
s
;
else
vio
->
read_timeout_m
illis
=
timeout_milli
s
;
vio
->
read_timeout_m
s
=
timeout_m
s
;
}
...
...
@@ -564,7 +573,7 @@ size_t vio_read_shared_memory(Vio * vio, uchar* buf, size_t size)
WAIT_ABANDONED_0 and WAIT_TIMEOUT - fail. We can't read anything
*/
if
(
WaitForMultipleObjects
(
array_elements
(
events
),
events
,
FALSE
,
vio
->
read_timeout_m
illi
s
)
!=
WAIT_OBJECT_0
)
vio
->
read_timeout_ms
)
!=
WAIT_OBJECT_0
)
{
DBUG_RETURN
(
-
1
);
};
...
...
@@ -621,7 +630,7 @@ size_t vio_write_shared_memory(Vio * vio, const uchar* buf, size_t size)
while
(
remain
!=
0
)
{
if
(
WaitForMultipleObjects
(
array_elements
(
events
),
events
,
FALSE
,
vio
->
write_timeout_m
illi
s
)
!=
WAIT_OBJECT_0
)
vio
->
write_timeout_ms
)
!=
WAIT_OBJECT_0
)
{
DBUG_RETURN
((
size_t
)
-
1
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment