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
33 changes: 0 additions & 33 deletions .eslintrc

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '22'
cache: 'yarn'
- run: sudo apt-get update -q
# Ubuntu 24.04 doesn't have libssl1.1 which is needed by mongo-memory-server
Expand All @@ -73,7 +73,7 @@ jobs:
- run: yarn --silent test:unit
- run: yarn --silent test:functional
env:
MONGODB_REPLICASET: "localhost:27018"
MONGODB_REPLICASET: "127.0.0.1:27018"
- name: "Debug: SSH to runner"
uses: scality/actions/action-ssh-to-runner@1.9.0
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion CRR/ReplicationStatusUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class ReplicationStatusUpdater {
});
},
),
() => {
async () => {
if (this._nUpdated >= this.maxUpdates || this._nProcessed >= this.maxScanned) {
this._logProgress();
let remainingBuckets;
Expand Down
12 changes: 6 additions & 6 deletions CompareRaftMembers/BlockDigestsStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BlockDigestsStorage extends stream.Writable {
constructor(params) {
super({ objectMode: true });
const { levelPath, db } = params;
if (params.levelPath) {
if (levelPath) {
this.db = new Level(params.levelPath);
} else {
this.db = db;
Expand All @@ -38,16 +38,16 @@ class BlockDigestsStorage extends stream.Writable {
}

_write(blockInfo, encoding, callback) {
const { size, digest } = blockInfo;
const { size, digest, lastKey } = blockInfo;
this.cargo.push({
type: 'put',
key: blockInfo.lastKey, // index by last block key for efficient lookup
key: lastKey, // index by last block key for efficient lookup
value: JSON.stringify({ size, digest }),
});
// heuristic to have basic flow control: delay the callback
// while queue size is above a reasonable size
async.whilst(
() => this.cargo.length() > MAX_QUEUE_SIZE,
async () => this.cargo.length() > MAX_QUEUE_SIZE,
cb => setTimeout(cb, 100),
() => callback(),
);
Expand All @@ -57,9 +57,9 @@ class BlockDigestsStorage extends stream.Writable {
if (this.cargo.idle()) {
this.db.close(callback);
} else {
this.cargo.drain = () => {
this.cargo.drain(() => {
this.db.close(callback);
};
});
}
}
}
Expand Down
16 changes: 11 additions & 5 deletions CountItems/CountManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ class CountManager {
}));
this.store.buckets += bucketCount;
this.store.bucketList = this.store.bucketList.concat(transformedInfos);
this.q.push(bucketInfos);
bucketInfos.forEach(bucketInfo => {
this.q.push(bucketInfo);
});
this.log.debug('added work', {
workInQueue: this.q.length(),
workInProgress: this.q.running(),
Expand All @@ -195,18 +197,22 @@ class CountManager {
Object.values(this.workers)
.forEach(worker => this.workerList.push(worker.id));
}
this.q.error = err => {
this.q.error(err => {
this.log.error('error processing bucket', {
error: err,
method: 'CountManager::addWork',
});
this.q.pause();
this.q.kill();
return process.nextTick(onceCB, err);
};
this.q.drain = () => {
});
this.q.drain(() => {
if (this.q.idle()) {
this.q.pause();
this.q.kill();
process.nextTick(onceCB);
}
};
});
this.q.resume();
}
}
Expand Down
2 changes: 1 addition & 1 deletion CountItems/CountWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CountWorker {
if (bucketInfoObj._websiteConfiguration) {
Object.assign(bucketInfoObj, { _websiteConfiguration: null });
}
const bucketInfo = BucketInfo.fromObj(bucketInfoObj);
const bucketInfo = BucketInfo.fromObj(bucketInfoObj.bucketInfo || bucketInfoObj);
const bucketName = bucketInfo.getName();
this.log.info(`${process.pid} handling ${bucketName}`);
return async.waterfall([
Expand Down
20 changes: 13 additions & 7 deletions CountItems/CountWorkerObj.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const uuid = require('node-uuid');
const { v4: uuid } = require('uuid');
const { once } = require('arsenal').jsutil;
const { deserializeBigInts, serializeBigInts } = require('./utils/utils');

Expand All @@ -21,9 +21,13 @@ class CountWorkerObj {
}
});
this._worker.on('message', data => {
if (data.owner !== 'scality') return;
if (data.owner !== 'scality') {
return;
}
const cb = this._getCallback(data.id);
if (!cb) return;
if (!cb) {
return;
}
switch (data.type) {
case 'setup':
if (data.status === 'passed') {
Expand Down Expand Up @@ -81,7 +85,9 @@ class CountWorkerObj {
}

_getCallback(id) {
if (!this.callbacks.has(id)) return null;
if (!this.callbacks.has(id)) {
return null;
}
const ret = this.callbacks.get(id);
this.callbacks.delete(id);
return ret.callback;
Expand All @@ -95,7 +101,7 @@ class CountWorkerObj {
}

setup(callback) {
const id = uuid.v4();
const id = uuid();
this._addCallback(id, 'setup', callback);
this._worker.send({
id,
Expand All @@ -108,7 +114,7 @@ class CountWorkerObj {
if (!this.clientConnected || !this._worker.isConnected()) {
return callback();
}
const id = uuid.v4();
const id = uuid();
this._addCallback(id, 'teardown', callback);
return this._worker.send({
id,
Expand All @@ -118,7 +124,7 @@ class CountWorkerObj {
}

count(bucketInfo, callback) {
const id = uuid.v4();
const id = uuid();
this._addCallback(id, 'count', (err, results) => {
if (err) {
return callback(err);
Expand Down
4 changes: 3 additions & 1 deletion CountItems/utils/createWorkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ const cluster = require('cluster');
const CountWorkerObj = require('../CountWorkerObj');

function createWorkers(numWorkers) {
if (!cluster.isMaster) return {};
if (!cluster.isMaster) {
return {};
}
const workers = {};
for (let i = 0; i < numWorkers; ++i) {
const worker = cluster.fork(process.env);
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=16.20.2-bullseye-slim
ARG NODE_VERSION=22.15.0-bookworm-slim

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, the image includes python, for the scripts in the utapi folder (c.f. https://scality.atlassian.net/browse/S3UTILS-172)

With the upgrade, a newer version of python will be used: so we need to check that the scripts still work (or find a way to remove them and drop python from the image, i.e. move forward with s3utils-172...)

Copy link
Contributor

@francoisferrand francoisferrand Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is now 22.15.0-bookworm-slim, should we use it?
or just "plan" a global bump from 22.14 to 22.15 ?

# Use separate builder to retrieve & build node modules
FROM node:${NODE_VERSION} AS builder
Expand Down Expand Up @@ -34,6 +34,7 @@ RUN apt-get update && \
jq \
python3 \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*

ENV BALLOT_VERSION 1.0.4
Expand All @@ -48,6 +49,8 @@ COPY --from=builder /usr/src/app/supervisord /usr/local/bin/
ENV NO_PROXY localhost,127.0.0.1
ENV no_proxy localhost,127.0.0.1

RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install -r utapi/requirements.txt

## This section duplicates S3C Federation Dockerfile, this needs to be refactored
Expand Down
13 changes: 8 additions & 5 deletions StalledRetry/StalledRequestHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class StalledRequestHandler {
}

queueSetup() {
this._queue = async.queue(({ bucket, batch, getNext }, done) => {
this._queue = async.queue((task, done) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the change? is it not working anymore, or flagged by eslint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not working anymore with the async bump

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is weird, should be purely a node "syntax" thing, unrelated to async :-/

const { bucket, batch, getNext } = task;

if (this.queueError !== null) {
return done();
}
Expand All @@ -42,15 +44,16 @@ class StalledRequestHandler {
});
}, this.concurrentRequests);

this._queue.error = (err, { bucket, batch }) => {
this._queue.error((err, task) => {
const { bucket, batch } = task;
this.log.error('error occurred while processing request', {
error: err,
lastBatch: batch,
bucket,
});
this.queueError = err;
this.kill();
};
});
}

isInProgress() {
Expand All @@ -68,7 +71,7 @@ class StalledRequestHandler {

_waitForCompletion(cb) {
async.whilst(
() => (!this.killed && this.isInProgress()),
async () => (!this.killed && this.isInProgress()),
done => setTimeout(done, 1000),
cb,
);
Expand Down Expand Up @@ -110,7 +113,7 @@ class StalledRequestHandler {

return async.times(
this.concurrentRequests,
(_, cb) => nextBatch(cb),
(n, next) => nextBatch(next),
err => {
if (err) {
this.log.error('failed to populate queue', {
Expand Down
2 changes: 0 additions & 2 deletions VerifyReplication/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-console */

const { Logger } = require('werelogs');

const { defaults, mandatoryVars } = require('./constants');
Expand Down
2 changes: 0 additions & 2 deletions VerifyReplication/storage/s3.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-console */

const AWS = require('aws-sdk');
const fs = require('fs');
const http = require('http');
Expand Down
1 change: 0 additions & 1 deletion VerifyReplication/verifyReplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ function handlePrefixes(prefixList, cb) {
prefix,
listingLimit,
};
// eslint-disable-next-line no-use-before-define
return listAndCompare(params, done);
}, cb);
}
Expand Down
13 changes: 4 additions & 9 deletions compareBuckets/compareBuckets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* eslint-disable max-len */
/* eslint-disable no-console */
/* eslint-disable comma-dangle */

const async = require('async');

const { listBucketMasterKeys } = require('./utils');
Expand Down Expand Up @@ -91,14 +87,13 @@ function compareBuckets(params, log, cb) {
if (srcDone || srcContents.length > 0) {
return process.nextTick(_done);
}

return listBucketMasterKeys(
bucketdSrcParams,
(err, isTruncated, marker, contents) => {
if (err) {
log.error('Error fetching src bucket', { error: err });
return _done(err);
}

srcContents = contents;
srcDone = !isTruncated;
bucketdSrcParams.marker = marker;
Expand All @@ -116,9 +111,9 @@ function compareBuckets(params, log, cb) {
bucketdDstParams,
(err, isTruncated, marker, contents) => {
if (err) {
log.error('Error fetching dst bucket', { error: err });
return _done(err);
}

dstContents = contents;
dstDone = !isTruncated;
bucketdDstParams.marker = marker;
Expand All @@ -129,6 +124,7 @@ function compareBuckets(params, log, cb) {
},
}, err => {
if (err) {
log.error('Parallel fetch error', { error: err });
return done(err);
}

Expand Down Expand Up @@ -224,15 +220,14 @@ function compareBuckets(params, log, cb) {
return process.nextTick(() => done(null));
});
},
() => (!srcDone || !dstDone || srcContents.length > 0 || dstContents.length > 0),
async () => (!srcDone || !dstDone || srcContents.length > 0 || dstContents.length > 0),
err => {
statusObj.dstBucketInProgress = null;
statusObj.srcBucketInProgress = null;
cb(err);
}
);
}

module.exports = {
compareBuckets,
compareObjectsReport,
Expand Down
2 changes: 0 additions & 2 deletions compareBuckets/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* eslint-disable max-len */
/* eslint-disable no-console */
/* eslint-disable comma-dangle */

const { Logger } = require('werelogs');

Expand Down
Loading
Loading