<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal"><p dir="auto">You cannot partially upload objects to Swift. You must upload the full object each time, and Swift treats the objects as discrete entities. In your example, the entirety of objectB will be written to disk and the bytes used by objectA will be freed.</p>
<p dir="auto">--John</p>
<br><br><br><p dir="auto">On 19 Jul 2017, at 10:25, Sai Vishwas wrote:</p>
</div>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><div id="C10762ED-CD5A-4CEB-8F21-CD24E09649D1"><div dir="ltr">Dear Sir , <div>   Thanks a lot for your immediate response. I would like to make the question more clear. We are actually interested in learning the internal working of swift. Let us say I upload an objectA to my cluster under the name BestObject . So i now have BestObject in my cluster. Now I have modified a few bytes of objectA (not all bytes) and name that object locally as ObjectB. So now when i upload ObjectB to my cluster under the same name of BestObject, on swift while objectB is replacing objectA, will all the bytes of BestObject (on swift) be rewritten or only the ones changed. Or is it something like objectB is written in a new free disk space and the memory occupied by old objectA is freed.</div><div>   It would be of great help if you could explain the internal working of swift with respect to this scenario. </div><div><br></div><div>Thank you.</div><div>Regards,</div><div>Sai Vishwas</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 19, 2017 at 10:19 PM, John Dickinson <span dir="ltr"><<a href="mailto:me@not.mn" target="_blank">me@not.mn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>




<div>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">It depends on what you mean by "update", so let me describe the two things it could mean.</p>

<p dir="auto">Suppose you upload cat.jpg to your cluster:</p>

<p dir="auto"><code style="background-color:#f7f7f7;border-radius:3px;margin:0;padding:0 0.4em" bgcolor="#F7F7F7">curl -i -H "x-auth-token: foobar" <a href="https://awesome.swift.cluster.foobar/v1/AUTH_me/cats/bestcat.jpg" target="_blank">https://awesome.swift.cluster.<wbr>foobar/v1/AUTH_me/cats/<wbr>bestcat.jpg</a> -T cat1.jpg -XPUT</code></p>

<p dir="auto">Now you've got bestcat.jpg in your cluster.</p>

<p dir="auto">But, oh no! You forgot to add your metadata to the picture. Let's do that:</p>

<p dir="auto"><code style="background-color:#f7f7f7;border-radius:3px;margin:0;padding:0 0.4em" bgcolor="#F7F7F7">curl -i -H "x-auth-token: foobar" <a href="https://awesome.swift.cluster.foobar/v1/AUTH_me/cats/bestcat.jpg" target="_blank">https://awesome.swift.cluster.<wbr>foobar/v1/AUTH_me/cats/<wbr>bestcat.jpg</a> -XPOST -H "x-object-meta-name: mr snugglz" -H "x-object-meta-breed: tabby"</code></p>

<p dir="auto">In this case, the Swift cluster has updated the metadata, but the data itself hasn't changed or moved.[1] This operation is fast and lightweight. Note, however, that when you POST to an object, you must give the whole set of x-object-meta-* keys and values. The metadata sent to an object on POST replaces the current set.</p>

<p dir="auto">Oh no! We mis-spelled the cat's name! Let's fix it:</p>

<p dir="auto"><code style="background-color:#f7f7f7;border-radius:3px;margin:0;padding:0 0.4em" bgcolor="#F7F7F7">curl -i -H "x-auth-token: foobar" <a href="https://awesome.swift.cluster.foobar/v1/AUTH_me/cats/bestcat.jpg" target="_blank">https://awesome.swift.cluster.<wbr>foobar/v1/AUTH_me/cats/<wbr>bestcat.jpg</a> -XPOST -H "x-object-meta-name: mr snuggles" -H "x-object-meta-breed: tabby"</code></p>

<p dir="auto">Tragedy strikes again! Mr Snuggles ran into the road and was hit by a car. Tragic, yes, but you have overcome this trial and adopted a new cat from the local rescue shelter. The new cat, Ms Sunshine, is better in every possible way. We certainly can't still have a "bestcat.jpg" object that is an old pic of Mr Sunggles!</p>

<p dir="auto"><code style="background-color:#f7f7f7;border-radius:3px;margin:0;padding:0 0.4em" bgcolor="#F7F7F7">curl -i -H "x-auth-token: foobar" <a href="https://awesome.swift.cluster.foobar/v1/AUTH_me/cats/bestcat.jpg" target="_blank">https://awesome.swift.cluster.<wbr>foobar/v1/AUTH_me/cats/<wbr>bestcat.jpg</a> -T cat2.jpg -H "x-object-meta-name: ms sunshine" -H "x-object-meta-birthday: July 12, 2017" -XPUT</code></p>

<p dir="auto">Now Swift as written the data of cat2.jpg and replaced the previous content that was there, along with the new metadata we set in the PUT request.</p>

<p dir="auto">Swift is a durable storage system which means that it stores multiple copies of the data in different places. If one of those locations was offline when you did the overwrite and then came back online (e.g. a server restarting), Swift will reconcile the data asynchronously in the background. From the perspective of you the API user (or any client), bestcat.jpg has the most up to data contents and the most recent metadata.</p>

<p dir="auto">[1] Assuming Swift 2.13.0 with default settings or Swift 2.7.0 or later with object_post_as_copy set to False.</p>

<p dir="auto">Hope that helps</p>

<p dir="auto">--John</p><div><div class="h5">

<p dir="auto">On 19 Jul 2017, at 9:15, Sameer Kulkarni wrote:</p>

<p dir="auto"></p></div></div></div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777;color:#777;margin:0 0 5px;padding-left:5px"><p dir="auto"></p><div><div class="h5">Hi All,<br>
<br>
How does update operation work in Swift?<br>
<br>
Like, does it deletes the older object and creates new entry or It finds<br>
out which part of object is modified and just copies or pushes the modified<br>
object?<br>
<br>
<br>
Thank you<br></div></div>
______________________________<wbr>_________________<br>
Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" style="color:#777" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack</a><br>
Post to     : <a href="mailto:openstack@lists.openstack.org" target="_blank">openstack@lists.openstack.org</a><br>
Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" style="color:#777" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack</a><p></p>
</blockquote></div>
<div style="white-space:normal">
</div>
</div>
</div>

</blockquote></div><br></div></div></blockquote>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
</blockquote></div>
</div>
</body>
</html>