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 .docker/Dockerfile.rhel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM registry.access.redhat.com/rhscl/nodejs-8-rhel7

ENV RC_VERSION 3.0.10
ENV RC_VERSION 3.0.11

MAINTAINER buildmaster@rocket.chat

Expand Down
38 changes: 38 additions & 0 deletions .github/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -40205,6 +40205,44 @@
]
}
]
},
"3.0.11": {
"node_version": "12.14.0",
"npm_version": "6.13.4",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "17132",
"title": "[FIX] Omnichannel endpoint `inquiries.getOne` returning only queued inquiries",
"userLogin": "renatobecker",
"milestone": "3.0.11",
"contributors": [
"renatobecker"
]
},
{
"pr": "17143",
"title": "[FIX] Option BYPASS_OPLOG_VALIDATION not working",
"userLogin": "rodrigok",
"milestone": "3.0.11",
"contributors": [
"rodrigok"
]
},
{
"pr": "17142",
"title": "New metric to track oplog queue",
"userLogin": "rodrigok",
"milestone": "3.0.11",
"contributors": [
"rodrigok"
]
}
]
}
}
}
28 changes: 28 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@

# 3.0.11
`2020-04-02 · 2 🐛 · 1 🔍 · 2 👩‍💻👨‍💻`

### Engine versions
- Node: `12.14.0`
- NPM: `6.13.4`
- MongoDB: `3.4, 3.6, 4.0`

### 🐛 Bug fixes


- Omnichannel endpoint `inquiries.getOne` returning only queued inquiries ([#17132](https://github.com/RocketChat/Rocket.Chat/pull/17132))

- Option BYPASS_OPLOG_VALIDATION not working ([#17143](https://github.com/RocketChat/Rocket.Chat/pull/17143))

<details>
<summary>🔍 Minor changes</summary>


- New metric to track oplog queue ([#17142](https://github.com/RocketChat/Rocket.Chat/pull/17142))

</details>

### 👩‍💻👨‍💻 Core Team 🤓

- [@renatobecker](https://github.com/renatobecker)
- [@rodrigok](https://github.com/rodrigok)

# 3.0.10
`2020-04-01 · 1 🚀 · 2 🐛 · 3 🔍 · 3 👩‍💻👨‍💻`

Expand Down
2 changes: 1 addition & 1 deletion app/livechat/server/api/lib/inquiries.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ export async function findOneInquiryByRoomId({ userId, roomId }) {
}

return {
inquiry: await LivechatInquiry.findOneQueuedByRoomId(roomId),
inquiry: await LivechatInquiry.findOneByRoomId(roomId),
};
}
6 changes: 5 additions & 1 deletion app/metrics/server/lib/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import connect from 'connect';
import _ from 'underscore';
import { Meteor } from 'meteor/meteor';

import { Info } from '../../../utils';
import { Info, getOplogInfo } from '../../../utils/server';
import { Migrations } from '../../../migrations';
import { settings } from '../../../settings';
import { Statistics } from '../../../models';
Expand Down Expand Up @@ -57,6 +57,7 @@ metrics.version = new client.Gauge({ name: 'rocketchat_version', labelNames: ['v
metrics.migration = new client.Gauge({ name: 'rocketchat_migration', help: 'migration versoin' });
metrics.instanceCount = new client.Gauge({ name: 'rocketchat_instance_count', help: 'instances running' });
metrics.oplogEnabled = new client.Gauge({ name: 'rocketchat_oplog_enabled', labelNames: ['enabled'], help: 'oplog enabled' });
metrics.oplogQueue = new client.Gauge({ name: 'rocketchat_oplog_queue', labelNames: ['queue'], help: 'oplog queue' });
metrics.oplog = new client.Counter({
name: 'rocketchat_oplog',
help: 'summary of oplog operations',
Expand Down Expand Up @@ -134,6 +135,9 @@ const setPrometheusData = async () => {
metrics.totalPrivateGroupMessages.set(statistics.totalPrivateGroupMessages, date);
metrics.totalDirectMessages.set(statistics.totalDirectMessages, date);
metrics.totalLivechatMessages.set(statistics.totalLivechatMessages, date);

const oplogQueue = getOplogInfo().mongo._oplogHandle?._entryQueue?.length || 0;
metrics.oplogQueue.set(oplogQueue, date);
};

const app = connect();
Expand Down
17 changes: 12 additions & 5 deletions app/models/server/models/_BaseDb.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { EventEmitter } from 'events';

import { Match } from 'meteor/check';
import { Mongo, MongoInternals } from 'meteor/mongo';
import { Mongo } from 'meteor/mongo';
import _ from 'underscore';

import { getMongoInfo } from '../../../utils/server/functions/getMongoInfo';

const baseName = 'rocketchat_';

const trash = new Mongo.Collection(`${ baseName }_trash`);
Expand Down Expand Up @@ -35,6 +37,8 @@ export class BaseDb extends EventEmitter {

this.wrapModel();

const { oplogEnabled, mongo } = getMongoInfo();

// When someone start listening for changes we start oplog if available
const handleListener = (event /* , listener*/) => {
if (event !== 'change') {
Expand All @@ -47,26 +51,29 @@ export class BaseDb extends EventEmitter {
collection: this.collectionName,
};

if (!MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle) {
if (!mongo._oplogHandle) {
throw new Error(`Error: Unable to find Mongodb Oplog. You must run the server with oplog enabled. Try the following:\n
1. Start your mongodb in a replicaset mode: mongod --smallfiles --oplogSize 128 --replSet rs0\n
2. Start the replicaset via mongodb shell: mongo mongo/meteor --eval "rs.initiate({ _id: ''rs0'', members: [ { _id: 0, host: ''localhost:27017'' } ]})"\n
3. Start your instance with OPLOG configuration: export MONGO_OPLOG_URL=mongodb://localhost:27017/local MONGO_URL=mongodb://localhost:27017/meteor node main.js
`);
}

MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle.onOplogEntry(
mongo._oplogHandle.onOplogEntry(
query,
this.processOplogRecord.bind(this),
);
// Meteor will handle if we have a value https://github.com/meteor/meteor/blob/5dcd0b2eb9c8bf881ffbee98bc4cb7631772c4da/packages/mongo/oplog_tailing.js#L5
if (process.env.METEOR_OPLOG_TOO_FAR_BEHIND == null) {
MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle._defineTooFarBehind(
mongo._oplogHandle._defineTooFarBehind(
Number.MAX_SAFE_INTEGER,
);
}
};
this.on('newListener', handleListener);

if (oplogEnabled) {
this.on('newListener', handleListener);
}

this.tryEnsureIndex({ _updatedAt: 1 }, options._updatedAtIndexOptions);
}
Expand Down
7 changes: 7 additions & 0 deletions app/models/server/raw/LivechatInquiry.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ export class LivechatInquiryRaw extends BaseRaw {
};
return this.findOne(query);
}

findOneByRoomId(rid) {
const query = {
rid,
};
return this.findOne(query);
}
}
2 changes: 1 addition & 1 deletion app/utils/rocketchat.info
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "3.0.10"
"version": "3.0.11"
}
20 changes: 12 additions & 8 deletions app/utils/server/functions/getMongoInfo.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { MongoInternals } from 'meteor/mongo';

export function getOplogInfo() {
const { mongo } = MongoInternals.defaultRemoteCollectionDriver();

const oplogEnabled = Boolean(mongo._oplogHandle && mongo._oplogHandle.onOplogEntry);

return { oplogEnabled, mongo };
}

function fallbackMongoInfo() {
let mongoVersion;
let mongoStorageEngine;

const { mongo } = MongoInternals.defaultRemoteCollectionDriver();

const oplogEnabled = Boolean(mongo._oplogHandle && mongo._oplogHandle.onOplogEntry);
const { oplogEnabled, mongo } = getOplogInfo();

try {
const { version } = Promise.await(mongo.db.command({ buildinfo: 1 }));
Expand All @@ -27,16 +33,14 @@ function fallbackMongoInfo() {
console.error('==================================');
}

return { oplogEnabled, mongoVersion, mongoStorageEngine };
return { oplogEnabled, mongoVersion, mongoStorageEngine, mongo };
}

export function getMongoInfo() {
let mongoVersion;
let mongoStorageEngine;

const { mongo } = MongoInternals.defaultRemoteCollectionDriver();

const oplogEnabled = Boolean(mongo._oplogHandle && mongo._oplogHandle.onOplogEntry);
const { oplogEnabled, mongo } = getOplogInfo();

try {
const { version, storageEngine } = Promise.await(mongo.db.command({ serverStatus: 1 }));
Expand All @@ -47,5 +51,5 @@ export function getMongoInfo() {
return fallbackMongoInfo();
}

return { oplogEnabled, mongoVersion, mongoStorageEngine };
return { oplogEnabled, mongoVersion, mongoStorageEngine, mongo };
}
2 changes: 1 addition & 1 deletion app/utils/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export { roomTypes } from './lib/roomTypes';
export { RoomTypeRouteConfig, RoomTypeConfig, RoomSettingsEnum, UiTextContext } from '../lib/RoomTypeConfig';
export { RoomTypesCommon } from '../lib/RoomTypesCommon';
export { isDocker } from './functions/isDocker';
export { getMongoInfo } from './functions/getMongoInfo';
export { getMongoInfo, getOplogInfo } from './functions/getMongoInfo';
export { getUserAvatarURL } from '../lib/getUserAvatarURL';
export { slashCommands } from '../lib/slashCommand';
export { getUserNotificationPreference } from '../lib/getUserNotificationPreference';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Rocket.Chat",
"description": "The Ultimate Open Source WebChat Platform",
"version": "3.0.10",
"version": "3.0.11",
"author": {
"name": "Rocket.Chat",
"url": "https://rocket.chat/"
Expand Down
4 changes: 2 additions & 2 deletions server/startup/serverRunning.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { Meteor } from 'meteor/meteor';
import { TAPi18n } from 'meteor/rocketchat:tap-i18n';

import { SystemLogger } from '../../app/logger';
import { settings } from '../../app/settings';
import { Info, getMongoInfo } from '../../app/utils';
import { settings } from '../../app/settings/server';
import { Info, getMongoInfo } from '../../app/utils/server';
import { Users } from '../../app/models/server';
import { sendMessagesToAdmins } from '../lib/sendMessagesToAdmins';

Expand Down