Skip to content

Commit

Permalink
[#23858] build: fix ./yb_build.sh release --gcc11
Browse files Browse the repository at this point in the history
Summary:
Fix various compilation issues with this build configuration:

ybtidbitmap.h:

    ../../../../../../../src/postgres/src/include/nodes/ybtidbitmap.h:49:9: error: ‘unused’ attribute ignored [-Werror=attributes]
       49 |         YbTBMIteratingState iterating PG_USED_FOR_ASSERTS_ONLY;
          |         ^~~~~~~~~~~~~~~~~~~

pg_client_session.cc:

    ../../src/yb/common/schema.h: In member function ‘yb::Status yb::tserver::PgClientSession::AlterTable(const yb::tserver::PgAlterTableRequestPB&, yb::tserver::PgAlterTableResponsePB*, yb::rpc::RpcContext*)’:
    ../../src/yb/common/schema.h:475:28: error: ‘replica_identity’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      475 |     ysql_replica_identity_ = replica_identity;
          |     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
    ../../src/yb/tserver/pg_client_session.cc:818:23: note: ‘replica_identity’ was declared here
      818 |     PgReplicaIdentity replica_identity;
          |                       ^~~~~~~~~~~~~~~~

cron.c:

    ../../src/odyssey/sources/cron.c: In function ‘od_cron_stat_cb’:
    ../../src/odyssey/sources/cron.c:67:25: error: ‘strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation]
       67 |                         strncpy(instance->yb_stats[index].user_name,
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       68 |                                 route->id.user, USER_NAME_MAX_LEN);
          |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../src/odyssey/sources/cron.c:67:25: error: ‘strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation]
    ../../src/odyssey/sources/cron.c:67:25: error: ‘strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation]

yb-admin-snapshot-schedule-test.cc:

    ../../src/yb/tools/yb-admin-snapshot-schedule-test.cc: In lambda function:
    ../../src/yb/tools/yb-admin-snapshot-schedule-test.cc:269:56: error: ‘state’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      269 |       return state == master::SysCloneStatePB::ABORTED ||
          |                                                        ^~
    In file included from ../../src/yb/util/result.h:23,
                     from ../../src/yb/util/enums.h:32,
                     from ../../src/yb/cdc/cdc_types.h:25,
                     from ../../src/yb/client/client_fwd.h:26,
                     from ../../src/yb/tools/yb-admin-snapshot-schedule-test.cc:24:
    ../../src/yb/tools/yb-admin-snapshot-schedule-test.cc:266:38: note: ‘state’ was declared here
      266 |       master::SysCloneStatePB::State state;
          |                                      ^~~~~

The cron.c change is an improvement.  The ybtidbitmap.h change is not
desirable (it should be reverted if future compiler versions are
smarter).  The remaining changes are not logically necessary either, but
they had to be changed because this build configuration complains.
Jira: DB-12765

Test Plan:
    ./yb_build.sh release --gcc11

Close: #23858
Jenkins: compile only

Reviewers: telgersma

Reviewed By: telgersma

Subscribers: telgersma, yql, ybase

Differential Revision: https://phorge.dev.yugabyte.com/D37829
  • Loading branch information
jaki committed Sep 10, 2024
1 parent 7e40d89 commit aa41478
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/odyssey/sources/cron.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ static int od_cron_stat_cb(od_route_t *route, od_stat_t *current,
}

index = route->id.yb_stats_index;
strncpy(instance->yb_stats[index].database_name,
memcpy(instance->yb_stats[index].database_name,
(char *)route->yb_database_entry->name,
DB_NAME_MAX_LEN);
strncpy(instance->yb_stats[index].user_name,
memcpy(instance->yb_stats[index].user_name,
route->id.user, USER_NAME_MAX_LEN);
}

Expand Down
2 changes: 1 addition & 1 deletion src/postgres/src/include/nodes/ybtidbitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ typedef struct YbTIDBitmap
NodeTag type; /* to make it a valid Node */
SliceSet ybctid_set; /* C++ set that contains my ybctids */
int nentries; /* number of entries in the bitmap */
YbTBMIteratingState iterating PG_USED_FOR_ASSERTS_ONLY;
YbTBMIteratingState iterating;
/* yb_tbm_begin_iterate called? */
size_t bytes_consumed; /* sum of the size of the ybctids */
bool work_mem_exceeded; /* if bytes_consumed exceeds work_mem */
Expand Down
2 changes: 1 addition & 1 deletion src/yb/tools/yb-admin-snapshot-schedule-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class YbAdminSnapshotScheduleTest : public AdminTestBase {
CallJsonAdmin("list_clones", source_namespace_id, seq_no));
const auto entries = out.GetArray();
SCHECK_EQ(entries.Size(), 1, IllegalState, "Wrong number of entries. Expected 1");
master::SysCloneStatePB::State state;
master::SysCloneStatePB::State state = master::SysCloneStatePB::CLONE_SCHEMA_STARTED;
master::SysCloneStatePB::State_Parse(
std::string(VERIFY_RESULT(GetMemberAsStr(entries[0], "aggregate_state"))), &state);
return state == master::SysCloneStatePB::ABORTED ||
Expand Down
2 changes: 1 addition & 1 deletion src/yb/tserver/pg_client_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ Status PgClientSession::AlterTable(
client::YBTablePtr yb_table;
RETURN_NOT_OK(GetTable(table_id, &table_cache_, &yb_table));
auto table_properties = yb_table->schema().table_properties();
PgReplicaIdentity replica_identity;
PgReplicaIdentity replica_identity = PgReplicaIdentity::DEFAULT;
RETURN_NOT_OK(
GetReplicaIdentityEnumValue(req.replica_identity().replica_identity(), &replica_identity));
table_properties.SetReplicaIdentity(replica_identity);
Expand Down

0 comments on commit aa41478

Please sign in to comment.