Skip to content

RelativelyBlank/skiDBy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

skiDBy (skih-Dee-Bee)

WAL TO DO WAL NEEDS TO REDO AND UNDO! REDO BASED ON LSN AND UNDO UNCOMMITED TRANSACTIONS

  • TRANSACTION MANAGER

  • CREATE BASIC TRANSACTION MANAGER

  • CREATE GLOBAL COUNTER FOR LSN

  • HAVE BASIC LEVELS OF TRANSACTIONS, UNCOMMITTED AND COMMITTED

  • BUFFER MANAGER

  • CHANGE X_MIN AND X_MAX FOR TUPLE HEADERS TO MATCH THE TRANSACTION IDS

  • FOR UPDATES, THE ORIGINAL PLACE MAY BE CHANGED CAUSE IT AN UPDATE IS LARGER SIZE THAN THE ORIGINAL, NEEDS A NEW TUPLE PLACE IN PAGE AND MARK OLD TUPLE FOR DELETION

  • WAL IN MEMORY

  • IS A CIRCULAR ARRAY TYPE DS

  • encode before inserting here

  • WAL DISK WRITING

  • APPEND ONLY

  • TYPES OF WAL RECORDS:

    • Insert Records (e.g., XLOG_HEAP_INSERT): When a new tuple is inserted into a table, PostgreSQL writes a WAL record that details the insertion. This record includes:

      The target heap page and tuple offset. The transaction ID (XID) that performed the insertion. The new tuple’s data (or enough of a “delta” to redo the insert). Example: A new employee record is inserted; the WAL record indicates which page was modified, the new row’s data, and that transaction 1005 inserted it.

    • Update Records (e.g., XLOG_HEAP_UPDATE or XLOG_HEAP_HOT_UPDATE): For updates, PostgreSQL logs a record that describes the change to an existing tuple:

      It may include both the old version (for undo purposes) and the new version. In the case of a “HOT” (Heap Only Tuple) update, the record indicates that the change does not require a change to associated index entries. Example: An employee’s salary is increased; the WAL record shows the before and after values and the location of the tuple on the heap page.

    • Delete Records (e.g., XLOG_HEAP_DELETE): When a tuple is deleted, the corresponding WAL record logs:

      The removal action, including the page and tuple position. The transaction ID responsible for the deletion. Example: An employee record is removed; the WAL record marks that tuple as deleted so that recovery can either redo or undo the deletion as needed.

    • Begin/Commit/Abort Records: Commit Record (e.g., XLOG_COMMIT): Indicates that a transaction’s changes are now durable. Abort Record: Marks a transaction as rolled back. These records ensure that during recovery, PostgreSQL can tell which transactions completed and which did not. Example: When a transaction that updated several rows commits, a commit record with its own LSN is written to confirm the transaction’s durability.

    • Full Page Image Records: Sometimes, rather than logging only the change (delta), PostgreSQL writes a full copy of a data page to the WAL. This happens when a page is modified for the first time after a checkpoint. Purpose: This ensures that during recovery the entire page can be restored if partial writes or torn pages occur. Example: A heavily modified table page may have its entire image logged so that recovery can reapply the whole page rather than piecing together multiple small changes.

    • B-Tree and Other Index Operation Records: Index modifications are separately logged. For instance:

      XLOG_BTREE_INSERT, XLOG_BTREE_DELETE, XLOG_BTREE_UPDATE: These records log changes in B-Tree index structures (which are common in PostgreSQL). They include information on the affected index pages and the keys or pointers changed. Example: When an index entry is added to support a new row, an index insert record is written to the WAL to record the new index structure.

- RECOVERY - so in the redo undo... all transactions commited and uncommited are applied if the page LSN is less than the transactions.... then all uncommitted transactions are undone after

  • CHECKPOINTING
  • WHEN DATABASE CASES IT WILL GO THROUGH EVERY PAGE. IF THAT PAGE LSN IS LESS THAN TRANSACTION LSN THEN APPLY EVERY LSN TRANSACTION UNTIL THE COUNTER IS CORRECT
  • !!! NEED TO RELOOK AT HOW THE WAL IS CLEARED DURING HCECKPOINTING STILL DONT UNDERSTAND
  • ALL I KINDA UNDERSTAND IS THAT ITS SO THE WAL DOESNT GROW INDEFINITELY AND CAN REUSE OLD LSNS BUT I DONT UNDERSTAND HOW THE PREVIOUS RECORDS LSNS ARE REUSED (LIKE SINCE THE LSN VALUE WRAPS AROUND WHEN IT GETS TO BIG)

- Buffer Tags - Buffer Descriptors

  • Oversized tuples
  • Ring buffer for big tables

other things

  • Add custom wrror logic

TODO LATER

  • SYSTEM CATALOG FOR WHERE FILES SHOULD GO
  • BOOTLOADER
    • LOAD ALL INDEX PAGES TO MEMORY ON STARTUP
  • VACCUM AND AUTO-VACCUUM
    • ID X_MAX IS SET FOR TUPLE, REMOVE DEAD TUPLES
    • only vaccuum commited transactions, so you can clean dead tuples from uncommited
  • MORE COMPLEX TRANSACTIONS SYSTEM
    • Read Uncommitted: This is the lowest level of isolation where a transaction can see uncommitted changes made by other transactions. This can result in dirty reads, non-repeatable reads, and phantom reads.
    • Read Committed: In this isolation level, a transaction can only see changes made by other committed transactions. This eliminates dirty reads but can still result in non-repeatable reads and phantom reads.
    • Repeatable Read: This isolation level guarantees that a transaction will see the same data throughout its duration, even if other transactions commit changes to the data. However, phantom reads are still possible.
    • Serializable: This is the highest isolation level where a transaction is executed as if it were the only transaction in the system. All transactions must be executed sequentially, which ensures that there are no dirty reads, non-repeatable reads, or phantom reads.
  • POST MASTER AND OTHER POSTGRES TINGS
  • QUERY SYNTAX
  • CONNECTION POOLER
  • COMPOSITE KEYS
  • Add Maddie somehow (skibity pookie)

Supported Keywords: SELECT -> Skibidi gyatt rizz only in ohio duke dennis did you pray today livvy dunne rizzing up baby gronk sussy imposter pibby glitch in real life sigma alpha omega male grindset andrew tate goon cave freddy fazbear colleen ballinger smurf cat vs strawberry elephant blud dawg shmlawg ishowspeed a whole bunch of turbulence ambatukam bro really thinks he's carti literally hitting the griddy the ocky way kai cenat fanum tax garten of banban no edging in class not the mosquito again bussing axel in harlem whopper whopper whopper whopper 1 2 buckle my shoe goofy ahh aiden ross sin city monday left me broken quirked up white boy busting it down sexual style goated with the sauce john pork grimace shake kiki do you love me huggy wuggy nathaniel b lightskin stare biggest bird omar the referee amogus uncanny wholesome reddit chungus keanu reeves pizza tower zesty poggers kumalala savesta quandale dingle glizzy rose toy ankha zone thug shaker morbin time dj khaled sisyphus oceangate shadow wizard money gang ayo the pizza here PLUH nair butthole waxing t-pose ugandan knuckles family guy funny moments compilation with subway surfers gameplay at the bottom nickeh30 ratio uwu delulu opium bird cg5 mewing fortnite battle pass all my fellas gta 6 backrooms gigachad based cringe kino redpilled no nut november pokénut november wojak literally 1984 foot fetish F in the chat i love lean looksmaxxing gassy incredible theodore john kaczynski social credit bing chilling xbox live mrbeast kid named finger better caul saul i am a surgeon one in a krillion hit or miss i guess they never miss huh i like ya cut g ice spice we go gym kevin james josh hutcherson edit coffin of andy and leyley metal pipe falling

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages