+ All Categories
Home > Documents > Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

Date post: 05-Jan-2016
Category:
Upload: gladys-goodwin
View: 220 times
Download: 5 times
Share this document with a friend
54
Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12
Transcript
Page 1: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

Strength. Strategy. Stability.

Record Locking and Transaction Scope

DEV-12

Page 2: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

Introduction- Dan ForemanIntroduction- Dan Foreman

ProgressProgress®® User since 1984 User since 1984

Guest speaker at USA Progress Users Guest speaker at USA Progress Users Conference 1990-1998 and 2002-2006Conference 1990-1998 and 2002-2006

Page 3: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

3

Introduction- Dan ForemanIntroduction- Dan ForemanAuthor of: Author of:

Progress Performance Tuning GuideProgress Database Admin GuideVirtual System TablesV9 Database Admin JumpstartOpenEdge 10 Database Admin JumpstartProMonitor - Database Monitoring ToolPro D&L - Dump/Load with very short downtimeDBA Resource Kit - Tools for Database AdministratorsLogical Scatter Analyzer (LSA)

Page 4: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

4

AgendaAgenda

Record ScopeRecord Scope

Record LockingRecord Locking

Transaction ScopeTransaction Scope

4GL Statements that affect Locking4GL Statements that affect Locking

Startup Options that affect LockingStartup Options that affect Locking

MonitoringMonitoring

ConclusionConclusion

QuestionsQuestions

Page 5: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

5

Record ScopeRecord Scope

Every Table is ‘Scoped to’, or ‘associated Every Table is ‘Scoped to’, or ‘associated with’, or ‘connected to’ a Blockwith’, or ‘connected to’ a Block

General Definition: the Block with the Record General Definition: the Block with the Record Scoping Property that is the outermost block Scoping Property that is the outermost block containing references to the Tablecontaining references to the Table

Page 6: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

6

Record ScopeRecord Scope

Blocks with the Scoping PropertyBlocks with the Scoping PropertyFOR

REPEAT

Procedure

Trigger

The DO Block does not have the Scoping The DO Block does not have the Scoping Property unless it is added explicitlyProperty unless it is added explicitly

Page 7: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

7

Record ScopeRecord Scope

There are two kinds of Record Scope:There are two kinds of Record Scope:Strong Scope

Weak Scope

We will discuss each of these shortlyWe will discuss each of these shortly

Page 8: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

8

Record ScopeRecord Scope

Record Scope can be verified with the Record Scope can be verified with the COMPILE/LISTING optionCOMPILE/LISTING option

File Name Line Blk. Type Tran Blk. LabelFile Name Line Blk. Type Tran Blk. Label

-------------------- ---- --------- ---- ----------------------------------------- ---- --------- ---- ---------------------

.\inquiry.p 0 Procedure No.\inquiry.p 0 Procedure No

Frames: MENU1Frames: MENU1

.\inquiry.p 26 Repeat No SUPER-BLOCK.\inquiry.p 26 Repeat No SUPER-BLOCK

Buffers: cust.CustomerBuffers: cust.Customer

Frames: SERCHFrames: SERCH

.\cusfind1.i 8 Repeat No SEARCH-BLK.\cusfind1.i 8 Repeat No SEARCH-BLK

.\cusfind1.i 10 Repeat No SERCH-CTL.\cusfind1.i 10 Repeat No SERCH-CTL

Buffers: cust.Alt-BillingBuffers: cust.Alt-Billing

Page 9: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

9

Record ScopeRecord Scope

Why do we care about Record Scope?Why do we care about Record Scope?

Record Scope can affect the duration of Record Scope can affect the duration of Record LocksRecord Locks

Duration of Record Locks affects your job Duration of Record Locks affects your job securitysecurity

Record Scope determines the maximum Record Scope determines the maximum length of time a Record length of time a Record mightmight remain in the remain in the Client’s Local Buffer, but Record Scope Client’s Local Buffer, but Record Scope does not guarantee that the Record is does not guarantee that the Record is always AVAILABLEalways AVAILABLE

Page 10: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

10

Strong ScopeStrong Scope

Explicitly Scoping a Table to a Block using Explicitly Scoping a Table to a Block using the FOR Optionthe FOR Option

ExampleExample

/* r-scope3.p *//* r-scope3.p */

DO FOR customer :DO FOR customer :

FIND FIRST customer.FIND FIRST customer.

END.END.

DISPLAY AVAILABLE customer.DISPLAY AVAILABLE customer.

Page 11: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

11

Weak ScopeWeak Scope

This type of Scope is called “Weak” This type of Scope is called “Weak” because references to a Table because references to a Table outsideoutside of a of a Weak Scope Block will raise the Record Weak Scope Block will raise the Record Scope to the next highest Block levelScope to the next highest Block levelWeakly Scoped BlocksWeakly Scoped Blocks

REPEAT BlockFOR Block

Note that Trigger and Internal Procedure Note that Trigger and Internal Procedure Blocks do not have the Record Scoping Blocks do not have the Record Scoping PropertyPropertyExample on next slideExample on next slide

Page 12: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

12

ExampleExample

/* r-scope1.p *//* r-scope1.p */

FOR EACH customer :FOR EACH customer :

DISPLAY customer.DISPLAY customer.

END.END.

DISPLAY AVAILABLE customer.DISPLAY AVAILABLE customer.

Page 13: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

13

Transaction ScopeTransaction Scope

Every Transaction is Scoped to a Block

General Rule: Locate the outermost Block (or General Rule: Locate the outermost Block (or Peer Level Blocks) that contain changes to Peer Level Blocks) that contain changes to database tablesdatabase tables

Every Iteration of a Looping Transaction Every Iteration of a Looping Transaction Block is a New TransactionBlock is a New Transaction

Verify with COMPILE/LISTING OptionVerify with COMPILE/LISTING OptionBut sometimes the LISTING Option might not be correct; Example to follow

Page 14: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

14

Transaction Scope ExampleTransaction Scope Example

/* trx-scope1.p *//* trx-scope1.p */

FOR EACH customer :FOR EACH customer :

UPDATE customer.UPDATE customer.

FOR EACH order OF customer:FOR EACH order OF customer:

UPDATE order.UPDATE order.

END.END.

END.END.

Page 15: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

15

Transaction Scope ExampleTransaction Scope Example

/* trx-scope2.p *//* trx-scope2.p */

FOR EACH customer :FOR EACH customer :

DO TRANSACTION :DO TRANSACTION :

UPDATE name.UPDATE name.

END.END.

FOR EACH order OF customer :FOR EACH order OF customer :

UPDATE order.UPDATE order.

END.END.

END.END.

Page 16: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

16

Transaction ScopeTransaction Scope

Sub-procedures called from inside a Sub-procedures called from inside a Transaction Block do Transaction Block do notnot start new start new Transactions and the COMPILE/LISTING Transactions and the COMPILE/LISTING Option will NOT see thisOption will NOT see this

Only one Transaction can be active for a Only one Transaction can be active for a Progress Session; so if there are 20 Progress Session; so if there are 20 Connections to a Database, there can be a Connections to a Database, there can be a Maximum of 20 Active TransactionsMaximum of 20 Active Transactions

Page 17: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

17

Sub-TransactionsSub-Transactions

Exist Inside an Active TransactionExist Inside an Active Transaction

Multiple, Simultaneous Sub-Transactions Multiple, Simultaneous Sub-Transactions are possibleare possible

Purpose: to allow UNDO or Error Handling Purpose: to allow UNDO or Error Handling of smaller units within an Active of smaller units within an Active TransactionTransaction

Page 18: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

18

Example #1Example #1

/* caller.p */

RUN trx-debug.p PERSISTENT.

REPEAT WITH 1 DOWN 1 COLUMN :

PROMPT-FOR order.order-num.

FIND order USING order-num.

UPDATE order-date ship-date promise-date.

RUN called.p ( BUFFER order ).

END.

Page 19: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

19

Example #2Example #2

/* called.p */

DEF PARAMETER BUFFER order FOR order.

DO TRANSACTION :

FOR EACH order-line OF order :

UPDATE order-line EXCEPT order-num.

END.

END.

Page 20: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

20

Example #3Example #3

/* trx-debug.p */

ON f12 ANYWHERE DO:

DEF VAR trx-status AS LOG FORMAT "Active/Inactive" NO-UNDO.

trx-status = TRANSACTION.

MESSAGE

"Transaction Status:" TRANSACTION SKIP

"Program Name:" PROGRAM-NAME(2) SKIP

“DBTASKID:” DBTASKID(“dictdb”) VIEW-AS ALERT-BOX. END.

Page 21: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

21

Override the Default TransactionOverride the Default Transaction

In this example the code is simple butIn this example the code is simple butPerformance is very slow

Cannot be rerun in case of a problem

/* trx1.p *//* trx1.p */

FOR EACH item EXCLUSIVE-LOCK :FOR EACH item EXCLUSIVE-LOCK :

price = price * 1.05.price = price * 1.05.

END.END.

Page 22: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

22

Override the Default TransactionOverride the Default Transaction

The example below can be rerun and is The example below can be rerun and is faster but Before Image file size and Record faster but Before Image file size and Record Locking could be a problemLocking could be a problem

/* trx2.p *//* trx2.p */

DO TRANSACTION:DO TRANSACTION:

FOR EACH item EXCLUSIVE-LOCK.FOR EACH item EXCLUSIVE-LOCK.

price = price * 1.05.price = price * 1.05.

END.END.

END.END.

Page 23: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

23

Override the Default TransactionOverride the Default Transaction

OK Dan, what is the best solution?OK Dan, what is the best solution?

Unfortunately the best solution is not Unfortunately the best solution is not always an elegant solutionalways an elegant solution

Try trx3.p (next slide)Try trx3.p (next slide)

Page 24: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

24

trx-blk: REPEAT TRANSACTION:trx-blk: REPEAT TRANSACTION:

FOR EACH item EXCLUSIVE WHERE item-num GE last#i = 1 TO 100 :price = price * 1.05.

END.IF AVAILABLE item THEN DO:

last# = item.item-num.FIND FIRST syscontrol EXCLUSIVE.syscontrol.last# = item.item-num.NEXT trx-blk.

END.ELSE DO:

FIND FIRST syscontrol EXCLUSIVE.syscontrol.last# = 0. /* Reset for next time */LEAVE trx-blk.

END.END. /* trx-blk: TRANSACTION */

Page 25: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

25

Record Lock TypesRecord Lock Types

SHARE-LOCKSHARE-LOCK

EXCLUSIVE-LOCKEXCLUSIVE-LOCK

NO-LOCKNO-LOCK

Record Get Lock (not covered in this Record Get Lock (not covered in this presentation because a developer does not presentation because a developer does not need to know what they are or what they need to know what they are or what they do)do)

Note that these are 4GL locks and not Note that these are 4GL locks and not related to SQL92 Isolation Levelsrelated to SQL92 Isolation Levels

Page 26: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

26

SHARE-LOCKSHARE-LOCK

Default Lock Mode for FIND, FOR, etc.Default Lock Mode for FIND, FOR, etc.

Multiple Clients can read the same Record Multiple Clients can read the same Record ConcurrentlyConcurrently

A 4GL process can’t update a Record with A 4GL process can’t update a Record with SHARE-LOCK Status; the Lock must be SHARE-LOCK Status; the Lock must be promoted to EXCLUSIVE-LOCKpromoted to EXCLUSIVE-LOCK

Page 27: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

27

EXCLUSIVE-LOCKEXCLUSIVE-LOCK

SHARE-LOCKs are Automatically upgraded SHARE-LOCKs are Automatically upgraded to EXCLUSIVE-LOCKs when the Record is to EXCLUSIVE-LOCKs when the Record is ChangedChanged

If a Client has an EXCLUSIVE-LOCK, no If a Client has an EXCLUSIVE-LOCK, no other Clients can read the Record unless other Clients can read the Record unless NO-LOCK is usedNO-LOCK is used

Page 28: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

28

NO-LOCKNO-LOCK

Can read any Record even if another Client Can read any Record even if another Client has an EXCLUSIVE-LOCK on the Recordhas an EXCLUSIVE-LOCK on the Record

For this reason NO-LOCK Reads are called For this reason NO-LOCK Reads are called a ‘Dirty’ Reads because the state of the a ‘Dirty’ Reads because the state of the Record cannot be guaranteedRecord cannot be guaranteed

Page 29: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

29

Default Locking RulesDefault Locking Rules

FIND, FOR, OPEN QUERY statements FIND, FOR, OPEN QUERY statements attempt to acquire a SHARE-LOCK on a attempt to acquire a SHARE-LOCK on a RecordRecord

When a Record is Updated, Progress When a Record is Updated, Progress automatically attempts to upgrade the lock automatically attempts to upgrade the lock to EXCLUSIVE-LOCKto EXCLUSIVE-LOCK

Default Lock for a DEFINE BROWSE is NO-Default Lock for a DEFINE BROWSE is NO-LOCK which overrides the Lock specified LOCK which overrides the Lock specified by the associated OPEN QUERY Statementby the associated OPEN QUERY Statement

Page 30: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

30

SHARE-LOCK DurationSHARE-LOCK Duration

The end of Transaction Scope or the end of The end of Transaction Scope or the end of Record Scope whichever is later (i.e. ‘later’ Record Scope whichever is later (i.e. ‘later’ at the Block level)at the Block level)

Page 31: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

31

EXCLUSIVE-LOCK DurationEXCLUSIVE-LOCK Duration

The end of the Transaction!The end of the Transaction!

This Rule cannot be changed no matter This Rule cannot be changed no matter how hard you tryhow hard you try

Page 32: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

32

Downgraded LocksDowngraded Locks

If the Record Scope is at a higher Block If the Record Scope is at a higher Block level than the Transaction Scope, an level than the Transaction Scope, an EXCLUSIVE-LOCK is Automatically EXCLUSIVE-LOCK is Automatically Downgraded to SHARE-LOCKDowngraded to SHARE-LOCK

I call this a Limbo Lock because the I call this a Limbo Lock because the Transaction has ended but the record is Transaction has ended but the record is still locked; Progress has a different still locked; Progress has a different definition of Limbo Lock – defined shortlydefinition of Limbo Lock – defined shortly

Example on next slideExample on next slide

Page 33: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

33

Downgraded LocksDowngraded Locks

Record Scope BlockRecord Scope Block

Read RecordRead Record

Transaction Scope BlockTransaction Scope Block

Change RecordChange Record

EndEnd

Limbo Lock from here to the last EndLimbo Lock from here to the last End

More codeMore code

EndEnd

Page 34: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

34

/* serial2a.p - BROKEN VERSION*/

REPEAT:

DO TRANSACTION:

FIND FIRST syscontrol EXCLUSIVE.

syscontrol.last# = syscontrol.last# + 1.

DISPLAY syscontrol.last# @ order.order-num.

END.

DO TRANSACTION:

CREATE order.

ASSIGN order.order-num.

SET order-date promise-date ship-date.

END.

END.

Page 35: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

35

Fix the ProgramFix the Program

Strong ScopeStrong ScopeThe most efficient way

serial2b.p

RELEASERELEASECan be used in Two possible locations in the Program but let’s talk about the RELEASE Statement first

Page 36: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

36

RELEASE StatementRELEASE Statement

RELEASE cannot Release an EXCLUSIVE-RELEASE cannot Release an EXCLUSIVE-LOCK!!!!LOCK!!!!

RELEASE can Release a SHARE-LOCKRELEASE can Release a SHARE-LOCK

RELEASE cannot Release a SHARE-LOCK RELEASE cannot Release a SHARE-LOCK inside of a Transaction (undocumented)inside of a Transaction (undocumented)

Page 37: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

37

RELEASE StatementRELEASE Statement

If RELEASE is used If RELEASE is used insideinside a Transaction a Transaction block, the Record Lock is flagged block, the Record Lock is flagged to be to be releasedreleased when the Transaction ends when the Transaction ends

RELEASE Flushes the Record from the RELEASE Flushes the Record from the Local BufferLocal Buffer

AVAILABLE = No

But this does not mean the Lock is necessarily Released

Page 38: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

38

RELEASE StatementRELEASE Statement

The Progress definition of Limbo Lock is a The Progress definition of Limbo Lock is a record that has been released but the record that has been released but the Transaction has not endedTransaction has not ended

This Limbo Lock shows a “L” in the Flags This Limbo Lock shows a “L” in the Flags section of section of promonpromon and _Lock VST and _Lock VST

Page 39: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

39

4GL Locking Options4GL Locking Options

The following statements will Re-Read the The following statements will Re-Read the Record in the Buffer with the Specified Record in the Buffer with the Specified Lock StatusLock Status

GET CURRENT <table>GET CURRENT <table>

FIND CURRENT <table> statementFIND CURRENT <table> statement

FIND-CURRENT <table> methodFIND-CURRENT <table> method

Page 40: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

40

4GL Locking Options4GL Locking Options

CURRENT-CHANGED <table>CURRENT-CHANGED <table>Function

Attribute

Returns True if the Record Retrieved with Returns True if the Record Retrieved with one of the previous CURRENT options is one of the previous CURRENT options is different from the Record in the Buffer different from the Record in the Buffer beforebefore executing the CURRENT Record executing the CURRENT Record RetrievalRetrieval

Page 41: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

41

4GL Locking Options4GL Locking Options

NO-WAIT optionNO-WAIT optionOption on DEFINE BROWSE, GET, FIND, CAN-FIND, FIND-BY-ROWID, and more

Can’t be used on FOR EACH

Doesn’t apply to TEMP-TABLEs

Raises the ERROR Condition

Behavior is different on a Browse

Page 42: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

42

4GL Locking Options4GL Locking Options

LOCKED <table> LOCKED <table> Logical Function

Usually follows a NO-WAIT

See lock2.p

See lock4.p for even more options

Page 43: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

43

Optimistic Record LockingOptimistic Record Locking

A 4GL Program reads a Record using NO-A 4GL Program reads a Record using NO-LOCK, changes the data in TEMP-TABLEs, LOCK, changes the data in TEMP-TABLEs, etc. and then re-reads the record etc. and then re-reads the record EXCLUSIVE-LOCK to apply the changes to EXCLUSIVE-LOCK to apply the changes to the Databasethe Database

It’s ‘optimistic’ because we assume that It’s ‘optimistic’ because we assume that usually no other process will touch the usually no other process will touch the record in between the NO-LOCK and the record in between the NO-LOCK and the EXCLUSIVE-LOCK - BUT YOU STILL NEED EXCLUSIVE-LOCK - BUT YOU STILL NEED TO CHECK FOR CHANGES!TO CHECK FOR CHANGES!

Page 44: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

44

Record Locking ExamplesRecord Locking Examples

lock1a.plock1a.p

lock1b.plock1b.p

getcurnt.pgetcurnt.p

Page 45: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

45

Read Only (-RO) OptionRead Only (-RO) Option

Client Startup OptionClient Startup Option

No Record Locking of any kindNo Record Locking of any kind

Not even Record Get LocksNot even Record Get Locks

No entry in the Database Log (.lg) File (until No entry in the Database Log (.lg) File (until OpenEdgeOpenEdge®® 10) 10)

Not advised for use with a Production Not advised for use with a Production DatabaseDatabase

The data might be The data might be logicallylogically corrupt corrupt

Makes 4GL and Binary Dumps FasterMakes 4GL and Binary Dumps Faster

Page 46: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

46

-rereadnolock Startup Option-rereadnolock Startup Option

Client Startup OptionClient Startup Option

Introduced in V8.3BIntroduced in V8.3B

Recommended for Recommended for AllAll 4GL Clients 4GL Clients especially WebSpeedespecially WebSpeed®® Agents and Agents and AppServersAppServers

Page 47: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

47

-rereadnolock Startup Option-rereadnolock Startup Option

User #1 Reads a Record NO-LOCKUser #1 Reads a Record NO-LOCK

User #2 Reads the same record and User #2 Reads the same record and updates itupdates it

User #3 Reads the same Record NO-LOCK User #3 Reads the same Record NO-LOCK but sees the same copy that User #1 has, but sees the same copy that User #1 has, not the updated versionnot the updated version

-rereadnolock Forces Progress to use the -rereadnolock Forces Progress to use the New Version of the RecordNew Version of the Record

Page 48: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

48

-rereadnolock Startup Option-rereadnolock Startup Option

For more details see Progress Solutions:For more details see Progress Solutions:P43776

19063

P12159

Page 49: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

49

-lkwtmo Startup Option-lkwtmo Startup Option

LLocockk WWait ait TTiimmeeooutut

Client Startup OptionClient Startup Option

Time a Client will wait for a Record Lock Time a Client will wait for a Record Lock before STOP Action occursbefore STOP Action occurs

Default is 1800 seconds (30 minutes)Default is 1800 seconds (30 minutes)

Default for WebSpeed is 10 secondsDefault for WebSpeed is 10 seconds

Minimum 60 secondsMinimum 60 seconds

A value of zero means wait forever!A value of zero means wait forever!

No screen or log (.lg) messages until V9.1D No screen or log (.lg) messages until V9.1D SP08SP08

Page 50: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

50

Monitoring LocksMonitoring Locks

PromonPromon

_Lock Virtual System Table_Lock Virtual System TableBe careful! Reading this table can cause performance problems

FOR EACH _Lock WHILE _lock-recid NE ?

Demonstrate deadly[1-2].p

__UserLock Virtual System TableUserLock Virtual System TableCan see a Maximum of 512 Concurrent Locks

Does not have the Table# like _Lock (bug!)

Page 51: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

51

The Cost of a Large TransactionThe Cost of a Large Transaction

Potential Record Lock Table OverflowPotential Record Lock Table Overflow32 bytes per –L entry (V9 and later)

Finite Limit

Page 52: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

52

The Cost of a Large TransactionThe Cost of a Large Transaction

BI File SizeBI File Size2gb maximum size prior to V9

Extents are limited to 2gb in V9/OpenEdge 10 unless the proutil EnableLargeFiles option is used

Crash Recovery will cause the BI file to grow

Why? Crash Recovery for the DB changes caused by Crash Recovery

Limit BI Size with –bitholdSet no higher than 50% of Available BI Disk Space

Page 53: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

53

The Cost of a Long TransactionThe Cost of a Long Transaction

Monitor Long Transactions with longtrx*.pMonitor Long Transactions with longtrx*.p

Page 54: Strength. Strategy. Stability. Record Locking and Transaction Scope DEV-12.

DEV-12 Transaction Scope & Record Locking

54

ConclusionConclusion

Questions?Questions?

Thank you for coming!Thank you for coming!

Please don’t forget your conference Please don’t forget your conference evaluationsevaluations


Recommended