Skip to content

Commit 189b424

Browse files
committed
Remove dead code
Signed-off-by: Morgan Douglas <mdouglas47@bloomberg.net>
1 parent 7fbfc60 commit 189b424

File tree

3 files changed

+0
-291
lines changed

3 files changed

+0
-291
lines changed

db/osqlcomm.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -818,21 +818,6 @@ static uint8_t *osqlcomm_packed_schemachange_rpl_type_put(osql_rpl_t *hd, void *
818818
return p_buf;
819819
}
820820

821-
static uint8_t *osqlcomm_schemachange_rpl_type_put(osql_rpl_t *hd, struct schema_change_type *sc, uint8_t *p_buf,
822-
uint8_t *p_buf_end)
823-
{
824-
size_t sc_len = schemachange_packed_size(sc);
825-
826-
if (p_buf_end < p_buf ||
827-
OSQLCOMM_RPL_TYPE_LEN + sc_len > (p_buf_end - p_buf))
828-
return NULL;
829-
830-
p_buf = osqlcomm_rpl_type_put(hd, p_buf, p_buf_end);
831-
p_buf = buf_put_schemachange(sc, p_buf, p_buf_end);
832-
833-
return p_buf;
834-
}
835-
836821
static uint8_t *osqlcomm_packed_schemachange_uuid_rpl_type_put(osql_uuid_rpl_t *hd, void *packed_sc, size_t sc_len,
837822
uint8_t *p_buf, uint8_t *p_buf_end)
838823
{
@@ -845,19 +830,6 @@ static uint8_t *osqlcomm_packed_schemachange_uuid_rpl_type_put(osql_uuid_rpl_t *
845830
return p_buf;
846831
}
847832

848-
static uint8_t *osqlcomm_schemachange_uuid_rpl_type_put(osql_uuid_rpl_t *hd, struct schema_change_type *sc,
849-
uint8_t *p_buf, uint8_t *p_buf_end)
850-
{
851-
size_t sc_len = schemachange_packed_size(sc);
852-
853-
if (p_buf_end < p_buf || OSQLCOMM_UUID_RPL_TYPE_LEN + sc_len > (p_buf_end - p_buf))
854-
return NULL;
855-
856-
p_buf = osqlcomm_uuid_rpl_type_put(hd, p_buf, p_buf_end);
857-
p_buf = buf_put_schemachange(sc, p_buf, p_buf_end);
858-
859-
return p_buf;
860-
}
861833
/***************************************************************************/
862834

863835
typedef struct osql_serial {

schemachange/sc_struct.c

Lines changed: 0 additions & 259 deletions
Original file line numberDiff line numberDiff line change
@@ -139,109 +139,6 @@ void free_schema_change_type(struct schema_change_type *s)
139139
}
140140
}
141141

142-
static size_t dests_field_packed_size(struct schema_change_type *s)
143-
{
144-
145-
size_t len = sizeof(s->dests.count);
146-
int i;
147-
struct dest *d;
148-
for (i = 0, d = s->dests.top; d; d = d->lnk.next, i++) {
149-
len += sizeof(int);
150-
len += strlen(d->dest);
151-
}
152-
return len;
153-
}
154-
155-
static size_t _partition_packed_size(struct comdb2_partition *p)
156-
{
157-
switch (p->type) {
158-
case PARTITION_NONE:
159-
case PARTITION_REMOVE:
160-
return sizeof(p->type);
161-
case PARTITION_ADD_TIMED:
162-
case PARTITION_ADD_MANUAL:
163-
return sizeof(p->type) + sizeof(p->u.tpt.period) +
164-
sizeof(p->u.tpt.retention) + sizeof(p->u.tpt.start);
165-
case PARTITION_MERGE:
166-
return sizeof(p->type) + sizeof(p->u.mergetable.tablename) +
167-
sizeof(p->u.mergetable.version);
168-
case PARTITION_ADD_GENSHARD: {
169-
int sz = sizeof(p->type) + sizeof(p->u.genshard.tablename);
170-
171-
sz += sizeof(p->u.genshard.numdbs);
172-
for (int i = 0; i < p->u.genshard.numdbs; i++) {
173-
sz += strlen(p->u.genshard.dbnames[i]) + 1;
174-
}
175-
176-
sz += sizeof(p->u.genshard.numcols);
177-
for (int i = 0; i < p->u.genshard.numcols; i++) {
178-
sz += strlen(p->u.genshard.columns[i]) + 1;
179-
}
180-
for (int i = 0; i < p->u.genshard.numdbs; i++) {
181-
sz += strlen(p->u.genshard.shardnames[i]) + 1;
182-
}
183-
return sz;
184-
}
185-
case PARTITION_REM_GENSHARD:
186-
return sizeof(p->type);
187-
default:
188-
logmsg(LOGMSG_ERROR, "Unimplemented partition type %d\n", p->type);
189-
abort();
190-
}
191-
}
192-
193-
size_t schemachange_packed_size(struct schema_change_type *s)
194-
{
195-
s->tablename_len = strlen(s->tablename) + 1;
196-
s->fname_len = strlen(s->fname) + 1;
197-
s->aname_len = strlen(s->aname) + 1;
198-
s->spname_len = strlen(s->spname) + 1;
199-
s->newcsc2_len = (s->newcsc2) ? strlen(s->newcsc2) + 1 : 0;
200-
201-
s->packed_len =
202-
sizeof(s->kind) + sizeof(s->rqid) + sizeof(s->uuid) +
203-
sizeof(s->tablename_len) + s->tablename_len + sizeof(s->fname_len) +
204-
s->fname_len + sizeof(s->aname_len) + s->aname_len +
205-
sizeof(s->avgitemsz) + sizeof(s->newdtastripe) + sizeof(s->blobstripe) +
206-
sizeof(s->live) + sizeof(s->newcsc2_len) + s->newcsc2_len +
207-
sizeof(s->scanmode) + sizeof(s->delay_commit) +
208-
sizeof(s->force_rebuild) + sizeof(s->force_dta_rebuild) +
209-
sizeof(s->force_blob_rebuild) + sizeof(s->force) + sizeof(s->headers) +
210-
sizeof(s->header_change) + sizeof(s->compress) +
211-
sizeof(s->compress_blobs) + sizeof(s->persistent_seq) +
212-
sizeof(s->ip_updates) + sizeof(s->instant_sc) + sizeof(s->preempted) +
213-
sizeof(s->use_plan) + sizeof(s->commit_sleep) +
214-
sizeof(s->convert_sleep) + sizeof(s->same_schema) + sizeof(s->dbnum) +
215-
sizeof(s->flg) + sizeof(s->rebuild_index) +
216-
sizeof(s->index_to_rebuild) + sizeof(s->source_node) +
217-
dests_field_packed_size(s) + sizeof(s->spname_len) + s->spname_len +
218-
sizeof(s->lua_func_flags) + sizeof(s->newtable) +
219-
sizeof(s->usedbtablevers) + sizeof(s->qdb_file_ver) +
220-
_partition_packed_size(&s->partition) + sizeof(s->preserve_oplog_count);
221-
222-
return s->packed_len;
223-
}
224-
225-
static void *buf_put_dests(struct schema_change_type *s, void *p_buf,
226-
void *p_buf_end)
227-
{
228-
int len;
229-
struct dest *d;
230-
int i;
231-
232-
p_buf = buf_put(&s->dests.count, sizeof(s->dests.count), p_buf, p_buf_end);
233-
234-
for (i = 0, d = s->dests.top; d; d = d->lnk.next, i++) {
235-
len = strlen(d->dest);
236-
p_buf = buf_put(&len, sizeof(len), p_buf, p_buf_end);
237-
if (len) {
238-
p_buf = buf_no_net_put(d->dest, len, p_buf, p_buf_end);
239-
}
240-
}
241-
242-
return p_buf;
243-
}
244-
245142
int gbl_sc_current_version = SC_VERSION;
246143

247144
int pack_schema_change_protobuf(struct schema_change_type *s, void **packed_sc, size_t *sz)
@@ -596,162 +493,6 @@ void *buf_get_schemachange_protobuf(struct schema_change_type *s, void *p_buf, v
596493
return p_buf;
597494
}
598495

599-
void *buf_put_schemachange(struct schema_change_type *s, void *p_buf, void *p_buf_end)
600-
{
601-
if (p_buf >= p_buf_end) return NULL;
602-
603-
p_buf = buf_put(&s->kind, sizeof(s->kind), p_buf, p_buf_end);
604-
605-
p_buf = buf_put(&s->rqid, sizeof(s->rqid), p_buf, p_buf_end);
606-
607-
p_buf = buf_no_net_put(&s->uuid, sizeof(s->uuid), p_buf, p_buf_end);
608-
609-
p_buf =
610-
buf_put(&s->tablename_len, sizeof(s->tablename_len), p_buf, p_buf_end);
611-
612-
p_buf = buf_no_net_put(s->tablename, s->tablename_len, p_buf, p_buf_end);
613-
614-
p_buf = buf_put(&s->fname_len, sizeof(s->fname_len), p_buf, p_buf_end);
615-
616-
p_buf = buf_no_net_put(s->fname, s->fname_len, p_buf, p_buf_end);
617-
618-
p_buf = buf_put(&s->aname_len, sizeof(s->aname_len), p_buf, p_buf_end);
619-
620-
p_buf = buf_no_net_put(s->aname, s->aname_len, p_buf, p_buf_end);
621-
622-
p_buf = buf_put(&s->avgitemsz, sizeof(s->avgitemsz), p_buf, p_buf_end);
623-
624-
p_buf =
625-
buf_put(&s->newdtastripe, sizeof(s->newdtastripe), p_buf, p_buf_end);
626-
627-
p_buf = buf_put(&s->blobstripe, sizeof(s->blobstripe), p_buf, p_buf_end);
628-
629-
p_buf = buf_put(&s->live, sizeof(s->live), p_buf, p_buf_end);
630-
631-
p_buf = buf_put(&s->newcsc2_len, sizeof(s->newcsc2_len), p_buf, p_buf_end);
632-
633-
if (s->newcsc2_len) {
634-
p_buf = buf_no_net_put(s->newcsc2, s->newcsc2_len, p_buf, p_buf_end);
635-
}
636-
637-
p_buf = buf_put(&s->scanmode, sizeof(s->scanmode), p_buf, p_buf_end);
638-
639-
p_buf =
640-
buf_put(&s->delay_commit, sizeof(s->delay_commit), p_buf, p_buf_end);
641-
642-
p_buf =
643-
buf_put(&s->force_rebuild, sizeof(s->force_rebuild), p_buf, p_buf_end);
644-
645-
p_buf = buf_put(&s->force_dta_rebuild, sizeof(s->force_dta_rebuild), p_buf,
646-
p_buf_end);
647-
648-
p_buf = buf_put(&s->force_blob_rebuild, sizeof(s->force_blob_rebuild),
649-
p_buf, p_buf_end);
650-
651-
p_buf = buf_put(&s->force, sizeof(s->force), p_buf, p_buf_end);
652-
653-
p_buf = buf_put(&s->headers, sizeof(s->headers), p_buf, p_buf_end);
654-
655-
p_buf =
656-
buf_put(&s->header_change, sizeof(s->header_change), p_buf, p_buf_end);
657-
658-
p_buf = buf_put(&s->compress, sizeof(s->compress), p_buf, p_buf_end);
659-
660-
p_buf = buf_put(&s->compress_blobs, sizeof(s->compress_blobs), p_buf,
661-
p_buf_end);
662-
663-
p_buf = buf_put(&s->persistent_seq, sizeof(s->persistent_seq), p_buf,
664-
p_buf_end);
665-
666-
p_buf = buf_put(&s->ip_updates, sizeof(s->ip_updates), p_buf, p_buf_end);
667-
668-
p_buf = buf_put(&s->instant_sc, sizeof(s->instant_sc), p_buf, p_buf_end);
669-
670-
p_buf = buf_put(&s->preempted, sizeof(s->preempted), p_buf, p_buf_end);
671-
672-
p_buf = buf_put(&s->use_plan, sizeof(s->use_plan), p_buf, p_buf_end);
673-
674-
p_buf =
675-
buf_put(&s->commit_sleep, sizeof(s->commit_sleep), p_buf, p_buf_end);
676-
677-
p_buf =
678-
buf_put(&s->convert_sleep, sizeof(s->convert_sleep), p_buf, p_buf_end);
679-
680-
p_buf = buf_put(&s->same_schema, sizeof(s->same_schema), p_buf, p_buf_end);
681-
682-
p_buf = buf_put(&s->dbnum, sizeof(s->dbnum), p_buf, p_buf_end);
683-
684-
p_buf = buf_put(&s->flg, sizeof(s->flg), p_buf, p_buf_end);
685-
686-
p_buf =
687-
buf_put(&s->rebuild_index, sizeof(s->rebuild_index), p_buf, p_buf_end);
688-
689-
p_buf = buf_put(&s->index_to_rebuild, sizeof(s->index_to_rebuild), p_buf,
690-
p_buf_end);
691-
692-
p_buf = buf_put(&s->source_node, sizeof(s->source_node), p_buf, p_buf_end);
693-
694-
p_buf = buf_put_dests(s, p_buf, p_buf_end);
695-
696-
p_buf = buf_put(&s->spname_len, sizeof(s->spname_len), p_buf, p_buf_end);
697-
p_buf = buf_no_net_put(s->spname, s->spname_len, p_buf, p_buf_end);
698-
p_buf = buf_put(&s->lua_func_flags, sizeof(s->lua_func_flags), p_buf, p_buf_end);
699-
700-
p_buf = buf_no_net_put(s->newtable, sizeof(s->newtable), p_buf, p_buf_end);
701-
p_buf = buf_put(&s->usedbtablevers, sizeof(s->usedbtablevers), p_buf,
702-
p_buf_end);
703-
704-
p_buf = buf_put(&s->qdb_file_ver, sizeof(s->qdb_file_ver), p_buf, p_buf_end);
705-
706-
p_buf = buf_put(&s->partition.type, sizeof(s->partition.type), p_buf,
707-
p_buf_end);
708-
switch (s->partition.type) {
709-
case PARTITION_ADD_TIMED:
710-
case PARTITION_ADD_MANUAL: {
711-
p_buf = buf_put(&s->partition.u.tpt.period,
712-
sizeof(s->partition.u.tpt.period), p_buf, p_buf_end);
713-
p_buf = buf_put(&s->partition.u.tpt.retention,
714-
sizeof(s->partition.u.tpt.retention), p_buf, p_buf_end);
715-
p_buf = buf_put(&s->partition.u.tpt.start,
716-
sizeof(s->partition.u.tpt.start), p_buf, p_buf_end);
717-
break;
718-
}
719-
case PARTITION_MERGE: {
720-
p_buf = buf_no_net_put(s->partition.u.mergetable.tablename,
721-
sizeof(s->partition.u.mergetable.tablename), p_buf, p_buf_end);
722-
p_buf = buf_put(&s->partition.u.mergetable.version,
723-
sizeof(s->partition.u.mergetable.version), p_buf, p_buf_end);
724-
break;
725-
}
726-
case PARTITION_ADD_GENSHARD: {
727-
p_buf = buf_no_net_put(s->partition.u.genshard.tablename,
728-
sizeof(s->partition.u.genshard.tablename), p_buf, p_buf_end);
729-
p_buf = buf_put(&s->partition.u.genshard.numdbs,
730-
sizeof(s->partition.u.genshard.numdbs), p_buf, p_buf_end);
731-
for (int i = 0; i < s->partition.u.genshard.numdbs; i++) {
732-
p_buf = buf_no_net_put(s->partition.u.genshard.dbnames[i],
733-
strlen(s->partition.u.genshard.dbnames[i]) + 1, p_buf, p_buf_end);
734-
}
735-
p_buf = buf_put(&s->partition.u.genshard.numcols,
736-
sizeof(s->partition.u.genshard.numcols), p_buf, p_buf_end);
737-
for (int i = 0; i < s->partition.u.genshard.numcols; i++) {
738-
p_buf = buf_no_net_put(s->partition.u.genshard.columns[i],
739-
strlen(s->partition.u.genshard.columns[i]) + 1, p_buf, p_buf_end);
740-
}
741-
for (int i = 0; i < s->partition.u.genshard.numdbs; i++) {
742-
p_buf = buf_no_net_put(s->partition.u.genshard.shardnames[i],
743-
strlen(s->partition.u.genshard.shardnames[i]) + 1, p_buf, p_buf_end);
744-
}
745-
break;
746-
}
747-
case PARTITION_REM_GENSHARD: {
748-
}
749-
}
750-
751-
p_buf = buf_put(&s->preserve_oplog_count, sizeof(s->preserve_oplog_count), p_buf, p_buf_end);
752-
return p_buf;
753-
}
754-
755496
static const void *buf_get_dests(struct schema_change_type *s,
756497
const void *p_buf, void *p_buf_end)
757498
{

schemachange/schemachange.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ typedef struct sc_list sc_list_t;
425425
*/
426426
int sc_list_create(sc_list_t *scl, void *vscs, uuid_t uuid);
427427

428-
size_t schemachange_packed_size(struct schema_change_type *s);
429428
int start_schema_change_tran(struct ireq *, tran_type *tran);
430429
int start_schema_change(struct schema_change_type *);
431430
int create_queue(struct dbenv *, char *queuename, int avgitem, int pagesize);
@@ -465,10 +464,7 @@ void free_schema_change_type(struct schema_change_type *s);
465464
int pack_schema_change_protobuf(struct schema_change_type *s, void **packed_sc, size_t *packed_len);
466465
int unpack_schema_change_protobuf(struct schema_change_type *s, void *packed_sc, size_t *plen);
467466

468-
void *buf_put_schemachange(struct schema_change_type *s, void *p_buf, void *p_buf_end);
469467
void *buf_get_schemachange(struct schema_change_type *s, void *p_buf, void *p_buf_end);
470-
471-
void *buf_put_schemachange_protobuf(struct schema_change_type *s, void *p_buf, void *p_buf_end);
472468
void *buf_get_schemachange_protobuf(struct schema_change_type *s, void *p_buf, void *p_buf_end);
473469
void *buf_get_schemachange_v1(struct schema_change_type *s, void *p_buf, void *p_buf_end);
474470
void *buf_get_schemachange_v2(struct schema_change_type *s, void *p_buf,

0 commit comments

Comments
 (0)