Help Center > Object Storage Service > API Reference > AWS S3 Compatibility > Consistency of Concurrent Operations

Consistency of Concurrent Operations

If there is a successful response to a write or deletion request sent by a client, the client can obtain the latest data. If a write operation times out, or the server returns HTTP response error code 500 or 503, the follow-up read operations may fail. If such an error occurs, query whether the data has been successfully uploaded to the server. If not, upload the data again.

If multiple clients simultaneously upload, query, or delete the same object or bucket, these operations may reach the system at different times and have different latency periods. The results that return may also be different than those expected. For example, if multiple clients simultaneously upload the same object, a later upload request will replace the prior one. If you want to prevent an object from being simultaneously accessed, you must add a lock mechanism for the object in upper-layer applications.

Example of Concurrent Operations

1. When client 2 is uploading object v1, client 1 uploads object v2 with the same name. After the object data is successfully uploaded, both client 1 and client 2 can access the latest object v2, as shown in Figure 1.

Figure 1 Concurrent upload of the same object

2. When client 2 is uploading an object v1 and object metadata is not written yet, client 1 deletes an object with the same name. In this scenario, the upload operation of client 2 is still successful, and both client 1 and client 2 can access data object v1, as shown in Figure 2.

Figure 2 Concurrent upload and deletion of the same object (1)

3. When client 2 has successfully uploaded an object v1 and object metadata is still being written, client 1 deletes an object with the same name. In this scenario, the upload operation of client 2 is still successful. However, when client 1 and client 2 attempt to download Object1, they may be able to access data object v1, or an error may be returned indicating that the object does not exist, as shown in Figure 3.

Figure 3 Concurrent upload and deletion of the same object (2)

4. When client 1 is downloading an object, client 2 deletes an object with the same name. Client 1 may download complete object data, or may download only part of the data. After a deletion success message is returned to client 2, an attempt to download the object will fail, and an error will be returned indicating that the object does not exist, as shown in Figure 4.

Figure 4 Concurrent download and deletion of the same object

5. When client 1 is downloading an object, client 2 updates an object with the same name. Client 1 may download complete object data, or may download only part of the data. After an update success message is returned to client 2, an attempt to download the object will succeed, and the latest data will be returned, as shown in Figure 5.

Figure 5 Concurrent download and update of the same object

6. When client 2 is uploading part v1 of an object, client 1 is uploading part v2 of the same object. After part v2 is uploaded successfully, both client 1 and client 2 can list the information about the multipart whose entity tag (ETag) is part v2, as shown in Figure 6.

Figure 6 Concurrently uploading the same part of the same object

7. If a client uploads an object and a timeout occurs or error code 500 or 503 is returned, one of the following symptoms may occur in follow-up object downloading and listing operations:

  • If the object fails to be uploaded, the object cannot be downloaded and is not in the object list.
  • If the object upload operation times out, there is an extremely low possibility that the head operation on the object is normal, but the 500 error code is reported for an attempt to download this object. In this case, please upload the object again.
  • If the object is newly created, it is not in the object list but can be downloaded using its name.
  • If the object is overwritten, its listed information, such as the size, ETag, creation time, and owner, is inconsistent with that obtained when you download it.

8. If client 1 uploads object v1 and client 2 uploads object v2 with the same name concurrently, and status code 200 is returned, one of the following symptoms may occur in follow-up object downloading and listing operations:

  • Object v1 is downloaded and listed.
  • Object v2 is downloaded and listed.
  • Object v1 is downloaded while object v2 is displayed in the object list.
  • Object v2 is downloaded while object v1 is displayed in the object list.

9. If multiple clients use the same username to concurrently create or delete the same bucket, there is a low possibility that these operations conflict with each other. Therefore, the requests fail and error code 500 is returned.

Registration