forked from docs/doc-exports
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com> Co-authored-by: zhangyue <zhangyue164@huawei.com> Co-committed-by: zhangyue <zhangyue164@huawei.com>
24 lines
6.7 KiB
HTML
24 lines
6.7 KiB
HTML
<a name="obs_03_100528"></a><a name="obs_03_100528"></a>
|
|
|
|
<h1 class="topictitle1">What Is the Best Practice to Delete Objects and Deal with Versioning?</h1>
|
|
<div id="body0000002009998557"><p id="obs_03_100528__p1647414115368">In OBS, buckets are containers, with their names acting as globally unique identifiers, so two buckets in the OTC can't share the same name. The objects stored in these buckets however are identified by their unique IDs, which allows overloading objects with newer versions, under the same name, if versioning has been enabled for the bucket. (For more information, see <a href="en-us_topic_0045853849.html">Versioning</a> and <a href="obs_faq_0800.html">How Do I Use Versioning?</a>)</p>
|
|
<p id="obs_03_100528__p3475114153618">There is no limit to the number of versions, however from experiences of running versioning in a productive environment we found that listing versioned objects can easily run into difficulties. To avoid performance issues we don't recommend to list all objects in buckets with versioning either enabled or suspended. As the OTC console depends on listing all objects as well, it is also highly recommended not to rely on it in managing versioned objects.</p>
|
|
<p id="obs_03_100528__p13475154113362">Some tools like OBS Browser currently also can't handle versioned objects and will only list and manipulate the current version of the object.</p>
|
|
<p id="obs_03_100528__p17475341153616">Right now the recommended method for managing versioned objects is using an SDK or API directly (for more information see <a href="https://docs.otc.t-systems.com/object-storage-service/api-ref/apis/operations_on_buckets/listing_objects_in_a_bucket.html#request-syntax-for-multi-version-objects" target="_blank" rel="noopener noreferrer">Request Syntax for Multi-Version Objects in the Listing Objects API</a> and <a href="https://docs.otc.t-systems.com/object-storage-service/api-ref/apis/operations_on_objects/downloading_an_object.html#obs-04-0083" target="_blank" rel="noopener noreferrer">Versioning for the Downloading an Object API</a>).</p>
|
|
<div class="section" id="obs_03_100528__section13449048143616"><h4 class="sectiontitle">Typical Use Cases</h4><p id="obs_03_100528__p225283273718">A typical use case is recovering the latest historical version of an object by deleting the delete marker version. This operation is recommended to be performed either through API or SDK. This is a single operation based on the specific object ID. For more information see <a href="https://docs.otc.t-systems.com/object-storage-service/api-ref/apis/operations_on_objects/deleting_an_object.html#versioning" target="_blank" rel="noopener noreferrer">Versioning for the Deleting an Object API</a>.</p>
|
|
<p id="obs_03_100528__p2253103217371">Another typical use case is deleting all versions of objects with a specific name (or even all objects from a bucket to delete the bucket). This operation however would need to be performed on multiple objects and thus can again run into difficulties based on the number of objects. It is recommended in this case to limit the batches of objects the operation runs on at the time and also the number of concurrency. For more information see <a href="https://docs.otc.t-systems.com/object-storage-service/api-ref/apis/operations_on_objects/deleting_objects.html" target="_blank" rel="noopener noreferrer">Deleting Objects</a>.</p>
|
|
</div>
|
|
<div class="section" id="obs_03_100528__section1272313378376"><h4 class="sectiontitle">Configuring Lifecycle Rule for Mass Deleting Objects</h4><p id="obs_03_100528__p1743817813389">The best practice for mass deleting objects (regardless of versioning) is using a lifecycle rule.</p>
|
|
<p id="obs_03_100528__p243811893819">To conveniently delete a large number of objects, you can configure a lifecycle rule (see <a href="obs_03_0335.html">Configuring a Lifecycle Rule</a>) that will remove these objects after the specified number of days - the rule will be applied either to some of the objects based on a prefix or to all objects in the bucket. In order to configure such rule:</p>
|
|
<ol id="obs_03_100528__ol7940174516387"><li id="obs_03_100528__li3940345203817"><span>In the bucket list, click the bucket you want to operate. The <strong id="obs_03_100528__b152606321568">Overview</strong> page of the bucket is displayed.</span></li><li id="obs_03_100528__li15296651123811"><span>In the <strong id="obs_03_100528__b1150118105713">Basic Configurations</strong> area, click <strong id="obs_03_100528__b1031101211570">Lifecycle Rules</strong>. The <strong id="obs_03_100528__b6146020115714">Lifecycle Rules</strong> page is displayed.</span></li><li id="obs_03_100528__li1689275873818"><span>Click <strong id="obs_03_100528__b15864112810571">Create</strong>. The <strong id="obs_03_100528__b0161134018574">Create Lifecycle Rule</strong> window is displayed.</span></li><li id="obs_03_100528__li663211614396"><span>In the <strong id="obs_03_100528__b095116035817">Basic Information</strong> section:</span><p><ul id="obs_03_100528__ul16973265394"><li id="obs_03_100528__li1165403514386">Specify <strong id="obs_03_100528__b979420308584">Rule Name</strong>.</li><li id="obs_03_100528__li16654193553812">Specify <strong id="obs_03_100528__b1126795175810">Prefix</strong> if necessary (for example if you want to only delete files from some specific folder called <strong id="obs_03_100528__b1846252592">folder_name</strong>, you can specify <strong id="obs_03_100528__b10451410185916">folder_name/</strong> as a prefix).</li><li id="obs_03_100528__li19697112663916">If you want to delete all files from the bucket, select <strong id="obs_03_100528__b6746164015591">Bucket</strong> in the <strong id="obs_03_100528__b10121144195919">Applies To</strong> switch.</li></ul>
|
|
</p></li><li id="obs_03_100528__li11662161319393"><span>In the <strong id="obs_03_100528__b10285105312590">Current Version</strong> (for the current version of the multi-version object) and <strong id="obs_03_100528__b19949231006">Historical Version</strong> (for all other versions of the object) sections:</span><p><ul id="obs_03_100528__ul8427174453917"><li id="obs_03_100528__li1265423543817">Select <strong id="obs_03_100528__b641611135020">Configure now</strong> in the <strong id="obs_03_100528__b1950141614013">Expiration Time</strong> switch.</li><li id="obs_03_100528__li1042734415398">Enter the number of days after which a file should be removed in the <strong id="obs_03_100528__b1912510404018">Delete After</strong> edit field (minimum value: <strong id="obs_03_100528__b783294914014">1</strong> day).</li></ul>
|
|
</p></li><li id="obs_03_100528__li429163710398"><span>Click <strong id="obs_03_100528__b06561091312">OK</strong>.</span></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_faq_1200.html">Buckets and Objects</a></div>
|
|
</div>
|
|
</div>
|
|
|