Locks
InfoSphere® DataStage® locks control access to records and files among concurrent users. To provide this control, InfoSphere DataStage supports the following two levels of lock granularity:
- Fine granularity (record locks)
- Coarse granularity (file locks)
The level at which you acquire a lock is known as granularity. Record locks affect a smaller component (the record) and provide a fine level of granularity, whereas file locks affect a larger component (the file) and provide a coarse level of granularity.
Lock compatibility determines what your process can access when other processes have locks on records or files. Record locks allow more compatibility because they coexist with other record locks, thus allowing more transactions to take place concurrently. However, these "finer-grained" locks provide a lower isolation level. File locks enforce a higher isolation level, providing more concurrency control but less compatibility.
Lock compatibility decreases and isolation level increases as strength and granularity increase. This can increase the possibility of deadlocks at high isolation levels. Within each granularity level, the strength of the lock can vary. InfoSphere DataStage supports the following locks in order of increasing strength:
- Shared record lock
- Update record lock
- Shared file lock
- Intent file lock
- Exclusive file lock
The locks become less compatible as the granularity, strength, and number of locks increase. Therefore the number of lock conflicts increase, and fewer users can access the records and files concurrently. To maximize concurrency, you should acquire the minimum lock required to perform a BASIC statement for the shortest period of time. The lock can always be promoted to a lock of greater strength or escalated to a coarser level of granularity if needed.