Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/alerts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v7

- name: Render and test count-items-cronjob
uses: scality/action-prom-render-test@1.0.3
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v7

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4

- name: Install Oras
run: |
Expand All @@ -33,7 +33,7 @@ jobs:
ORAS_VERSION: 1.2.2

- name: Login to Registry
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -54,7 +54,7 @@ jobs:
working-directory: monitoring

- name: Build and push
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
uses: actions/checkout@v7

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: javascript, python

- name: Build and analyze
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4
11 changes: 2 additions & 9 deletions .github/workflows/dependency-review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v5
uses: actions/checkout@v7

- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
with:
# aws-sdk v2 is intentionally used as a devDependency because the
# fix-missing-replication-permissions script runs inside the vault
# container of older S3C versions (pre-9.5.2) where only v2 is
# available. This low-severity advisory is informational (no patch
# exists, v2 is end-of-life).
allow-ghsas: GHSA-j965-2qgj-vjmq
uses: actions/dependency-review-action@v5.0.0
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- build
steps:
- name: Create Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ jobs:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v7

- name: Set up Docker Buildk
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4

- name: Login to Registry
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Build and push MongoDB
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
push: true
context: .github/dockerfiles/mongodb
Expand All @@ -54,16 +54,16 @@ jobs:
- 27019:27019
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v7
- name: Install node
uses: actions/setup-node@v4
uses: actions/setup-node@v7
with:
node-version: '24'
cache: 'yarn'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4
- name: Login to Registry
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -86,11 +86,11 @@ jobs:
env:
MONGODB_REPLICASET: "127.0.0.1:27018"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: "Debug: SSH to runner"
uses: scality/actions/action-ssh-to-runner@1.9.0
uses: scality/actions/action-ssh-to-runner@1.19.0
continue-on-error: true
with:
tmate-server-host: ${{ secrets.TMATE_SERVER_HOST }}
Expand All @@ -103,9 +103,9 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v7
with:
go-version: '1.24'
cache-dependency-path: BackupRepair/go.mod
Expand Down
2 changes: 1 addition & 1 deletion Clients/CloudserverClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Client {

const requestHandler = {
connectionTimeout: 60000,
requestTimeout: 60000,
socketTimeout: 60000,
};
if (isHttps) {
requestHandler.httpsAgent = httpAgent;
Expand Down
4 changes: 2 additions & 2 deletions Clients/s3Client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { S3Client } = require('@aws-sdk/client-s3');
const { NodeHttpHandler } = require('@aws-sdk/node-http-handler');
const { NodeHttpHandler } = require('@smithy/node-http-handler');
const { ConfiguredRetryStrategy } = require('@smithy/util-retry');
const http = require('http');
const https = require('https');
Expand Down Expand Up @@ -39,7 +39,7 @@ const createS3Client = ({ accessKey, secretKey, endpoint }, log) => {
// so https will work but there will be no security enforced
rejectUnauthorized: false
}),
requestTimeout: 60000,
socketTimeout: 60000,
}),
retryStrategy: new ConfiguredRetryStrategy(
AWS_SDK_REQUEST_RETRIES, // maxAttempts
Expand Down
12 changes: 6 additions & 6 deletions CompareRaftMembers/BlockDigestsStorage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const async = require('async');
const stream = require('stream');

const Level = require('level');
const { ClassicLevel } = require('classic-level');

const MAX_BATCH_SIZE = 100;
const MAX_QUEUE_SIZE = 1000;
Expand All @@ -21,19 +21,19 @@ class BlockDigestsStorage extends stream.Writable {
* @param {string} [params.levelPath] - path to LevelDB database
* to write to
* @param {string} [params.db] - custom db object, must contain
* the methods "batch" and "close" following levelup's API -
* the promise-based methods "batch" and "close" of classic-level -
* currently used for unit tests
*/
constructor(params) {
super({ objectMode: true });
const { levelPath, db } = params;
if (levelPath) {
this.db = new Level(params.levelPath);
this.db = new ClassicLevel(params.levelPath);
} else {
this.db = db;
}
this.cargo = async.cargo((tasks, cb) => {
this.db.batch(tasks, cb);
this.db.batch(tasks).then(() => cb(), cb);
}, MAX_BATCH_SIZE);
}

Expand All @@ -55,10 +55,10 @@ class BlockDigestsStorage extends stream.Writable {

_final(callback) {
if (this.cargo.idle()) {
this.db.close(callback);
this.db.close().then(() => callback(), callback);
} else {
this.cargo.drain(() => {
this.db.close(callback);
this.db.close().then(() => callback(), callback);
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion CompareRaftMembers/DiffStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const stream = require('stream');

const BucketStream = require('./BucketStream');
const BlockDigestsStream = require('./BlockDigestsStream');
const levelReadStream = require('./levelReadStream');

/**
* Output differences between the input stream, consisting of
Expand Down Expand Up @@ -386,7 +387,7 @@ class DiffStream extends stream.Transform {
* @return {undefined}
*/
_createDigestsDbStream(fromItem) {
this.currentDbDigestsStream = this.digestsDb.createReadStream({
this.currentDbDigestsStream = levelReadStream(this.digestsDb, {
gte: fromItem.fullKey,
// '0' is the ASCII character following '/': this restricts
// the digest's lastKey to be from the current bucket
Expand Down
71 changes: 50 additions & 21 deletions CompareRaftMembers/compareFollowerDbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ const fs = require('fs');
const path = require('path');
const stream = require('stream');

const { jsutil } = require('@scality/arsenal');
const { Logger } = require('werelogs');
const Level = require('level');
const { ClassicLevel } = require('classic-level');

const DBListStream = require('./DBListStream');
const DiffStreamOplogFilter = require('./DiffStreamOplogFilter');
const KeyValueStreamDiff = require('./KeyValueStreamDiff');
const levelReadStream = require('./levelReadStream');

const DEFAULT_PARALLEL_SCANS = 4;
const DEFAULT_LOG_PROGRESS_INTERVAL = 10;
Expand Down Expand Up @@ -197,16 +199,36 @@ if (EXCLUDE_FROM_CSEQS) {
.pipe(DIFF_OUTPUT_STREAM);
}

function compareDbs(dbPair, cb) {
log.info(
'starting comparison of pair of databases',
{ db1: dbPair[0], db2: dbPair[1] },
);
const dbListStreams = dbPair.map(dbPath => {
const db = new Level(dbPath);
const dbRawStream = db.createReadStream();
// classic-level opens lazily: open explicitly so that a missing database fails the scan
function openDb(dbPath, cb) {
const db = new ClassicLevel(dbPath, { createIfMissing: false });
db.open().then(() => cb(null, db), err => {
log.error('unable to open database', { dbPath, error: (err.cause || err).message });
cb(err);
});
}

function streamDbsDiff(dbs, dbPair, cb) {
// .pipe() does not forward errors: report the first one from any stream
const done = jsutil.once(err => {
if (err) {
log.error(
'error during comparison of database pair',
{ db1: dbPair[0], db2: dbPair[1], error: err.message },
);
} else {
log.info('completed scan of database pair', { db1: dbPair[0], db2: dbPair[1] });
}
cb(err);
});
const dbListStreams = dbs.map((db, i) => {
const dbPath = dbPair[i];
const dbRawStream = levelReadStream(db);
const dbListStream = new DBListStream({ dbName: path.basename(dbPath) });
dbRawStream.pipe(dbListStream);
dbRawStream
.on('error', done)
.pipe(dbListStream)
.on('error', done);
return dbListStream;
});
dbListStreams[0]
Expand All @@ -224,17 +246,24 @@ function compareDbs(dbPair, cb) {
});
}
})
.on('end', () => {
log.info('completed scan of database pair', { db1: dbPair[0], db2: dbPair[1] });
cb();
})
.on('error', err => {
log.error(
'error from diff stream',
{ db1: dbPair[0], db2: dbPair[1], error: err.message },
);
cb(err);
});
.on('end', () => done())
.on('error', done);
}

function compareDbs(dbPair, cb) {
log.info(
'starting comparison of pair of databases',
{ db1: dbPair[0], db2: dbPair[1] },
);
async.map(dbPair, openDb, (err, dbs) => {
if (err) {
return cb(err);
}
return streamDbsDiff(dbs, dbPair, streamErr => Promise.all(dbs.map(db => db.close())).then(
() => cb(streamErr),
closeErr => cb(streamErr || closeErr),
));
});
}

function main() {
Expand Down
Loading
Loading