Skip to content

Commit b96b33d

Browse files
committed
[*] Fixed all trailing spaces plus retab
1 parent c04c196 commit b96b33d

11 files changed

+160
-160
lines changed

Logging.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
#include <iostream>
2020

21-
#define LOG_TRACE(LOG, S)
22-
#define LOG_DEBUG(LOG, S)
23-
#define LOG_INFO(LOG, S)
21+
#define LOG_TRACE(LOG, S)
22+
#define LOG_DEBUG(LOG, S)
23+
#define LOG_INFO(LOG, S)
2424
#define LOG_WARNING(LOG, S) std::cerr << S << std::endl;
2525
#define LOG_ERROR(LOG, S) std::cerr << S << std::endl;
2626

Slave.cpp

+14-14
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void Slave::createTable(RelayLogInfo& rli,
9999
LOG_TRACE(log, "enter: createTable " << db_name << " " << tbl_name);
100100

101101
nanomysql::Connection::result_t res;
102-
102+
103103
conn.query("SHOW FULL COLUMNS FROM " + tbl_name + " IN " + db_name);
104104
conn.store(res);
105105

@@ -360,7 +360,7 @@ void Slave::get_remote_binlog( const boost::function< bool() >& _interruptFlag)
360360

361361
stats::setMasterInfoFile(m_master_info.master_info_file);
362362

363-
stats::readMasterInfoFile(m_master_info.master_log_name,
363+
stats::readMasterInfoFile(m_master_info.master_log_name,
364364
m_master_info.master_log_pos);
365365
}
366366

@@ -460,7 +460,7 @@ void Slave::get_remote_binlog( const boost::function< bool() >& _interruptFlag)
460460
slave::Basic_event_info event;
461461

462462
if (!slave::read_log_event((const char*) mysql.net.read_pos + 1,
463-
len - 1,
463+
len - 1,
464464
event)) {
465465

466466
LOG_TRACE(log, "Skipping unknown event.");
@@ -522,20 +522,20 @@ void Slave::get_remote_binlog( const boost::function< bool() >& _interruptFlag)
522522

523523
stats::setMasterLogPos(m_master_info.master_log_pos);
524524
stats::setMasterLogName(rei.new_log_ident);
525-
525+
526526
m_master_info.master_log_name = rei.new_log_ident;
527527
m_master_info.master_log_pos = rei.pos; //всегда равно 4
528528

529529
LOG_TRACE(log, "ROTATE_EVENT processed OK.");
530530
}
531531

532-
532+
533533
if (process_event(event, m_rli, m_master_info.master_log_pos)) {
534534

535535
LOG_TRACE(log, "Error in processing event.");
536536
}
537537

538-
538+
539539

540540
} catch (const std::exception& _ex ) {
541541

@@ -576,7 +576,7 @@ std::map<std::string,std::string> Slave::getRowType(const std::string& db_name,
576576
LOG_ERROR(log, "WARNING: Broken SHOW TABLE STATUS FROM " << db_name);
577577
continue;
578578
}
579-
579+
580580
//row[0] - содержит имя таблицы
581581
//row[3] - содержит row_format
582582

@@ -697,7 +697,7 @@ void Slave::check_master_version() {
697697
break;
698698
}
699699

700-
if (*e == '\0' || e == v)
700+
if (*e == '\0' || e == v)
701701
break;
702702

703703
v = e+1;
@@ -758,7 +758,7 @@ static bool checkAlterQuery(const std::string& str)
758758
//RegularExpression regexp("^\\s*ALTER\\s+TABLE)", RegularExpression::RE_CASELESS);
759759

760760
enum {
761-
SP0, _A0, _L0, _T0, _E0, _R, SP1, _T1, _A1, _B, _L1, _E1
761+
SP0, _A0, _L0, _T0, _E0, _R, SP1, _T1, _A1, _B, _L1, _E1
762762
} state = SP0;
763763

764764

@@ -785,7 +785,7 @@ static bool checkAlterQuery(const std::string& str)
785785
state = SP1;
786786

787787
} else if (state == SP1 && (*i == ' ' || *i == '\t' || *i == '\r' || *i == '\n')) {
788-
788+
789789
} else if (state == SP1 && (*i == 't' || *i == 'T')) {
790790
state = _T1;
791791

@@ -873,7 +873,7 @@ int Slave::process_event(const slave::Basic_event_info& bei, RelayLogInfo &m_rli
873873

874874
break;
875875
}
876-
876+
877877
default:
878878
break;
879879
}
@@ -954,7 +954,7 @@ void Slave::generateSlaveId()
954954
//row[0] - содержит имя server_id
955955

956956
std::map<std::string,nanomysql::Connection::field>::const_iterator z = i->find("Server_id");
957-
957+
958958
if (z == i->end())
959959
throw std::runtime_error("Slave::create_table(): SHOW SLAVE HOSTS query did not return 'Server_id'");
960960

@@ -998,14 +998,14 @@ std::pair<std::string,unsigned int> Slave::getLastBinlog()
998998
if (res.size() == 1 && res[0].size() == 4) {
999999

10001000
std::map<std::string,nanomysql::Connection::field>::const_iterator z = res[0].find("File");
1001-
1001+
10021002
if (z == res[0].end())
10031003
throw std::runtime_error("Slave::create_table(): SHOW SLAVE HOSTS query did not return 'File'");
10041004

10051005
std::string file = z->second.data;
10061006

10071007
z = res[0].find("Position");
1008-
1008+
10091009
if (z == res[0].end())
10101010
throw std::runtime_error("Slave::create_table(): SHOW SLAVE HOSTS query did not return 'Position'");
10111011

Slave.h

+25-25
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
*/
1414

1515
/*
16-
*
16+
*
1717
* Гарантируется работа с MySQL5.1.23
18-
*
18+
*
1919
*/
2020

2121
#ifndef __SLAVE_SLAVE_H_
@@ -63,7 +63,7 @@ struct MasterInfo {
6363
std::string master_log_name;
6464
unsigned long master_log_pos;
6565
unsigned int connect_retry;
66-
66+
6767
std::string master_info_file;
6868

6969
MasterInfo() : port(3306), master_log_pos(0), connect_retry(10) {}
@@ -84,14 +84,14 @@ class Slave
8484

8585
MYSQL mysql;
8686

87-
int m_server_id;
87+
int m_server_id;
8888

8989
MasterInfo m_master_info;
9090

9191
table_order_t m_table_order;
9292
callbacks_t m_callbacks;
9393

94-
typedef boost::function<void (unsigned int)> xid_callback_t;
94+
typedef boost::function<void (unsigned int)> xid_callback_t;
9595
xid_callback_t m_xid_callback;
9696

9797
RelayLogInfo m_rli;
@@ -100,7 +100,7 @@ class Slave
100100
void createDatabaseStructure_(table_order_t& tabs, RelayLogInfo& rli) const;
101101

102102
public:
103-
103+
104104
Slave() {}
105105

106106
Slave(MasterInfo& _master_info) : m_master_info(_master_info) {}
@@ -116,9 +116,9 @@ class Slave
116116
void setXidCallback(xid_callback_t _callback) {
117117
m_xid_callback = _callback;
118118
}
119-
119+
120120
void get_remote_binlog( const boost::function< bool() >& _interruptFlag = &Slave::falseFunction );
121-
121+
122122
void createDatabaseStructure() {
123123

124124
m_rli.clear();
@@ -136,10 +136,10 @@ class Slave
136136

137137
table_order_t getTableOrder() const {
138138
return m_table_order;
139-
}
139+
}
140140

141141
void init();
142-
142+
143143
int getServerOid() const { return m_server_id; }
144144

145145
// Closes connection, opened in get_remotee_binlog. Should be called if your have get_remote_binlog
@@ -148,41 +148,41 @@ class Slave
148148
void close_connection();
149149

150150
protected:
151-
152-
151+
152+
153153
int connect_to_master(int reconnect = 0);
154-
154+
155155
int safe_reconnect();
156-
156+
157157
int safe_connect();
158-
158+
159159
void check_master_version();
160160

161161
void check_master_binlog_format();
162-
162+
163163
int process_event(const slave::Basic_event_info& bei, RelayLogInfo &rli, unsigned long long pos);
164-
164+
165165
void request_dump(const std::string& logname, unsigned long start_position, MYSQL* mysql);
166-
166+
167167
ulong read_event(MYSQL* mysql);
168-
169-
std::map<std::string,std::string> getRowType(const std::string& db_name,
168+
169+
std::map<std::string,std::string> getRowType(const std::string& db_name,
170170
const std::set<std::string>& tbl_names) const;
171171

172172
std::pair<std::string,unsigned int> getLastBinlog();
173-
173+
174174
void createTable(RelayLogInfo& rli,
175175
const std::string& db_name, const std::string& tbl_name,
176176
const collate_map_t& collate_map, nanomysql::Connection& conn) const;
177-
177+
178178
void register_slave_on_master(const bool m_register, MYSQL* mysql);
179-
179+
180180
void generateSlaveId();
181-
181+
182182
};
183183

184184

185185

186186
}
187187

188-
#endif
188+
#endif

SlaveStats.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ namespace stats {
3737

3838
class SlaveStats {
3939
public:
40-
41-
std::string connection_host;
40+
41+
std::string connection_host;
4242
std::string master_log_name;
4343
unsigned long master_log_pos;
4444
unsigned int reconnect_count;
@@ -51,7 +51,7 @@ class SlaveStats {
5151
std::map<std::string,size_t> table_counts;
5252

5353
std::string master_info_file;
54-
54+
5555
SlaveStats() :
5656
master_log_pos(0),
5757
reconnect_count(0),
@@ -66,7 +66,7 @@ class SlaveStats {
6666

6767
std::ofstream f(master_info_file.c_str(), std::ios::out | std::ios::trunc);
6868

69-
if (!f)
69+
if (!f)
7070
throw std::runtime_error("slave::writeMasterInfoFile(): Could not open file: " + master_info_file);
7171

7272
f << master_log_pos << '\n' << master_log_name << '\n';
@@ -99,9 +99,9 @@ class SlaveStats {
9999

100100
};
101101

102-
///
102+
///
103103

104-
inline SlaveStats& stats() {
104+
inline SlaveStats& stats() {
105105
static SlaveStats _stats;
106106
return _stats;
107107
}
@@ -120,9 +120,9 @@ inline void setMasterLogPos(unsigned int p) { stats().master_log_pos = p; }
120120

121121
inline void setReconnectCount() { stats().reconnect_count++; }
122122

123-
inline void setLastEventTime(time_t d) {
124-
stats().last_event_time = d;
125-
stats().last_update = ::time(NULL);
123+
inline void setLastEventTime(time_t d) {
124+
stats().last_event_time = d;
125+
stats().last_update = ::time(NULL);
126126
}
127127

128128
inline void setStateProcessing(bool p) { stats().state_processing = p; }
@@ -140,4 +140,4 @@ inline void incTableCount(const std::string& t) { stats().table_counts[t]++; }
140140
}
141141

142142

143-
#endif
143+
#endif

0 commit comments

Comments
 (0)