<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[EngHighlights Newsletter]]></title><description><![CDATA[Delivers deep software engineering insights to your inbox, focusing on key takeaways and in-depth analyses from leading papers, blogs and books.]]></description><link>https://www.enghighlights.com</link><image><url>https://substackcdn.com/image/fetch/$s_!OAuL!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfec940-2fa5-4363-ae27-df97d88ca999_1024x1024.png</url><title>EngHighlights Newsletter</title><link>https://www.enghighlights.com</link></image><generator>Substack</generator><lastBuildDate>Wed, 06 May 2026 12:02:04 GMT</lastBuildDate><atom:link href="https://www.enghighlights.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Ruslan Diachenko]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[rdiachenko@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[rdiachenko@substack.com]]></itunes:email><itunes:name><![CDATA[Ruslan Diachenko]]></itunes:name></itunes:owner><itunes:author><![CDATA[Ruslan Diachenko]]></itunes:author><googleplay:owner><![CDATA[rdiachenko@substack.com]]></googleplay:owner><googleplay:email><![CDATA[rdiachenko@substack.com]]></googleplay:email><googleplay:author><![CDATA[Ruslan Diachenko]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Ensuring Data Consistency with fsync in Replicated Systems]]></title><description><![CDATA[Key Takeaways]]></description><link>https://www.enghighlights.com/p/ensuring-data-consistency-with-fsync</link><guid isPermaLink="false">https://www.enghighlights.com/p/ensuring-data-consistency-with-fsync</guid><dc:creator><![CDATA[Ruslan Diachenko]]></dc:creator><pubDate>Mon, 19 Feb 2024 08:10:28 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!XPAh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8145cff5-ced3-4686-918e-51f5ceec3b65.heic" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Key Takeaways</h2><ul><li><p><code>fsync</code> ensures data is actually saved to disk, reducing data loss from power outages or crashes.</p></li><li><p>Replication alone cannot guarantee data consistency without <code>fsync</code>, even in non-Byzantine protocols like Raft.</p></li><li><p>Byzantine fault tolerance (BFT) protocols handle more faults but are too complex and resource-heavy for many uses.</p></li><li><p><code>fsync</code> forces disk writes to complete before moving on, which can significantly slow down data write operations, impacting the overall throughput of the system.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XPAh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8145cff5-ced3-4686-918e-51f5ceec3b65.heic" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XPAh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8145cff5-ced3-4686-918e-51f5ceec3b65.heic 424w, https://substackcdn.com/image/fetch/$s_!XPAh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8145cff5-ced3-4686-918e-51f5ceec3b65.heic 848w, https://substackcdn.com/image/fetch/$s_!XPAh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8145cff5-ced3-4686-918e-51f5ceec3b65.heic 1272w, https://substackcdn.com/image/fetch/$s_!XPAh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8145cff5-ced3-4686-918e-51f5ceec3b65.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XPAh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8145cff5-ced3-4686-918e-51f5ceec3b65.heic" width="1456" height="832" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8145cff5-ced3-4686-918e-51f5ceec3b65.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:832,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:393596,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XPAh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8145cff5-ced3-4686-918e-51f5ceec3b65.heic 424w, https://substackcdn.com/image/fetch/$s_!XPAh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8145cff5-ced3-4686-918e-51f5ceec3b65.heic 848w, https://substackcdn.com/image/fetch/$s_!XPAh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8145cff5-ced3-4686-918e-51f5ceec3b65.heic 1272w, https://substackcdn.com/image/fetch/$s_!XPAh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8145cff5-ced3-4686-918e-51f5ceec3b65.heic 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Deep Dive Summary</h2><p><code>fsync</code> is a system call that ensures all modified data of a file is safely written to the storage device, providing a guarantee of data durability and consistency. Replication involves duplicating data across systems to enhance availability, improve reliability, and support fault tolerance.</p><p>Replication alone doesn't fully protect against data loss in non-Byzantine systems, which expect failures to be predictable and recoverable. Unexpected issues like power outages can cause unsynced data loss, risking global inconsistencies.</p><p>On the other hand, Byzantine fault tolerance (BFT) protocols offer more comprehensive protection against a broad range of failures, but their complexity, immaturity and resource demands limit their practical use in many real applications.</p><p>The primary trade-off with <code>fsync</code> in systems like those using the Raft protocol is between ensuring data consistency and managing performance impact. <code>fsync</code> reduces data loss risks at the expense of slower system performance. Balancing this trade-off requires a tailored approach, considering the application's specific requirements and tolerance for risk.</p><h2><strong>Expert Q&amp;A</strong></h2><p><strong>Q:</strong> Why is <code>fsync</code> important in replicated systems, and can replication alone prevent data loss?</p><p><strong>A:</strong> <code>fsync</code> is essential because it ensures data is physically written to disk, mitigating the risk of data loss during unexpected failures. Replication alone cannot prevent data loss if it involves unsynced data, as this can lead to inconsistencies across nodes, undermining the entire system's integrity. The necessity of <code>fsync</code> highlights the importance of both replication and disk synchronization in achieving a resilient, consistent data storage solution. However, it's important to consider the trade-offs: do you really need it?</p><h2><strong>Further Exploration</strong></h2><p><a href="https://redpanda.com/blog/why-fsync-is-needed-for-data-safety-in-kafka-or-non-byzantine-protocols">Why fsync(): Losing unsynced data on a single node leads to global data loss</a>: Emphasizes the necessity of <code>fsync</code> for ensuring data durability in Kafka, clarifying the misconception that replication suffices to prevent data loss, by explaining how unsynced data on even a single node can result in global data loss.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.enghighlights.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">EngHighlights Newsletter is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Disk Space Reclamation in PostgreSQL: DELETE vs TRUNCATE]]></title><description><![CDATA[Key Takeaways on how DELETE and TRUNCATE operations impact PostgreSQL disk space, highlighting the crucial VACUUM FULL for effective space management. A must-read for optimizing database efficiency..]]></description><link>https://www.enghighlights.com/p/understanding-disk-space-reclamation</link><guid isPermaLink="false">https://www.enghighlights.com/p/understanding-disk-space-reclamation</guid><dc:creator><![CDATA[Ruslan Diachenko]]></dc:creator><pubDate>Wed, 14 Feb 2024 23:12:46 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed35dbac-64ce-471f-b3b8-87cd65c44d27.heic" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><strong>Key Takeaways</strong></h2><ul><li><p><code>TRUNCATE</code> immediately reclaims physical disk space, whereas <code>DELETE</code> does not free up physical space without a <code>VACUUM FULL</code> operation.</p></li><li><p><code>DELETE</code> is preferable for tables with frequent queries, as it allows ongoing transactions access to rows marked for deletion.</p></li><li><p><code>VACUUM FULL</code> is necessary after <code>DELETE</code> to actually free up space, but it requires exclusive access and temporarily uses additional disk space.</p></li><li><p>For large tables where data is periodically purged, <code>TRUNCATE</code> is more efficient and simpler than <code>DELETE</code> + <code>VACUUM FULL</code>.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!d3YL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed35dbac-64ce-471f-b3b8-87cd65c44d27.heic" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!d3YL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed35dbac-64ce-471f-b3b8-87cd65c44d27.heic 424w, https://substackcdn.com/image/fetch/$s_!d3YL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed35dbac-64ce-471f-b3b8-87cd65c44d27.heic 848w, https://substackcdn.com/image/fetch/$s_!d3YL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed35dbac-64ce-471f-b3b8-87cd65c44d27.heic 1272w, https://substackcdn.com/image/fetch/$s_!d3YL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed35dbac-64ce-471f-b3b8-87cd65c44d27.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!d3YL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed35dbac-64ce-471f-b3b8-87cd65c44d27.heic" width="1456" height="832" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ed35dbac-64ce-471f-b3b8-87cd65c44d27.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:832,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:732768,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!d3YL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed35dbac-64ce-471f-b3b8-87cd65c44d27.heic 424w, https://substackcdn.com/image/fetch/$s_!d3YL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed35dbac-64ce-471f-b3b8-87cd65c44d27.heic 848w, https://substackcdn.com/image/fetch/$s_!d3YL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed35dbac-64ce-471f-b3b8-87cd65c44d27.heic 1272w, https://substackcdn.com/image/fetch/$s_!d3YL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed35dbac-64ce-471f-b3b8-87cd65c44d27.heic 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2><strong>Deep Dive Summary</strong></h2><p>PostgreSQL manages disk space through MVCC, allowing multiple versions of a data item to coexist for concurrency and recovery. However, this approach complicates physical space reclamation after data deletion. The <code>DELETE</code> operation marks rows for deletion but doesn't immediately free up space, maintaining accessibility for other transactions. To reclaim space, a <code>VACUUM FULL</code> command must be executed, which rewrites the table to disk without the deleted rows, temporarily requiring additional disk space equal to the table size.</p><p>Contrastingly, <code>TRUNCATE</code> bypasses the row-level deletion process, resetting the table to its initial state and instantly freeing up disk space. This operation is particularly useful for large tables where complete data removal is intended, offering a quick and straightforward way to recover space without the overhead of <code>VACUUM FULL</code>.</p><h2><strong>Expert Q&amp;A</strong></h2><p><strong>Q:</strong> Why doesn't PostgreSQL immediately reclaim disk space after a <code>DELETE</code> operation?</p><p><strong>A:</strong> PostgreSQL relies on MVCC for data consistency and recovery, allowing transactions to see data as it was at the start of the transaction. Immediate space reclamation after <code>DELETE</code> could interfere with this visibility. <code>VACUUM FULL</code> is required to clean up and reclaim space, ensuring that the database maintains consistent views for all transactions.</p><h2><strong>Further Exploration</strong></h2><p><a href="https://www.rdiachenko.com/posts/databases/postgresql/postgresql-does-not-free-up-physical-space-after-delete/">PostgreSQL Does Not Free Up Physical Space After DELETE</a>: A detailed examination of PostgreSQL's data deletion mechanics, focusing on how <code>DELETE</code> and <code>TRUNCATE</code> differ in their impact on disk space reclamation and the vital role of <code>VACUUM FULL</code>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.enghighlights.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">EngHighlights Newsletter is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item></channel></rss>