test_unfound.sh: verify that we have unfound objs.
Then, when we bring up the other OSD, verify that those unfound objects
are found (on that OSD).
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
} else
ss << "invalid pgid '" << m->cmd[2] << "'";
}
+ else if ((m->cmd[1] == "debug") && (m->cmd.size() > 2)) {
+ if (m->cmd[2] == "unfound_objects_exist") {
+ bool unfound_objects_exist = false;
+ hash_map<pg_t,pg_stat_t>::const_iterator end = pg_map.pg_stat.end();
+ for (hash_map<pg_t,pg_stat_t>::const_iterator s = pg_map.pg_stat.begin();
+ s != end; ++s)
+ {
+ if (s->second.num_objects_unfound > 0) {
+ unfound_objects_exist = true;
+ break;
+ }
+ }
+ if (unfound_objects_exist)
+ ss << "TRUE";
+ else
+ ss << "FALSE";
+
+ r = 0;
+ }
+ }
}
if (r != -1) {
done
}
+poll_cmd() {
+ command=$1
+ search_str=$2
+ polling_interval=$3
+ total_time=$4
+
+ t=0
+ while [ $t -lt $total_time ]; do
+ $command | grep $search_str
+ [ $? -eq 0 ] && return 1
+ sleep $polling_interval
+ t=$(($t+$polling_interval))
+ done
+
+ return 0
+}
+
init
# Objects should be lost.
stop_osd 0
- echo "There should be unfound objects."
- continue_prompt "to test finding the unfound objects."
+ poll_cmd "./ceph pg debug unfound_objects_exist" TRUE 3 120
+ [ $? -eq 1 ] || die "Failed to see unfound objects."
+ echo "Got unfound objects."
restart_osd 0
+
+ poll_cmd "./ceph pg debug unfound_objects_exist" FALSE 3 120
+ [ $? -eq 1 ] || die "Failed to recover unfound objects."
+
+ # success
+ return 1
}
run() {