~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* Copyright (C) 2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */


#include <signaldata/BackupSignalData.hpp>

bool 
printBACKUP_REQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 bno){
  BackupReq* sig = (BackupReq*)theData;
  fprintf(output, " senderData: %d DataLength: %d flags: %d\n", 
	  sig->senderData,
	  sig->backupDataLen,
	  sig->flags);
  return true;
}

bool 
printBACKUP_DATA(FILE * output, const Uint32 * theData, Uint32 len, Uint16 bno){
  BackupData * sig = (BackupData*)theData;
  if(sig->requestType == BackupData::ClientToMaster){
    fprintf(output, " ClientToMaster: senderData: %d backupId: %d\n",
	    sig->senderData, sig->backupId);
  } else if(sig->requestType == BackupData::MasterToSlave){
    fprintf(output, " MasterToSlave: backupPtr: %d backupId: %d\n",
	    sig->backupPtr, sig->backupId);
  }
  return false;
}

bool 
printBACKUP_REF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 bno){

  BackupRef* sig = (BackupRef*)theData;
  fprintf(output, " senderData: %d errorCode: %d masterRef: %d\n",
	  sig->senderData,
	  sig->errorCode,
	  sig->masterRef);
  return true;
}

bool 
printBACKUP_CONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 bno){
  BackupConf* sig = (BackupConf*)theData;
  fprintf(output, " senderData: %d backupId: %d\n",
	  sig->senderData,
	  sig->backupId);
  return true;
}

bool 
printBACKUP_ABORT_REP(FILE * out, const Uint32 * data, Uint32 len, Uint16 bno){
  BackupAbortRep* sig = (BackupAbortRep*)data;
  fprintf(out, " senderData: %d backupId: %d reason: %d\n",
	  sig->senderData,
	  sig->backupId,
	  sig->reason);
  return true;
}

bool 
printBACKUP_COMPLETE_REP(FILE * out, const Uint32 * data, Uint32 len, Uint16 b){
  BackupCompleteRep* sig = (BackupCompleteRep*)data;
  fprintf(out, " senderData: %d backupId: %d records: %llu bytes: %llu\n",
	  sig->senderData,
	  sig->backupId,
	  sig->noOfRecordsLow + (((Uint64)sig->noOfRecordsHigh) << 32),
          sig->noOfBytesLow + (((Uint64)sig->noOfBytesHigh) << 32));
  return true;
}

bool 
printBACKUP_NF_COMPLETE_REP(FILE*, const Uint32*, Uint32, Uint16){
  return false;
}

bool 
printABORT_BACKUP_ORD(FILE * out, const Uint32 * data, Uint32 len, Uint16 b){
  AbortBackupOrd* sig = (AbortBackupOrd*)data;

  AbortBackupOrd::RequestType rt =(AbortBackupOrd::RequestType)sig->requestType;
  switch(rt){
  case AbortBackupOrd::ClientAbort:
    fprintf(out, " ClientAbort: senderData: %d backupId: %d\n",
	    sig->senderData, sig->backupId);
    return true;
    break;
  case AbortBackupOrd::BackupComplete:
    fprintf(out, " BackupComplete: backupPtr: %d backupId: %d\n",
	    sig->backupPtr, sig->backupId);
    return true;
  case AbortBackupOrd::BackupFailure:
    fprintf(out, " BackupFailure: backupPtr: %d backupId: %d\n",
	    sig->backupPtr, sig->backupId);
    return true;
  case AbortBackupOrd::LogBufferFull:
    fprintf(out, " LogBufferFull: backupPtr: %d backupId: %d\n",
	    sig->backupPtr, sig->backupId);
    return true;
    break;
  case AbortBackupOrd::FileOrScanError:
    fprintf(out, " FileOrScanError: backupPtr: %d backupId: %d\n",
	    sig->backupPtr, sig->backupId);
    return true;
    break;
  case AbortBackupOrd::BackupFailureDueToNodeFail:
    fprintf(out, " BackupFailureDueToNodeFail: backupPtr: %d backupId: %d\n",
	    sig->backupPtr, sig->backupId);
    return true;
    break;
  case AbortBackupOrd::OkToClean:
    fprintf(out, " OkToClean: backupPtr: %d backupId: %d\n",
	    sig->backupPtr, sig->backupId);
    return true;
    break;
  case AbortBackupOrd::AbortScan:
  case AbortBackupOrd::IncompatibleVersions:
    return false;
  }
  return false;
}