/ Changes On Branch retry-short-reads
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch retry-short-reads Excluding Merge-Ins

This is equivalent to a diff from c7c6050ef0 to 7225663477

2012-10-05
18:35
Backport fixes to shared-cache mode, from the shared-cache-fix branch, to version 3.7.9 (check-in: ac81ae493f user: drh tags: branch-3.7.9)
2011-11-14
02:53
Fix a 8-byte alignment problem that causes a SIGBUS on Sparc. (check-in: 54cc119811 user: drh tags: branch-3.7.9)
2011-11-08
15:06
Cherrypick the [5dbfaed8c3] patch so that SQLITE_OMIT_WAL works again. (Closed-Leaf check-in: a499ae3835 user: drh tags: omit-wal-fix)
2011-11-04
00:23
Make sure the INSERT INTO ... SELECT statement works correctly even when the destination table contains an INTEGER PRIMARY KEY ON CONFLICT... column. Ticket [676bc02b87176125]. (check-in: 6f9898db7f user: drh tags: trunk)
2011-11-01
15:45
If the read() system call in unix returns fewer bytes than expected, retry it until it either returns zero or an error. (Closed-Leaf check-in: 7225663477 user: drh tags: retry-short-reads)
00:52
Version 3.7.9 (check-in: c7c6050ef0 user: drh tags: trunk, release, version-3.7.9)
2011-10-31
12:25
Fix a typo in a comment. No code changes. (check-in: 6635cd9a77 user: drh tags: trunk)

Changes to src/os_unix.c.

2940
2941
2942
2943
2944
2945
2946

2947
2948
2949
2950

2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969






2970
2971
2972

2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
** See tickets #2741 and #2681.
**
** To avoid stomping the errno value on a failed read the lastErrno value
** is set before returning.
*/
static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){
  int got;

#if (!defined(USE_PREAD) && !defined(USE_PREAD64))
  i64 newOffset;
#endif
  TIMER_START;

#if defined(USE_PREAD)
  do{ got = osPread(id->h, pBuf, cnt, offset); }while( got<0 && errno==EINTR );
  SimulateIOError( got = -1 );
#elif defined(USE_PREAD64)
  do{ got = osPread64(id->h, pBuf, cnt, offset); }while( got<0 && errno==EINTR);
  SimulateIOError( got = -1 );
#else
  newOffset = lseek(id->h, offset, SEEK_SET);
  SimulateIOError( newOffset-- );
  if( newOffset!=offset ){
    if( newOffset == -1 ){
      ((unixFile*)id)->lastErrno = errno;
    }else{
      ((unixFile*)id)->lastErrno = 0;			
    }
    return -1;
  }
  do{ got = osRead(id->h, pBuf, cnt); }while( got<0 && errno==EINTR );
#endif






  TIMER_END;
  if( got<0 ){
    ((unixFile*)id)->lastErrno = errno;

  }
  OSTRACE(("READ    %-3d %5d %7lld %llu\n", id->h, got, offset, TIMER_ELAPSED));
  return got;
}

/*
** Read data from a file into a buffer.  Return SQLITE_OK if all
** bytes were read successfully and SQLITE_IOERR if anything goes
** wrong.
*/







>




>

|
|

|
|

|
|
|
|
|
|
|
|
|
|
|

>
>
>
>
>
>



>

|
|







2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
** See tickets #2741 and #2681.
**
** To avoid stomping the errno value on a failed read the lastErrno value
** is set before returning.
*/
static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){
  int got;
  int total = 0;
#if (!defined(USE_PREAD) && !defined(USE_PREAD64))
  i64 newOffset;
#endif
  TIMER_START;
  while( cnt>0 ){
#if defined(USE_PREAD)
    do{ got = osPread(id->h, pBuf, cnt, offset); }while(got<0 && errno==EINTR);
    SimulateIOError( got = -1 );
#elif defined(USE_PREAD64)
    do{ got = osPread64(id->h, pBuf,cnt,offset); }while(got<0 && errno==EINTR);
    SimulateIOError( got = -1 );
#else
    newOffset = lseek(id->h, offset, SEEK_SET);
    SimulateIOError( newOffset-- );
    if( newOffset!=offset ){
      if( newOffset == -1 ){
        ((unixFile*)id)->lastErrno = errno;
      }else{
        ((unixFile*)id)->lastErrno = 0;			
      }
      return -1;
    }
    do{ got = osRead(id->h, pBuf, cnt); }while( got<0 && errno==EINTR );
#endif
    if( got<=0 ) break;
    total += got;
    cnt -= got;
    offset += got;
    pBuf = (void*)(got + (char*)pBuf);
  }
  TIMER_END;
  if( got<0 ){
    ((unixFile*)id)->lastErrno = errno;
    total = got;
  }
  OSTRACE(("READ    %-3d %5d %7lld %llu\n", id->h,total,offset,TIMER_ELAPSED));
  return total;
}

/*
** Read data from a file into a buffer.  Return SQLITE_OK if all
** bytes were read successfully and SQLITE_IOERR if anything goes
** wrong.
*/