Commit 82a6a858 authored by unknown's avatar unknown
Browse files

Merge willster.(none):/home/stewart/Documents/MySQL/5.1/ndb

into  willster.(none):/home/stewart/Documents/MySQL/5.1/pending

parents d712fa88 43ce2617
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -796,3 +796,42 @@ Variable_name Value
ndb_index_stat_cache_entries	32
ndb_index_stat_enable	OFF
ndb_index_stat_update_freq	20
create table t1 (a int primary key) engine = ndb;
insert into t1 values (1), (2), (3);
begin;
delete from t1 where a > 1;
rollback;
select * from t1 order by a;
a
1
2
3
begin;
delete from t1 where a > 1;
rollback;
begin;
select * from t1 order by a;
a
1
2
3
delete from t1 where a > 2;
select * from t1 order by a;
a
1
2
delete from t1 where a > 1;
select * from t1 order by a;
a
1
delete from t1 where a > 0;
select * from t1 order by a;
a
rollback;
select * from t1 order by a;
a
1
2
3
delete from t1;
drop table t1;
+25 −0
Original line number Diff line number Diff line
@@ -430,3 +430,28 @@ set ndb_index_stat_update_freq = @@global.ndb_index_stat_update_freq;
show session variables like 'ndb_index_stat_%';

# End of 4.1 tests

# bug#24039

create table t1 (a int primary key) engine = ndb;
insert into t1 values (1), (2), (3);
begin;
delete from t1 where a > 1;
rollback;
select * from t1 order by a;
begin;
delete from t1 where a > 1;
rollback;

begin;
select * from t1 order by a;
delete from t1 where a > 2;
select * from t1 order by a;
delete from t1 where a > 1;
select * from t1 order by a;
delete from t1 where a > 0;
select * from t1 order by a;
rollback;
select * from t1 order by a;
delete from t1;
drop table t1;
+50 −32
Original line number Diff line number Diff line
@@ -53,10 +53,6 @@ readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
  if(buflen <= 1)
    return 0;

  int sock_flags= fcntl(socket, F_GETFL);
  if(fcntl(socket, F_SETFL, sock_flags | O_NONBLOCK) == -1)
    return -1;

  fd_set readset;
  FD_ZERO(&readset);
  FD_SET(socket, &readset);
@@ -76,43 +72,65 @@ readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
  }

  if(selectRes == -1){
    fcntl(socket, F_SETFL, sock_flags);
    return -1;
  }

  const int t = recv(socket, buf, buflen, MSG_PEEK);
  char* ptr = buf;
  int len = buflen;
  do
  {
    int t;
    while((t = recv(socket, ptr, len, MSG_PEEK)) == -1 && errno == EINTR);
    
    if(t < 1)
    {
    fcntl(socket, F_SETFL, sock_flags);
      return -1;
    }

    
    for(int i = 0; i<t; i++)
    {
    if(buf[i] == '\n'){
      int r= recv(socket, buf, i+1, 0);
      buf[i+1]= 0;
      if(r < 1) {
        fcntl(socket, F_SETFL, sock_flags);
      if(ptr[i] == '\n')
      {
	/**
	 * Now consume
	 */
	for (len = 1 + i; len; )
	{
	  while ((t = recv(socket, ptr, len, 0)) == -1 && errno == EINTR);
	  if (t < 1)
	    return -1;
	  ptr += t;
	  len -= t;
	}
	ptr[0]= 0;
	return ptr - buf;
      }

      if(i > 0 && buf[i-1] == '\r'){
        buf[i-1] = '\n';
        buf[i]= '\0';
    }
    
      fcntl(socket, F_SETFL, sock_flags);
      return r;
    for (int tmp = t; tmp; )
    {
      while ((t = recv(socket, ptr, tmp, 0)) == -1 && errno == EINTR);
      if (t < 1)
      {
	return -1;
      }
      ptr += t;
      len -= t;
      tmp -= t;
    }

  int r= recv(socket, buf, t, 0);
  if(r>=0)
    buf[r] = 0;
  fcntl(socket, F_SETFL, sock_flags);
  return r;
    FD_ZERO(&readset);
    FD_SET(socket, &readset);
    timeout.tv_sec  = (timeout_millis / 1000);
    timeout.tv_usec = (timeout_millis % 1000) * 1000;
    const int selectRes = select(socket + 1, &readset, 0, 0, &timeout);
    if(selectRes != 1){
      return -1;
    }
  } while (len > 0);
  
  return -1;
}

extern "C"
+2 −1
Original line number Diff line number Diff line
@@ -4394,7 +4394,8 @@ void Dbacc::commitOperation(Signal* signal)
  Uint32 opbits = operationRecPtr.p->m_op_bits;
  Uint32 op = opbits & Operationrec::OP_MASK;
  ndbrequire((opbits & Operationrec::OP_STATE_MASK) == Operationrec::OP_STATE_EXECUTED);
  if ((opbits & Operationrec::OP_COMMIT_DELETE_CHECK) == 0 && (op != ZREAD))
  if ((opbits & Operationrec::OP_COMMIT_DELETE_CHECK) == 0 && 
      (op != ZREAD && op != ZSCAN_OP))
  {
    jam();
    /*  This method is used to check whether the end result of the transaction