Skip to content

Commit 5fd546a

Browse files
authored
Merge branch 'main' into allow_old_authn
2 parents 91ebc98 + a170467 commit 5fd546a

File tree

105 files changed

+3448
-1245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+3448
-1245
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
# is built to avoid wasting runner minutes. Treat "main" as an exception,
1818
# probably best to test all commits to it.
1919
concurrency:
20-
group: ${{ github.ref }}
20+
group: ${{ github.workflow }}-pr-${{ github.event.pull_request.number || github.run_id }}
2121
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
2222

2323
# We can have multiple jobs. Jobs run in parallel unless they explicitly declare

.github/workflows/clang-format.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: clang-format
2+
3+
on:
4+
pull_request: { branches: ["main"] }
5+
6+
# If someone pushes a new commit to a branch, ensure that only the latest commit
7+
# is built to avoid wasting runner minutes.
8+
concurrency:
9+
group: ${{ github.workflow }}-pr-${{ github.event.pull_request.number || github.run_id }}
10+
cancel-in-progress: true
11+
12+
13+
jobs:
14+
clang-format:
15+
runs-on: ubuntu-latest
16+
continue-on-error: true
17+
env:
18+
CLANG_FORMAT: "clang-format"
19+
defaults:
20+
run:
21+
# Make sure to fail any "run" step early on so that steps don't silently
22+
# pass even when errors may have occurred.
23+
shell: bash -o errexit -o nounset -o pipefail {0}
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
with: { fetch-depth: 0 }
28+
29+
- name: Install clang-format
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y clang-format
33+
$CLANG_FORMAT --version
34+
35+
- name: Run format check
36+
run: |
37+
base_repo="${{ github.event.pull_request.base.repo.full_name || github.repository }}"
38+
base_url="https://github.com/${base_repo}.git"
39+
40+
# Fetch the base branch into a unique namespace
41+
git fetch --no-tags --prune --depth=1 "${base_url}" \
42+
"refs/heads/${GITHUB_BASE_REF}:refs/remotes/__base__/${GITHUB_BASE_REF}"
43+
44+
# Compute merge-base vs the fetched ref
45+
base_commit="$(git merge-base HEAD "refs/remotes/__base__/${GITHUB_BASE_REF}")"
46+
47+
./ci/scripts/format --verbose --dry-run --compare-base "${base_commit}"

bbinc/hostname_support.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
char *get_hostname_by_fileno(int);
2121
int get_hostname_by_fileno_v2(int, char *, size_t);
22+
char *get_cached_hostname_by_addr(struct sockaddr_in *saddr);
2223

2324
#ifndef DISABLE_HOSTADDR_CACHE
2425
void init_peer_hash(void);

bbinc/sbuf2.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ enum SBUF2_FLAGS {
5959
SBUF2_NO_BLOCK = 16,
6060
/* the underlying connection has been marked 'READONLY' */
6161
SBUF2_IS_READONLY = 32,
62+
/* do not close ssl */
63+
SBUF2_NO_SSL_CLOSE = 64,
6264
};
6365

6466
typedef int (*sbuf2readfn)(SBUF2 *sb, char *buf, int nbytes);

bdb/bdb_api.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,6 +1995,7 @@ int bdb_flush_up_to_lsn(bdb_state_type *bdb_state, unsigned file,
19951995
int bdb_set_parallel_recovery_threads(bdb_state_type *bdb_state, int nthreads);
19961996
unsigned long long bdb_get_commit_genid(bdb_state_type *bdb_state, void *plsn);
19971997
void bdb_set_commit_lsn_gen(bdb_state_type *bdb_state, const void *lsn, uint32_t gen);
1998+
unsigned long long prev_genid(bdb_state_type *bdb_state, unsigned long long genid);
19981999
unsigned long long bdb_get_commit_genid_generation(bdb_state_type *bdb_state,
19992000
void *plsn,
20002001
uint32_t *generation);

bdb/bdb_int.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,8 @@ int bdb_get_active_logical_transaction_lsns(bdb_state_type *bdb_state,
16171617

16181618
unsigned long long get_lowest_genid_for_datafile(int file);
16191619

1620+
unsigned long long format_genid_for_stripe(unsigned long long genid, int stripe);
1621+
16201622
uint32_t bdb_get_lid_from_cursortran(cursor_tran_t *curtran);
16211623

16221624
DBC *get_cursor_for_cursortran_flags(cursor_tran_t *curtran, DB *db,

bdb/genid.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,44 @@ static unsigned long long commit_genid;
7373
static DB_LSN commit_lsn;
7474
static uint32_t commit_generation;
7575

76+
static inline unsigned long long prev_genid_timebased(unsigned long long genid)
77+
{
78+
unsigned int *iptr = (unsigned int *)&genid;
79+
unsigned int epoch = ntohl(iptr[0]);
80+
unsigned short *sptr = (unsigned short *)&genid;
81+
unsigned int dupecount = ntohs(sptr[2]);
82+
83+
if (dupecount > 1) {
84+
dupecount--;
85+
} else {
86+
epoch--;
87+
dupecount = 0xffff;
88+
}
89+
90+
iptr[0] = htonl(epoch);
91+
iptr[1] = htonl(dupecount << 16);
92+
return genid;
93+
}
94+
95+
static inline unsigned long long prev_genid48(unsigned long long genid)
96+
{
97+
unsigned long long seed = (flibc_ntohll(genid >> 16) - 1);
98+
return flibc_htonll((seed << 16));
99+
}
100+
101+
unsigned long long prev_genid(bdb_state_type *bdb_state, unsigned long long genid)
102+
{
103+
return (bdb_state->genid_format == LLMETA_GENID_48BIT) ? prev_genid48(genid) : prev_genid_timebased(genid);
104+
}
105+
106+
unsigned long long format_genid_for_stripe(unsigned long long genid, int stripe)
107+
{
108+
unsigned long long s = stripe;
109+
genid &= ~(GENID_STRIPE_MASK);
110+
genid |= ((s << GENID_STRIPE_SHIFT) & GENID_STRIPE_MASK);
111+
return genid;
112+
}
113+
76114
unsigned long long get_lowest_genid_for_datafile(int stripe)
77115
{
78116
unsigned long long g = stripe;

bdb/rep.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5564,8 +5564,9 @@ void *watcher_thread(void *arg)
55645564
int nrecs;
55655565
// if we're not seeing records or seeing only very old records, poke replication
55665566
// to request records in the range we expect
5567-
if (gbl_nudge_replication_when_idle && bdb_state->dbenv->get_rep_lsns(bdb_state->dbenv, &next_lsn, &gap_lsn, &nrecs) == 0) {
5568-
if (nrecs == 0 && !IS_ZERO_LSN(gap_lsn)) {
5567+
if (gbl_nudge_replication_when_idle > 0 &&
5568+
bdb_state->dbenv->get_rep_lsns(bdb_state->dbenv, &next_lsn, &gap_lsn, &nrecs) == 0) {
5569+
if (nrecs < gbl_nudge_replication_when_idle && !IS_ZERO_LSN(gap_lsn)) {
55695570
DB_LSN tmp_lsn = {0};
55705571
DBT max_lsn_dbt = {0};
55715572
LOGCOPY_TOLSN(&tmp_lsn, &gap_lsn);

0 commit comments

Comments
 (0)