All Products
Search
Document Center

Object Storage Service:0014-00000082

Last Updated:Jul 21, 2023

Problem description

The request body XML of the PutBucketLifecycle request contains multiple rules. The rules contain overlapping prefixes and point to conflicting lifecycle rules.

Causes

You submit a PutBucketLifecycle request. The request body XML contains multiple rules. The rules contain overlapping prefixes and point to conflicting lifecycle rules. Take note of the following items before you configure lifecycle rules:

  • When you configure lifecycle rules, you can configure conversion to IA and Archive for an object at the same time. The time for conversion to Archive must be later than the time for conversion to IA.

  • The time when an object is expired must be later than the time when the object is converted to IA or Archive.

If the configured rule does not meet the preceding requirements, a request error is reported.

Examples

In the following reques, three rules are configured:

  • The first rule contains the test prefix and specifies that the objects that match the prefix convert to the storage class of IA 120 days after the objects are last modified.

  • The second rule contains the test/log prefix and specifies that the objects that match the prefix are converted to the storage class of Archive 60 days after the objects are last modified.

  • The third rule contains the test/log/cache prefix and specifies that the objects that match the prefix are deleted 30 days after the objects are last modified.

The preceding rules contain overlapping prefixes. The rules separately specify that the objects are converted to IA 120 days after the objects are last modified, are converted to Archive 60 days after the objects are last modified, and are deleted 30 days after the objects are last modified. As a result, a request error is reported.

PUT /?lifecycle HTTP/1.1
Host: oss-example.oss.aliyuncs.com
Content-Length: 336
Date: Mon , 6 May 2019 15:23:20 GMT
Authorization: OSSWnjl3fg9fdv8fg4b****:Phuu8bBhS8dsff2a****
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration>
  <Rule>
    <ID>rule1</ID>
    <Prefix>test</Prefix>
    <Status>Enabled</Status>
    <Transition>
    	<Days>120</Days>
      <StorageClass>IA</StorageClass>
    </Transition>
  </Rule>
  <Rule>
    <ID>rule2</ID>
    <Prefix>test/log</Prefix>
    <Status>Enabled</Status>
    <Transition>
    	<Days>60</Days>
      <StorageClass>Archive</StorageClass>
    </Transition>
    <Rule>
    <ID>rule3</ID>
    <Prefix>test/log/cache</Prefix>
    <Status>Enabled</Status>
    <Expiration>
    	<Days>30</Days>
    </Expiration>
  </Rule>
</LifecycleConfiguration>

Solutions

  • If different rules contain overlapping prefixes, make sure that you set reasonable time for storage class conversion and deletion on expiration.

    PUT /?lifecycle HTTP/1.1
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    Content-Length: 336
    Date: Mon , 6 May 2019 15:23:20 GMT
    Authorization: OSS Wnjl3fg9fdv8fg4b****:Phuu8bBhS8dsff2a****
    <?xml version="1.0" encoding="UTF-8"?>
    <LifecycleConfiguration>
      <Rule>
        <ID>rule1</ID>
        <Prefix>test</Prefix>
        <Status>Enabled</Status>
        <Transition>
        	<Days>30</Days>
          <StorageClass>IA</StorageClass>
        </Transition>
      </Rule>
      <Rule>
        <ID>rule2</ID>
        <Prefix>test/log</Prefix>
        <Status>Enabled</Status>
        <Transition>
        	<Days>60</Days>
          <StorageClass>Archive</StorageClass>
        </Transition>
        <Rule>
        <ID>rule3</ID>
        <Prefix>test/log/cache</Prefix>
        <Status>Enabled</Status>
        <Expiration>
        	<Days>120</Days>
        </Expiration>
      </Rule>
    </LifecycleConfiguration>
  • Configure lifecycle rules in the OSS console to avoid manually constructing request bodies.

References