Página 2 de 2
LETO - bug em TRANSAÇÕES
Enviado: 14 Jun 2014 15:12
por janio
Testei com o codigo do Kresin e deu o mesmo: ele so encontra o registro q esta em buffer depois do comit da transação!
Mesmo em buffer esse registro era pra estar visivel pra maquina q lançou e invisivel (por nao estar em disco ainda) pra outras maquinas da rede, num eh nao???
LETO - bug em TRANSAÇÕES
Enviado: 14 Jun 2015 16:08
por Itamar M. Lins Jr.
Ola!
Se vc criar um exemplo bem compacto, com criação do dbf, indices, que demonstre o problema, eu acredito que isso já teria sido corrigido desde muito tempo.
Tem que demonstrar de uma forma bem clara para todos esse defeito, ai eles corrigem logo!
Saudações,
Itamar M. Lins Jr.
LETO - bug em TRANSAÇÕES
Enviado: 14 Jun 2015 17:18
por janio
No LETO usando transações, ele so enxerga o registro inserido pela estação depois de comitar a transação.
Ocorre q esse comportamento eh DIFERENTE de outros RDD's (DBFCDX, MEDIATOR+MYSQL), que mesmo antes do Commit o registro esta visivel para a maquina que o lançou. No leto SEM TRANSAÇÃO tbm o registro fica visivel.
O problema esta somente qndo ha transação.
Teste Leto com Transação:
Código: Selecionar todos
Function Main( cPath )
Local i, aStru
Field NAME, NUM, INFO, DINFO
REQUEST LETO
RDDSETDEFAULT( "LETO" )
SET DATE FORMAT "dd/mm/yy"
IF Empty( cPath )
cPath := "//127.0.0.1:2812/temp/"
ELSE
cPath := "//" + cPath + Iif( Right(cPath,1) $ "/\", "", "/" )
ENDIF
Leto_fErase( cPath+"test1" )
dbCreate( cPath+"test1", { {"CODIGO","N",5,0}, {"DESCRI","C",10,0} } )
? "File has been created"
USE ( cPath+"test1" ) New
? "File has been opened"
INDEX ON CODIGO TAG CHAVE
? "File has been indexed"
leto_BeginTransaction()
APPEND BLANK
REPLACE CODIGO WITH 1
REPLACE DESCRI WITH "TESTEEEE"
? "Records has been added"
DbGoTop()
? DbSeek( 1 ) // nao encontrou o registro q acabou de ser inserido
leto_CommitTransaction()
DbGoTop()
? DbSeek( 1 ) // agora encontrou, depois do commit
?
? "Press any key to finish..."
Inkey(0)
Return Nil
Teste Leto SEM TRANSAÇÃO:
Código: Selecionar todos
Function Main( cPath )
Local i, aStru
Field NAME, NUM, INFO, DINFO
REQUEST LETO
RDDSETDEFAULT( "LETO" )
SET DATE FORMAT "dd/mm/yy"
IF Empty( cPath )
cPath := "//127.0.0.1:2812/temp/"
ELSE
cPath := "//" + cPath + Iif( Right(cPath,1) $ "/\", "", "/" )
ENDIF
Leto_fErase( cPath+"test1" )
dbCreate( cPath+"test1", { {"CODIGO","N",5,0}, {"DESCRI","C",10,0} } )
? "File has been created"
USE ( cPath+"test1" ) New
? "File has been opened"
INDEX ON CODIGO TAG CHAVE
? "File has been indexed"
APPEND BLANK
REPLACE CODIGO WITH 1
REPLACE DESCRI WITH "TESTEEEE"
? "Records has been added"
DbGoTop()
? DbSeek( 1 ) // ENCONTROU antes do commit (ainda no buffer)
DbCommit()
DbUnLock()
DbGoTop()
? DbSeek( 1 ) // ENCONTROU novamente, depois do commit
?
? "Press any key to finish..."
Inkey(0)
Return Nil
Teste em DBFCDX:
Código: Selecionar todos
Function Main( cPath )
Local i, aStru
Field NAME, NUM, INFO, DINFO
REQUEST DBFCDX
RDDSETDEFAULT( "DBFCDX" )
SET DATE FORMAT "dd/mm/yy"
fErase( "test1.dbf" )
dbCreate( "test1.dbf", { {"CODIGO","N",5,0}, {"DESCRI","C",10,0} } )
? "File has been created"
USE ( "test1" ) New
? "File has been opened"
INDEX ON CODIGO TAG CHAVE
? "File has been indexed"
APPEND BLANK
REPLACE CODIGO WITH 1
REPLACE DESCRI WITH "TESTEEEE"
? "Records has been added"
DbGoTop()
? DbSeek( 1 ) // ENCONTROU o registro q acabou de ser inserido mesmo ANTES DO COMMIT
DbCommit()
DbUnLock()
DbGoTop()
? DbSeek( 1 ) // ENCONTROU novamente, depois do commit
?
? "Press any key to finish..."
Inkey(0)
Return Nil
LETO - bug em TRANSAÇÕES
Enviado: 14 Jun 2015 19:28
por Itamar M. Lins Jr.
Tic,tac... Vamos aguardar né ?
Saudações,
Itamar M. Lins Jr.
LETO - bug em TRANSAÇÕES
Enviado: 17 Jun 2015 11:51
por Itamar M. Lins Jr.
Ola!
Xiii...
This is a correct behaviour. When you process a transaction, all
operations, which updates the database, are buffered on the client side
and are sent to the server for execution while leto_CommitTransaction().
So, before the leto_CommitTransaction() is complete, the database on the
server isn't updated and the records are not added. This is the way as
transactions works.
Regards, Alexander.
Pelo menos ele respondeu.
Falta ver o BUG da demora quando o arquivo é muito grande...
Saudações,
Itamar M. Lins Jr.
LETO - bug em TRANSAÇÕES
Enviado: 17 Jun 2015 15:13
por Cavalo Marinho
Certo, é o comportamento correto, mas para o usuário que está atualizando as tabelas estes valores já deveriam está visíveis, pelo que eu entendi que o Janio falou não era para esta disponível para outros usuários, mas para ele mesmo, ou seja eu atualizo um determinado registro e preciso desta informação já deveria está disponível para mim, mas para os outros usuários só quando executar o commit. Talvez ele não tenha entendido o real problema apresentado.
LETO - bug em TRANSAÇÕES
Enviado: 17 Jun 2015 16:32
por janio
Uso transacaoes com mediator+mysql e não funciona assim!
LETO - bug em TRANSAÇÕES
Enviado: 18 Jun 2015 09:54
por Itamar M. Lins Jr.
Ola!
Leia o complemento sobre funcionar no mediator.
I don't know, how transactions are implemented in the mediator, maybe, they are not real transactions

. The logic of transaction demands, that it is executed after COMMIT TRANSACTION, isn't it ? So, the data isn't changed before the commit. I may suppose, that the mediator seeks the newly added record in a memory buffer on client side - maybe. Letodb doesn't do this. We consider, that the transaction is intended for updating the database, so only update operations should be placed inside it.
Regards, Alexander.
Saudações,
Itamar M. Lins Jr.