]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rgw-restore-bucket-index -- sort uses specified temp dir 56133/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Mon, 11 Mar 2024 21:19:40 +0000 (17:19 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Tue, 12 Mar 2024 17:10:25 +0000 (13:10 -0400)
The sort command sometimes makes use of temporary files. When the user
specifies a directory to be used for temp files, have the sort command
use that same directory.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
src/rgw/rgw-restore-bucket-index

index 3b00ac9767a1708da99b0b278990931ee32ea619..a38d97068a231a16cd8162bb4a604c711bbac119 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-# version 2024-03-04
+# version 2024-03-11
 
 # rgw-restore-bucket-index is an EXPERIMENTAL tool to use in case
 # bucket index entries for objects in the bucket are somehow lost. It
@@ -65,7 +65,7 @@ EOF
 # cleans all temporary files
 clean() {
   if [ "$clean_temps" == 1 ] ;then
-    rm -f $bkt_entry $temp_file_list
+    rm -f $bkt_entry $temp_file_list \
        $zone_info $olh_info_enc $olh_info_json
   fi
 }
@@ -272,7 +272,7 @@ handle_versioned() {
                test_temp_space
                rados -p $pool stat2 $obj --object-locator "$loc"
            done | # output of stat2, which includes mtime
-           sort -k 3 | # stat2 but sorted by mtime earlier to later
+           sort -T $temp_dir -k 3 | # stat2 but sorted by mtime earlier to later
            grep -v -e "$filter_out_last_instance" | # remove the final instance in case it's not last
 
            # sed 1) removes pool and marker, 2) removes indicator of