Просмотр исходного кода

defect 703
checkpoint synchronize calls do not check if active replica set


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@741 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 20 лет назад
Родитель
Сommit
d8accbfacc
3 измененных файлов с 12 добавлено и 1 удалено
  1. 9 1
      exec/ckpt.c
  2. 1 0
      include/ipc_ckpt.h
  3. 2 0
      lib/ckpt.c

+ 9 - 1
exec/ckpt.c

@@ -3233,11 +3233,19 @@ static int message_handler_req_lib_ckpt_sectionread (struct conn_info *conn_info
 
 static int message_handler_req_lib_ckpt_checkpointsynchronize (struct conn_info *conn_info, void *message)
 {
+	struct req_lib_ckpt_checkpointsynchronize *req_lib_ckpt_checkpointsynchronize = (struct req_lib_ckpt_checkpointsynchronize *)message;
 	struct res_lib_ckpt_checkpointsynchronize res_lib_ckpt_checkpointsynchronize;
+	struct saCkptCheckpoint *checkpoint;
+
+	checkpoint = ckpt_checkpoint_find_global (&req_lib_ckpt_checkpointsynchronize->checkpointName);
+	if (checkpoint->active_replica_set == 1) {
+		res_lib_ckpt_checkpointsynchronize.header.error = SA_AIS_OK;
+	} else {
+		res_lib_ckpt_checkpointsynchronize.header.error = SA_AIS_ERR_NOT_EXIST;
+	}
 
 	res_lib_ckpt_checkpointsynchronize.header.size = sizeof (struct res_lib_ckpt_checkpointsynchronize);
 	res_lib_ckpt_checkpointsynchronize.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE;
-	res_lib_ckpt_checkpointsynchronize.header.error = SA_AIS_OK;
 
 	libais_send_response (conn_info,
 		&res_lib_ckpt_checkpointsynchronize,

+ 1 - 0
include/ipc_ckpt.h

@@ -244,6 +244,7 @@ struct res_lib_ckpt_sectionread {
 
 struct req_lib_ckpt_checkpointsynchronize {
 	struct req_header header;
+	SaNameT checkpointName;
 };
 
 struct res_lib_ckpt_checkpointsynchronize {

+ 2 - 0
lib/ckpt.c

@@ -1582,6 +1582,8 @@ saCkptCheckpointSynchronize (
 
 	req_lib_ckpt_checkpointsynchronize.header.size = sizeof (struct req_lib_ckpt_checkpointsynchronize); 
 	req_lib_ckpt_checkpointsynchronize.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE;
+	memcpy (&req_lib_ckpt_checkpointsynchronize.checkpointName,
+		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 
 	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);