Dirty Reads

ta5
Member Posts: 1,164
Quite a while ago, I have seen a demo, showing the typical problem of a dirty read.
There was one process writing sales headers and sales lines, while another process was reading them for export purposes. Because no explicit lockings were issued, the read process (NAS with Timer) exported not always all lines for a given header, because when looping thrue the lines while the first process was still writing and at some point "line.next = 0" was true. This means the first process eventually wrote 10 sales lines, but the second process only exported 5 sales lines.
So this was quite logical to me and I wanted to build another example for a demo, but simplier:
On one client I start a codeunit that inserts a few records in table xy, at the end there is a confirm, waiting as long as I want. On another client I run a form on table xy, but the records are not there. No dirty reads!?
Platform: NAV 2009 SP1 on SQL Server 2008.
Whats wrong with this example? ](*,)
Thanks in avance.
Thomas
There was one process writing sales headers and sales lines, while another process was reading them for export purposes. Because no explicit lockings were issued, the read process (NAS with Timer) exported not always all lines for a given header, because when looping thrue the lines while the first process was still writing and at some point "line.next = 0" was true. This means the first process eventually wrote 10 sales lines, but the second process only exported 5 sales lines.
So this was quite logical to me and I wanted to build another example for a demo, but simplier:
On one client I start a codeunit that inserts a few records in table xy, at the end there is a confirm, waiting as long as I want. On another client I run a form on table xy, but the records are not there. No dirty reads!?
Platform: NAV 2009 SP1 on SQL Server 2008.
Whats wrong with this example? ](*,)
Thanks in avance.
Thomas
0
Answers
-
INSERTs are buffered before even being sent to the server, until another operation is issued (such as FIND), or until an explicit COMMIT, or implicit platform commit. This is why you dont see them.
Try using "IF Rec.INSERT THEN;" instead - in this case the INSERTs are not buffered because the result of each INSERT is required immediately by the IF. Or you could make your test differently using MODIFY and look at the dirty reads of modified but uncommitted records.Dean McCrae - Senior Software Developer, NAV Server & Tools
This posting is provided "AS IS" with no warranties, and confers no rights.0 -
Hi dmccrae
I have issued "if xy.find('-) then;" on the first client, just after the insert. It works now as expected, you have just made my afternoon! =D>
Thanks a ton.
Thomas0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions