@@ -548,26 +548,27 @@ struct RGWZoneGroupPlacementTier {
548548 std::string tier_type;
549549 std::string storage_class;
550550 bool retain_head_object = false ;
551- bool allow_read_through = false ;
552- uint64_t read_through_restore_days = 1 ;
553551
554552 struct _tier {
555553 RGWZoneGroupPlacementTierS3 s3;
556554 } t;
557555
556+ bool allow_read_through = false ;
557+ uint64_t read_through_restore_days = 1 ;
558+
558559 int update_params (const JSONFormattable& config);
559560 int clear_params (const JSONFormattable& config);
560561
561562 void encode (bufferlist& bl) const {
562- ENCODE_START (2 , 1 , bl);
563+ ENCODE_START (3 , 1 , bl);
563564 encode (tier_type, bl);
564565 encode (storage_class, bl);
565566 encode (retain_head_object, bl);
566- encode (allow_read_through, bl);
567- encode (read_through_restore_days, bl);
568567 if (tier_type == " cloud-s3" ) {
569568 encode (t.s3 , bl);
570569 }
570+ encode (allow_read_through, bl);
571+ encode (read_through_restore_days, bl);
571572 ENCODE_FINISH (bl);
572573 }
573574
@@ -576,12 +577,22 @@ struct RGWZoneGroupPlacementTier {
576577 decode (tier_type, bl);
577578 decode (storage_class, bl);
578579 decode (retain_head_object, bl);
579- if (struct_v >= 2 ) {
580+ if (struct_v == 1 ) {
581+ if (tier_type == " cloud-s3" ) {
582+ decode (t.s3 , bl);
583+ }
584+ } else if (struct_v == 2 ) {
585+ decode (allow_read_through, bl);
586+ decode (read_through_restore_days, bl);
587+ if (tier_type == " cloud-s3" ) {
588+ decode (t.s3 , bl);
589+ }
590+ } else if (struct_v >= 3 ) {
591+ if (tier_type == " cloud-s3" ) {
592+ decode (t.s3 , bl);
593+ }
580594 decode (allow_read_through, bl);
581595 decode (read_through_restore_days, bl);
582- }
583- if (tier_type == " cloud-s3" ) {
584- decode (t.s3 , bl);
585596 }
586597 DECODE_FINISH (bl);
587598 }
0 commit comments