TheHingineer

  • DBMS


  • DBMS Part-1

  • DBMS Part-2

  • DBMS Part-3

  • DBMS Part-4

  • DBMS Part-5

  •  Checkpoint in DBMS 


     Checkpoint kya hota hai DBMS me?

    Checkpoint ka matlab hota hai – ek aisa point jahan tak system ka data safe hai, aur agar system crash ho jaaye, toh uss point se recovery shuru ho sakti hai.

    Jaise aap game khel rahe ho aur ek checkpoint par game save hoti hai, toh agar game crash ho gaya toh aapko poora game shuru se nahi khelna padta — balki checkpoint se shuru kar sakte ho.

    DBMS me bhi same concept hota hai:

    Checkpoint ek aisa process hai jisme DBMS apne current data ko disk pe save karta hai, taaki agar system crash ho jaye toh us point se jaldi aur sahi recovery ho sake.


     Checkpoint ki zarurat kyun hoti hai?

    Maan lo system me kai transactions chal rahe hain (T1, T2, T3…).

    Achanak power chali gayi ya system crash ho gaya 

    Agar checkpoint nahi hota:

    • DBMS ko poora transaction log shuru se dekhna padega

    • Har ek transaction check karni padegi

    • Time aur resources zyada lagenge

    Agar checkpoint hota hai:

    • DBMS directly us safe point se recovery start kar sakta hai

    • Sirf unhi transactions ko check karega jo uske baad aaye the

    • Recovery fast aur efficient hoti hai 

     Checkpoint kaise kaam karta hai?

    Checkpoint ke waqt DBMS yeh kaam karta hai:

    1. Memory me jo data change hua hai (dirty pages), use disk pe write karta hai

    2. Ek checkpoint record log file me likhta hai — jisme batata hai kaunse transactions us waqt active hain

     Example samajhte hain

    Maan lo 5 transactions chal rahe hain: T1, T2, T3, T4, T5

    1. T1 aur T2 complete ho chuke hain

    2. T3 aur T4 abhi chal rahe hain

    3. System ne yahan par ek checkpoint le liya

     Checkpoint record likha: “Checkpoint taken. Active Transactions: T3, T4”

    Agar uske baad system crash ho gaya:

    • T1, T2 ko ignore kar sakte hain (kyunki already committed hain)

    • Sirf T3, T4 ko check karna hai — complete huye ya nahi

    • Jaldi recovery possible hai! 

     Checkpoint Types

    1. Coordinated Checkpointing

    • Sabhi processes ek saath checkpoint lete hain

    • Simple but thoda system pause hota hai

    2. Uncoordinated Checkpointing

    • Har process apne hisaab se checkpoint leti hai

    • Fast, but recovery complicated ho sakti hai

     Checkpoint ke baad kya hota hai recovery me?

    Maan lo log file me likha hai:

    START T1
    WRITE T1 X = 10
    COMMIT T1
    START T2
    WRITE T2 Y = 20
    CHECKPOINT (T2 active)
    WRITE T2 Z = 30
    COMMIT T2
    CRASH

    Recovery:

    • DBMS dekh ke bolega: “Oh! Checkpoint ke baad T2 active tha”

    • T2 ko REDO karega agar committed hai

    • T1 ko chhodega kyunki woh pehle se safe hai


     Checkpoint ke Advantages

    Advantage Detail
     Fast Recovery Crash ke baad jaldi recovery hoti hai
     Kam Overhead Pura log scan nahi karna padta
     Disk use kam Sirf zarurat ke data ko hi use karta hai
     Reliable System regularly safe state me rehta hai

     Checkpoint ke Disadvantages

    Disadvantage Detail
     Thoda Pause Kabhi-kabhi system ko thodi der ke liye stop karna padta hai
     Complex Proper implementation chahiye

     Kab Checkpoint Liya Jata Hai?

    • Har kuch minute me (jaise 5 min)

    • Jab log file kaafi badi ho jaye

    • Jab system shutdown ho raha ho

    • Jab memory buffer full ho jaye


     Conclusion (Summary)

    • -> Checkpoint ek “save game” jaisa concept hai DBMS me

    • -> Recovery process me time bachaata hai

    • -> Ye ensure karta hai ki system ek consistent state me rahe

    • -> Modern DBMS systems regular interval par checkpoints lete hain

    Scroll to Top