Skip to content

Commit d7db493

Browse files
dedicated repl output
Signed-off-by: Sarthak Aggarwal <[email protected]>
1 parent 5ab01f1 commit d7db493

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/childinfo.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ typedef struct {
3636
size_t cow;
3737
monotime cow_updated;
3838
double progress;
39-
size_t output;
39+
size_t repl_output_bytes;
4040
childInfoType information_type; /* Type of information */
4141
} child_info_data;
4242

@@ -65,7 +65,7 @@ void closeChildInfoPipe(void) {
6565
}
6666

6767
/* Send save data to parent. */
68-
void sendChildInfoGeneric(childInfoType info_type, size_t keys, size_t output, double progress, char *pname) {
68+
void sendChildInfoGeneric(childInfoType info_type, size_t keys, size_t repl_output_bytes, double progress, char *pname) {
6969
if (server.child_info_pipe[1] == -1) return;
7070

7171
static monotime cow_updated = 0;
@@ -102,7 +102,7 @@ void sendChildInfoGeneric(childInfoType info_type, size_t keys, size_t output, d
102102

103103
data.information_type = info_type;
104104
data.keys = keys;
105-
data.output = output;
105+
data.repl_output_bytes = repl_output_bytes;
106106
data.cow = cow;
107107
data.cow_updated = cow_updated;
108108
data.progress = progress;
@@ -117,7 +117,7 @@ void sendChildInfoGeneric(childInfoType info_type, size_t keys, size_t output, d
117117
}
118118

119119
/* Update Child info. */
120-
void updateChildInfo(childInfoType information_type, size_t cow, monotime cow_updated, size_t keys, size_t output, double progress) {
120+
void updateChildInfo(childInfoType information_type, size_t cow, monotime cow_updated, size_t keys, size_t repl_output_bytes, double progress) {
121121
if (cow > server.stat_current_cow_peak) server.stat_current_cow_peak = cow;
122122

123123
if (information_type == CHILD_INFO_TYPE_CURRENT_INFO) {
@@ -132,15 +132,15 @@ void updateChildInfo(childInfoType information_type, size_t cow, monotime cow_up
132132
} else if (information_type == CHILD_INFO_TYPE_MODULE_COW_SIZE) {
133133
server.stat_module_cow_bytes = server.stat_current_cow_peak;
134134
} else if (information_type == CHILD_INFO_TYPE_REPL_OUTPUT_BYTES) {
135-
server.stat_net_repl_output_bytes += (long long)output;
135+
server.stat_net_repl_output_bytes += (long long)repl_output_bytes;
136136
}
137137
}
138138

139139
/* Read child info data from the pipe.
140140
* if complete data read into the buffer,
141141
* data is stored into *buffer, and returns 1.
142142
* otherwise, the partial data is left in the buffer, waiting for the next read, and returns 0. */
143-
int readChildInfo(childInfoType *information_type, size_t *cow, monotime *cow_updated, size_t *keys, size_t *output, double *progress) {
143+
int readChildInfo(childInfoType *information_type, size_t *cow, monotime *cow_updated, size_t *keys, size_t *repl_output_bytes, double *progress) {
144144
/* We are using here a static buffer in combination with the server.child_info_nread to handle short reads */
145145
static child_info_data buffer;
146146
ssize_t wlen = sizeof(buffer);
@@ -160,7 +160,7 @@ int readChildInfo(childInfoType *information_type, size_t *cow, monotime *cow_up
160160
*cow = buffer.cow;
161161
*cow_updated = buffer.cow_updated;
162162
*keys = buffer.keys;
163-
*output = buffer.output;
163+
*repl_output_bytes = buffer.repl_output_bytes;
164164
*progress = buffer.progress;
165165
return 1;
166166
} else {
@@ -175,12 +175,12 @@ void receiveChildInfo(void) {
175175
size_t cow;
176176
monotime cow_updated;
177177
size_t keys;
178-
size_t output;
178+
size_t repl_output_bytes;
179179
double progress;
180180
childInfoType information_type;
181181

182182
/* Drain the pipe and update child info so that we get the final message. */
183-
while (readChildInfo(&information_type, &cow, &cow_updated, &keys, &output, &progress)) {
184-
updateChildInfo(information_type, cow, cow_updated, keys, output, progress);
183+
while (readChildInfo(&information_type, &cow, &cow_updated, &keys, &repl_output_bytes, &progress)) {
184+
updateChildInfo(information_type, cow, cow_updated, keys, repl_output_bytes, progress);
185185
}
186186
}

src/server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3157,7 +3157,7 @@ int rewriteSlotToAppendOnlyFileRio(rio *aof, int db_num, int hashslot, size_t *k
31573157
/* Child info */
31583158
void openChildInfoPipe(void);
31593159
void closeChildInfoPipe(void);
3160-
void sendChildInfoGeneric(childInfoType info_type, size_t keys, size_t output, double progress, char *pname);
3160+
void sendChildInfoGeneric(childInfoType info_type, size_t keys, size_t repl_output_bytes, double progress, char *pname);
31613161
void sendChildCowInfo(childInfoType info_type, char *pname);
31623162
void sendChildInfo(childInfoType info_type, size_t keys, char *pname);
31633163
void receiveChildInfo(void);

0 commit comments

Comments
 (0)