Skip to content

Commit 9c55f83

Browse files
committed
Cleanup - remove HAVE_AIOWAIT and associated code from mysys
HAVE_AIOWAIT had not been disabled and unused for at least 10 years.
1 parent 4af3f84 commit 9c55f83

File tree

4 files changed

+0
-273
lines changed

4 files changed

+0
-273
lines changed

config.h.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@
125125
/* Functions we may want to use. */
126126
#cmakedefine HAVE_ACCEPT4 1
127127
#cmakedefine HAVE_ACCESS 1
128-
#cmakedefine HAVE_AIOWAIT 1
129128
#cmakedefine HAVE_ALARM 1
130129
#cmakedefine HAVE_ALLOCA 1
131130
#cmakedefine HAVE_BFILL 1

configure.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ ENDIF()
316316
#
317317
CHECK_FUNCTION_EXISTS (accept4 HAVE_ACCEPT4)
318318
CHECK_FUNCTION_EXISTS (access HAVE_ACCESS)
319-
#CHECK_FUNCTION_EXISTS (aiowait HAVE_AIOWAIT)
320319
CHECK_FUNCTION_EXISTS (alarm HAVE_ALARM)
321320
SET(HAVE_ALLOCA 1)
322321
CHECK_FUNCTION_EXISTS (backtrace HAVE_BACKTRACE)

include/my_sys.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222

2323
C_MODE_START
2424

25-
#ifdef HAVE_AIOWAIT
26-
#include <sys/asynch.h> /* Used by record-cache */
27-
typedef struct my_aio_result {
28-
aio_result_t result;
29-
int pending;
30-
} my_aio_result;
31-
#endif
3225

3326
#include <my_valgrind.h>
3427

@@ -311,10 +304,6 @@ typedef struct st_record_cache /* Used when caching records */
311304
uint rc_length,read_length,reclength;
312305
my_off_t rc_record_pos,end_of_file;
313306
uchar *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
314-
#ifdef HAVE_AIOWAIT
315-
int use_async_io;
316-
my_aio_result aio_result;
317-
#endif
318307
enum cache_type type;
319308
} RECORD_CACHE;
320309

@@ -483,15 +472,6 @@ typedef struct st_io_cache /* Used when caching files */
483472
somewhere else
484473
*/
485474
my_bool alloced_buffer;
486-
#ifdef HAVE_AIOWAIT
487-
/*
488-
As inidicated by ifdef, this is for async I/O, which is not currently
489-
used (because it's not reliable on all systems)
490-
*/
491-
uint inited;
492-
my_off_t aio_read_pos;
493-
my_aio_result aio_result;
494-
#endif
495475
} IO_CACHE;
496476

497477
typedef int (*qsort2_cmp)(const void *, const void *, const void *);
@@ -810,7 +790,6 @@ void end_slave_io_cache(IO_CACHE *cache);
810790
void seek_io_cache(IO_CACHE *cache, my_off_t needed_offset);
811791

812792
extern void remove_io_thread(IO_CACHE *info);
813-
extern int _my_b_async_read(IO_CACHE *info,uchar *Buffer,size_t Count);
814793
extern int my_b_append(IO_CACHE *info,const uchar *Buffer,size_t Count);
815794
extern int my_b_safe_write(IO_CACHE *info,const uchar *Buffer,size_t Count);
816795

mysys/mf_iocache.c

Lines changed: 0 additions & 250 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@
5050

5151
#include "mysys_priv.h"
5252
#include <m_string.h>
53-
#ifdef HAVE_AIOWAIT
54-
#include "mysys_err.h"
55-
static void my_aiowait(my_aio_result *result);
56-
#endif
5753
#include <errno.h>
5854
#include "mysql/psi/mysql_file.h"
5955

@@ -295,16 +291,6 @@ int init_io_cache_ext(IO_CACHE *info, File file, size_t cachesize,
295291
info->error=0;
296292
info->type= type;
297293
init_functions(info);
298-
#ifdef HAVE_AIOWAIT
299-
if (use_async_io && ! my_disable_async_io)
300-
{
301-
DBUG_PRINT("info",("Using async io"));
302-
DBUG_ASSERT(!(cache_myflags & MY_ENCRYPT));
303-
info->read_length/=2;
304-
info->read_function=_my_b_async_read;
305-
}
306-
info->inited=info->aio_result.pending=0;
307-
#endif
308294
DBUG_RETURN(0);
309295
}
310296

@@ -420,33 +406,6 @@ void seek_io_cache(IO_CACHE *cache, my_off_t needed_offset)
420406
}
421407
}
422408

423-
/* Wait until current request is ready */
424-
425-
#ifdef HAVE_AIOWAIT
426-
static void my_aiowait(my_aio_result *result)
427-
{
428-
if (result->pending)
429-
{
430-
struct aio_result_t *tmp;
431-
for (;;)
432-
{
433-
if ((int) (tmp=aiowait((struct timeval *) 0)) == -1)
434-
{
435-
if (errno == EINTR)
436-
continue;
437-
DBUG_PRINT("error",("No aio request, error: %d",errno));
438-
result->pending=0; /* Assume everything is ok */
439-
break;
440-
}
441-
((my_aio_result*) tmp)->pending=0;
442-
if ((my_aio_result*) tmp == result)
443-
break;
444-
}
445-
}
446-
return;
447-
}
448-
#endif
449-
450409

451410
/*
452411
Use this to reset cache to re-start reading or to change the type
@@ -499,9 +458,6 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
499458
info->write_pos=pos;
500459
else
501460
info->read_pos= pos;
502-
#ifdef HAVE_AIOWAIT
503-
my_aiowait(&info->aio_result); /* Wait for outstanding req */
504-
#endif
505461
}
506462
else
507463
{
@@ -556,18 +512,6 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
556512
info->type=type;
557513
info->error=0;
558514
init_functions(info);
559-
560-
#ifdef HAVE_AIOWAIT
561-
if (use_async_io && ! my_disable_async_io &&
562-
((ulong) info->buffer_length <
563-
(ulong) (info->end_of_file - seek_offset)))
564-
{
565-
DBUG_ASSERT(!(cache_myflags & MY_ENCRYPT));
566-
info->read_length=info->buffer_length/2;
567-
info->read_function=_my_b_async_read;
568-
}
569-
info->inited=0;
570-
#endif
571515
DBUG_RETURN(0);
572516
} /* reinit_io_cache */
573517

@@ -1533,193 +1477,6 @@ static int _my_b_seq_read(IO_CACHE *info, uchar *Buffer, size_t Count)
15331477
}
15341478

15351479

1536-
#ifdef HAVE_AIOWAIT
1537-
1538-
/*
1539-
Read from the IO_CACHE into a buffer and feed asynchronously
1540-
from disk when needed.
1541-
1542-
SYNOPSIS
1543-
_my_b_async_read()
1544-
info IO_CACHE pointer
1545-
Buffer Buffer to retrieve count bytes from file
1546-
Count Number of bytes to read into Buffer
1547-
1548-
RETURN VALUE
1549-
-1 An error has occurred; my_errno is set.
1550-
0 Success
1551-
1 An error has occurred; IO_CACHE to error state.
1552-
*/
1553-
1554-
int _my_b_async_read(IO_CACHE *info, uchar *Buffer, size_t Count)
1555-
{
1556-
size_t length, read_length, diff_length, left_length=0, use_length, org_Count;
1557-
size_t max_length;
1558-
my_off_t next_pos_in_file;
1559-
uchar *read_buffer;
1560-
1561-
org_Count=Count;
1562-
1563-
if (info->inited)
1564-
{ /* wait for read block */
1565-
info->inited=0; /* No more block to read */
1566-
my_aiowait(&info->aio_result); /* Wait for outstanding req */
1567-
if (info->aio_result.result.aio_errno)
1568-
{
1569-
if (info->myflags & MY_WME)
1570-
my_error(EE_READ, MYF(ME_BELL), my_filename(info->file),
1571-
info->aio_result.result.aio_errno);
1572-
my_errno=info->aio_result.result.aio_errno;
1573-
info->error= -1;
1574-
return(1);
1575-
}
1576-
if (! (read_length= (size_t) info->aio_result.result.aio_return) ||
1577-
read_length == (size_t) -1)
1578-
{
1579-
my_errno=0; /* For testing */
1580-
info->error= (read_length == (size_t) -1 ? -1 :
1581-
(int) (read_length+left_length));
1582-
return(1);
1583-
}
1584-
info->pos_in_file+= (size_t) (info->read_end - info->request_pos);
1585-
1586-
if (info->request_pos != info->buffer)
1587-
info->request_pos=info->buffer;
1588-
else
1589-
info->request_pos=info->buffer+info->read_length;
1590-
info->read_pos=info->request_pos;
1591-
next_pos_in_file=info->aio_read_pos+read_length;
1592-
1593-
/* Check if pos_in_file is changed
1594-
(_ni_read_cache may have skipped some bytes) */
1595-
1596-
if (info->aio_read_pos < info->pos_in_file)
1597-
{ /* Fix if skipped bytes */
1598-
if (info->aio_read_pos + read_length < info->pos_in_file)
1599-
{
1600-
read_length=0; /* Skip block */
1601-
next_pos_in_file=info->pos_in_file;
1602-
}
1603-
else
1604-
{
1605-
my_off_t offset= (info->pos_in_file - info->aio_read_pos);
1606-
info->pos_in_file=info->aio_read_pos; /* Whe are here */
1607-
info->read_pos=info->request_pos+offset;
1608-
read_length-=offset; /* Bytes left from read_pos */
1609-
}
1610-
}
1611-
#ifndef DBUG_OFF
1612-
if (info->aio_read_pos > info->pos_in_file)
1613-
{
1614-
my_errno=EINVAL;
1615-
return(info->read_length= (size_t) -1);
1616-
}
1617-
#endif
1618-
/* Copy found bytes to buffer */
1619-
length=MY_MIN(Count,read_length);
1620-
memcpy(Buffer,info->read_pos,(size_t) length);
1621-
Buffer+=length;
1622-
Count-=length;
1623-
left_length+=length;
1624-
info->read_end=info->rc_pos+read_length;
1625-
info->read_pos+=length;
1626-
}
1627-
else
1628-
next_pos_in_file=(info->pos_in_file+ (size_t)
1629-
(info->read_end - info->request_pos));
1630-
1631-
/* If reading large blocks, or first read or read with skip */
1632-
if (Count)
1633-
{
1634-
if (next_pos_in_file == info->end_of_file)
1635-
{
1636-
info->error=(int) (read_length+left_length);
1637-
return 1;
1638-
}
1639-
1640-
if (mysql_file_seek(info->file, next_pos_in_file, MY_SEEK_SET, MYF(0))
1641-
== MY_FILEPOS_ERROR)
1642-
{
1643-
info->error= -1;
1644-
return (1);
1645-
}
1646-
1647-
read_length=IO_SIZE*2- (size_t) (next_pos_in_file & (IO_SIZE-1));
1648-
if (Count < read_length)
1649-
{ /* Small block, read to cache */
1650-
if ((read_length=mysql_file_read(info->file,info->request_pos,
1651-
read_length, info->myflags)) == (size_t) -1)
1652-
return info->error= -1;
1653-
use_length=MY_MIN(Count,read_length);
1654-
memcpy(Buffer,info->request_pos,(size_t) use_length);
1655-
info->read_pos=info->request_pos+Count;
1656-
info->read_end=info->request_pos+read_length;
1657-
info->pos_in_file=next_pos_in_file; /* Start of block in cache */
1658-
next_pos_in_file+=read_length;
1659-
1660-
if (Count != use_length)
1661-
{ /* Didn't find hole block */
1662-
if (info->myflags & (MY_WME | MY_FAE | MY_FNABP) && Count != org_Count)
1663-
my_error(EE_EOFERR, MYF(ME_BELL), my_filename(info->file), my_errno);
1664-
info->error=(int) (read_length+left_length);
1665-
return 1;
1666-
}
1667-
}
1668-
else
1669-
{ /* Big block, don't cache it */
1670-
if ((read_length= mysql_file_read(info->file, Buffer, Count,info->myflags))
1671-
!= Count)
1672-
{
1673-
info->error= read_length == (size_t) -1 ? -1 : read_length+left_length;
1674-
return 1;
1675-
}
1676-
info->read_pos=info->read_end=info->request_pos;
1677-
info->pos_in_file=(next_pos_in_file+=Count);
1678-
}
1679-
}
1680-
1681-
/* Read next block with asyncronic io */
1682-
diff_length=(next_pos_in_file & (IO_SIZE-1));
1683-
max_length= info->read_length - diff_length;
1684-
if (max_length > info->end_of_file - next_pos_in_file)
1685-
max_length= (size_t) (info->end_of_file - next_pos_in_file);
1686-
1687-
if (info->request_pos != info->buffer)
1688-
read_buffer=info->buffer;
1689-
else
1690-
read_buffer=info->buffer+info->read_length;
1691-
info->aio_read_pos=next_pos_in_file;
1692-
if (max_length)
1693-
{
1694-
info->aio_result.result.aio_errno=AIO_INPROGRESS; /* Marker for test */
1695-
DBUG_PRINT("aioread",("filepos: %ld length: %lu",
1696-
(ulong) next_pos_in_file, (ulong) max_length));
1697-
if (aioread(info->file,read_buffer, max_length,
1698-
(my_off_t) next_pos_in_file,MY_SEEK_SET,
1699-
&info->aio_result.result))
1700-
{ /* Skip async io */
1701-
my_errno=errno;
1702-
DBUG_PRINT("error",("got error: %d, aio_result: %d from aioread, async skipped",
1703-
errno, info->aio_result.result.aio_errno));
1704-
if (info->request_pos != info->buffer)
1705-
{
1706-
bmove(info->buffer,info->request_pos,
1707-
(size_t) (info->read_end - info->read_pos));
1708-
info->request_pos=info->buffer;
1709-
info->read_pos-=info->read_length;
1710-
info->read_end-=info->read_length;
1711-
}
1712-
info->read_length=info->buffer_length; /* Use hole buffer */
1713-
info->read_function=_my_b_cache_read; /* Use normal IO_READ next */
1714-
}
1715-
else
1716-
info->inited=info->aio_result.pending=1;
1717-
}
1718-
return 0; /* Block read, async in use */
1719-
} /* _my_b_async_read */
1720-
#endif
1721-
1722-
17231480
/* Read one byte when buffer is empty */
17241481

17251482
int _my_b_get(IO_CACHE *info)
@@ -1978,13 +1735,6 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
19781735
DBUG_RETURN(info->error);
19791736
}
19801737
}
1981-
#ifdef HAVE_AIOWAIT
1982-
else if (info->type != READ_NET)
1983-
{
1984-
my_aiowait(&info->aio_result); /* Wait for outstanding req */
1985-
info->inited=0;
1986-
}
1987-
#endif
19881738
UNLOCK_APPEND_BUFFER;
19891739
DBUG_RETURN(0);
19901740
}

0 commit comments

Comments
 (0)