List:Internals« Previous MessageNext Message »
From:jonas Date:April 14 2006 7:25pm
Subject:bk commit into 5.0 tree (jonas:1.2011)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2011 06/04/14 19:25:42 jonas@eel.(none) +3 -0
  ndb - atrt
    add initial version of sprocs

  ndb/test/run-test/atrt_sproc.sql
    1.1 06/04/14 19:25:06 jonas@eel.(none) +111 -0

  ndb/test/run-test/atrt_schema.sql
    1.1 06/04/14 19:25:06 jonas@eel.(none) +13 -0

  ndb/test/run-test/atrt_sproc.sql
    1.0 06/04/14 19:25:06 jonas@eel.(none) +0 -0
    BitKeeper file /home/jonas/src/50-atrt/ndb/test/run-test/atrt_sproc.sql

  ndb/test/run-test/atrt_schema.sql
    1.0 06/04/14 19:25:06 jonas@eel.(none) +0 -0
    BitKeeper file /home/jonas/src/50-atrt/ndb/test/run-test/atrt_schema.sql

  ndb/test/run-test/atrt_all.sql
    1.1 06/04/14 19:25:05 jonas@eel.(none) +10 -0

  ndb/test/run-test/atrt_all.sql
    1.0 06/04/14 19:25:05 jonas@eel.(none) +0 -0
    BitKeeper file /home/jonas/src/50-atrt/ndb/test/run-test/atrt_all.sql

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jonas
# Host:	eel.(none)
# Root:	/home/jonas/src/50-atrt
--- New file ---
+++ ndb/test/run-test/atrt_all.sql	06/04/14 19:25:05
source atrt_schema.sql;
source atrt_sproc.sql;

-- initial
-- registered
-- initializer
-- main
-- stopped
-- paused
-- sync

--- New file ---
+++ ndb/test/run-test/atrt_schema.sql	06/04/14 19:25:06
drop database if exists atrt;
create database atrt;
use atrt;

create table atrt_program  (
  tid int not null, 
  pid int not null, 
  status varchar(255) not null default 'initial', 
  extra varchar(255),
  primary key(tid, pid), key(status)) engine=innodb;

insert into atrt_program(tid, pid) values (1,1);
insert into atrt_program(tid, pid) values (1,2);

--- New file ---
+++ ndb/test/run-test/atrt_sproc.sql	06/04/14 19:25:06
delimiter | ;
drop procedure if exists atrt_register |
drop procedure if exists atrt_initializer |

create procedure atrt_register (xtid int, xpid int)
begin
  declare cnt int;

  select count(*) into cnt
  from atrt_program
  where status <> 'registering';

  update atrt_program set status = 'registering'
  where tid = xtid and pid = xpid;
  commit;

  if cnt = 1
  then
    update atrt_program set status = 'registered'
    where tid = xtid;
    commit;
  end if;

  wait_label: loop
    select count(*) into cnt 
    from atrt_program 
    where tid = xtid and pid = xpid
      and status = 'registered';

    if cnt = 1
    then
      leave wait_label;
    end if;
    select sleep(1) into cnt;
  end loop wait_label;	

end; |

create procedure atrt_initializer (xtid int, xpid int, 
                                   name varchar(255), out run int) 
begin
  declare xxpid int;
  declare xtra varchar(255);
  declare xstatus varchar(255);
  declare cnt int;

  select count(*) into cnt
  from atrt_program
  where status not in ('wait-main', 'wait-initializer');

  if name is not null
  then
    update atrt_program set status = 'wait-initializer', extra = name
    where tid = xtid and pid = xpid;
  else
    update atrt_program set status = 'wait-main', extra = null
    where tid = xtid and pid = xpid;
  end if;
  commit;

  if cnt = 1
  then begin
    select pid, extra into xxpid, xtra
    from atrt_program
    where tid = xtid
      and status = 'wait-initializer'
    order by extra limit 1;

    if xtra is null
    then
      update atrt_program set status = 'main'
      where tid = xtid;
    else
      update atrt_program
      set status = 'initializer'
      where pid = xxpid and xtid = xtid;
    end if;
    commit;
  end; end if;

  wait_label: loop
    select status into xstatus
    from atrt_program 
    where tid = xtid and pid = xpid;

    if xstatus <> 'wait-initializer' and xstatus <> 'wait-main'
    then
      leave wait_label;
    end if;
    select sleep(1) into cnt;
  end loop wait_label;	

  if xstatus = 'registered'
  then
    set run = 0;
  end if;

  if xstatus = 'main'
  then
    set run = 0;
  end if;

  if xstatus = 'initializer'
  then 
    update atrt_program set status = 'registered'
    where tid = xtid and pid <> xxpid and extra = name;
    commit;
    set run = 1;
  end if;

end; |

Thread
bk commit into 5.0 tree (jonas:1.2011)jonas14 Apr