{"id":15,"date":"2020-06-29T12:39:18","date_gmt":"2020-06-29T16:39:18","guid":{"rendered":"http:\/\/blogs.bu.edu\/mathan\/?p=15"},"modified":"2020-07-01T14:13:58","modified_gmt":"2020-07-01T18:13:58","slug":"lets-talk-about-deletes","status":"publish","type":"post","link":"https:\/\/blogs.bu.edu\/mathan\/2020\/06\/29\/lets-talk-about-deletes\/","title":{"rendered":"Let&#8217;s talk about deletes!"},"content":{"rendered":"<p>In the recent SIGMOD, we presented our <a href=\"https:\/\/dl.acm.org\/doi\/abs\/10.1145\/3318464.3389757\">work on a delete-aware LSM-based system<\/a> called <a href=\"https:\/\/datasystemsbu.bitbucket.io\/lethe\/\"><em>Lethe<\/em><\/a>. In this post, I would like to share a few details that could not make it to the talk along with some thoughts based on the feedback we received during the conference.<\/p>\n<p>First, this year is probably the first time that <em><strong>deletes<\/strong><\/em> were discussed as a key research challenge,\u00a0as part of database systems offering <strong>privacy through deletion. <\/strong>Specifically,\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Michael_Stonebraker\">Mike Stonebraker<\/a>\u00a0discussed it during the very interesting panel &#8220;<em>The Next 5 Years: What Opportunities Should the Database Community Seize to Maximize its Impact?<\/em>&#8220;. Along with our work on deletes for LSM-trees, this is probably the first time that <strong><em>deleting data<\/em><\/strong> becomes a first-class citizen. Up to now, we mostly worried about <strong>how to keep all the data we collected or generated. <\/strong>Today, we also have to worry about how to <strong>efficiently delete<\/strong> them if we have to (e.g., because of <a href=\"https:\/\/gdpr-info.eu\/\">GDPR<\/a>).<\/p>\n<p>When studying the delete operator of modern data stores, we realized that virtually all deletes are <strong>out-of-place<\/strong>, even in the so-called in-place systems. For example, even when deleting in a B+ Tree or a heap file (which uses slotted pages) the most common approach is to invalidate the entry via a <strong>valid bit<\/strong>\u00a0and\u00a0leave the invalid data there for future &#8220;cleaning&#8221;. To highlight this point, consider that\u00a0often practical implementations of B+ Trees in full-blown relational systems do not even perform the merge after the case of underflowing due to a delete, because they expect new inserts to grow the tree in the future. Of course, this approach is further pronounced in <strong>LSM trees<\/strong> where a delete is implemented by design via\u00a0<strong>out-of-place invalidation<\/strong>. In other words, in systems up to now, deletes are an afterthought, something that we may have to do, but we don&#8217;t really worry too much about optimizing it (notable exceptions about optimizing the latency of bulk deletes are &#8220;<a href=\"http:\/\/www.vldb.org\/conf\/2007\/papers\/industrial\/p1197-bhattacharjee.pdf\">Efficient Bulk Deletes for Multi-Dimensional Clustered Tables in DB2<\/a>&#8220;, &#8220;<a href=\"https:\/\/ieeexplore.ieee.org\/document\/914827\">Efficient bulk deletes in relational databases<\/a>&#8221; and &#8220;<a href=\"https:\/\/ieeexplore.ieee.org\/abstract\/document\/4221744?section=abstract\">Online Bulk Deletion<\/a>&#8220;, however, they still do not focus on\u00a0other aspects of deletes like privacy and space amplification).\u00a0In addition to the <strong>efficiency of deletion<\/strong>\u00a0and <strong>privacy<\/strong>, the\u00a0new ubiquitous use of the cloud for data management\u00a0poses a <strong>space management challenge<\/strong>. If one owns a disk, then invalidating data does not cause extra costs unless they have to buy new disks. On the other hand, if one rents storage from a cloud provider, keeping around invalidated data for long leads to unnecessary storage costs.<\/p>\n<p>Moving back to performing out-of-place deletes, we observe that essentially, the purging of the data (which we call <strong>persistent deletion<\/strong>) is left as a task for later which will be undertaken by a <strong>compaction<\/strong>\/<strong>garbage collection<\/strong>\/<strong>defragmentation<\/strong> process depending on the exact system used. Leaving the persistent deletion for later may lead to a significant increase of space amplification and may expose sensitive deleted data (which technically should not be accessible after their deletion) increasing the privacy risk. These risks and costs are further pronounced in LSM systems where the garbage collection process is part of the original design.<\/p>\n<p>Diving into more details about <strong>deletes on LSM-based data stores<\/strong> (LSM was originally introduced by <a href=\"https:\/\/link.springer.com\/article\/10.1007%2Fs002360050048\">ONeil in 1996<\/a>, popularized by Google&#8217;s <a href=\"https:\/\/dl.acm.org\/doi\/10.1145\/1365815.1365816\">Bigtable<\/a> and <a href=\"https:\/\/github.com\/google\/leveldb\">LevelDB<\/a>, as well as Facebook&#8217;s <a href=\"https:\/\/github.com\/facebook\/rocksdb\">RocksDB<\/a>\u00a0&#8211; a LevelDB fork, and since then is being used by a\u00a0variety of systems &#8211; a\u00a0great survey is available by <a href=\"https:\/\/link.springer.com\/article\/10.1007\/s00778-019-00555-y\">Luo and Carey<\/a>), we first realized that an LSM can receive four\u00a0different types of deletes:<\/p>\n<ul>\n<li>a point delete on the sort key\u00a0of the\u00a0LSM tree, which we call a <strong><em>primary point delete<\/em><\/strong><\/li>\n<li>a range delete on the sort key, or a <strong><em>primary range delete<\/em><\/strong><\/li>\n<li>a point delete on another attribute which is part of the value (or sometimes the whole value), which we call a <strong><em>secondary point delete<\/em><\/strong><\/li>\n<li>a range delete on this other secondary attribute, or a <em><strong>secondary range delete<\/strong><\/em><\/li>\n<\/ul>\n<p>When a workload has a non-negligible amount of deletes, the room for improvement is actually rather large. Note that any out-of-place system is already performing the (logical) delete very quickly simply by inserting an invalidating entry (also called a <strong>tombstone<\/strong>), as also discussed at a\u00a0<a href=\"http:\/\/smalldatum.blogspot.com\/2020\/01\/deletes-are-fast-and-slow-in-lsm.html\">recent post from Mark Callaghan<\/a>, which also raised some important questions about LSM read performance in the presence of tombstones. So, our focus for our work on Lethe is on the following challenges:<\/p>\n<ul>\n<li>what is the <strong>cost<\/strong> in terms of <strong>latency<\/strong> or <strong>write amplification<\/strong> of <strong>persisting<\/strong> a <strong>logical primary delete<\/strong>? how can we minimize that?<\/li>\n<li>what is the benefit in terms of <strong>space amplification<\/strong> if we persist the primary deletes faster?<\/li>\n<li>how we should <strong>physically organize the data<\/strong> in the presence of <strong>secondary<\/strong> <strong>range<\/strong> <strong>deletes<\/strong>?<\/li>\n<li>can we <strong>guarantee persistent primary or secondary deletion in a given deadline<\/strong>?<\/li>\n<li>how is <strong>read performance<\/strong> impacted by addressing these challenges?<\/li>\n<\/ul>\n<p>The above questions are discussed in Lethe, however, there are several open challenges. We are now considering some additional challenges, including:<\/p>\n<ul>\n<li><strong>Secondary point deletes<\/strong> in LSM trees. This seems\u00a0to be a much harder problem as unless we have a secondary index, there not seems to be a way to avoid reading the whole tree.<\/li>\n<li><strong>Read queries<\/strong> at the presence of <strong>primary range deletes.\u00a0<\/strong>After looking at the internals of systems like <a href=\"https:\/\/github.com\/facebook\/rocksdb\">RocksDB<\/a>, we see that range tombstones are significantly impacting the read path of an LSM tree leading to (potentially) avoidable I\/Os from the storage simply to verify that an entry has been deleted.<\/li>\n<\/ul>\n<p>Stay tuned for more work on efficient and persistent deletion!<\/p>\n<p>=======<\/p>\n<p>Edit: added a reference to a <a href=\"http:\/\/smalldatum.blogspot.com\/2020\/01\/deletes-are-fast-and-slow-in-lsm.html\">particularly interesting recent blog post<\/a> from <a href=\"https:\/\/www.linkedin.com\/in\/mdcallag\/\">Mark Callaghan<\/a>&#8216;s <a href=\"http:\/\/smalldatum.blogspot.com\/\">blog<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the recent SIGMOD, we presented our work on a delete-aware LSM-based system called Lethe. In this post, I would like to share a few details that could not make it to the talk along with some thoughts based on the feedback we received during the conference. First, this year is probably the first time &hellip; <a href=\"https:\/\/blogs.bu.edu\/mathan\/2020\/06\/29\/lets-talk-about-deletes\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Let&#8217;s talk about deletes!&#8221;<\/span><\/a><\/p>\n","protected":false},"author":7356,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.bu.edu\/mathan\/wp-json\/wp\/v2\/posts\/15"}],"collection":[{"href":"https:\/\/blogs.bu.edu\/mathan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.bu.edu\/mathan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.bu.edu\/mathan\/wp-json\/wp\/v2\/users\/7356"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.bu.edu\/mathan\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":3,"href":"https:\/\/blogs.bu.edu\/mathan\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"predecessor-version":[{"id":18,"href":"https:\/\/blogs.bu.edu\/mathan\/wp-json\/wp\/v2\/posts\/15\/revisions\/18"}],"wp:attachment":[{"href":"https:\/\/blogs.bu.edu\/mathan\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.bu.edu\/mathan\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.bu.edu\/mathan\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}