Skip to content

Commit 4aa929e

Browse files
authored
Merge pull request #210 from ml054/v4.1
RDBC-386 Unable to failover in cluster
2 parents ca65b38 + 9ef6f9a commit 4aa929e

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: node_js
22
node_js:
33
- "8"
44
- "10"
5+
- "12"
56
env:
67
global:
78
- RAVENDB_TEST_SERVER_PATH=./RavenDB/Server/Raven.Server
@@ -10,11 +11,10 @@ env:
1011
RAVENDB_TEST_CLIENT_CERT_PATH=./certs/nodejs.pem
1112
RAVENDB_TEST_CA_PATH=/usr/local/share/ca-certificates/ca.crt
1213
RAVENDB_TEST_HTTPS_SERVER_URL=https://localhost:8989
14+
RAVENDB_BUILD_TYPE="stable"
1315
matrix:
1416
- RAVENDB_SERVER_VERSION="4.1"
15-
RAVENDB_BUILD_TYPE="stable"
1617
- RAVENDB_SERVER_VERSION="4.2"
17-
RAVENDB_BUILD_TYPE="nightly"
1818
before_install:
1919
- travis_retry sudo apt-get -qq update
2020
- travis_retry sudo apt-get install -y libunwind8 wget libssl-dev curl unzip gettext libcurl4-openssl-dev zlib1g uuid-dev bzip2 openssl

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Http/RequestExecutor.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ export class RequestExecutor implements IDisposable {
396396
return Promise.resolve(false);
397397
}
398398

399+
if (this._disableTopologyUpdates) {
400+
return Promise.resolve(false);
401+
}
402+
399403
const acquiredSemContext = acquireSemaphore(this._updateDatabaseTopologySemaphore, { timeout });
400404
const result = BluebirdPromise.resolve(acquiredSemContext.promise)
401405
.then(() => {
@@ -804,7 +808,7 @@ export class RequestExecutor implements IDisposable {
804808
sp.stop();
805809

806810
const serverDownHandledSuccessfully = await this._handleServerDown(
807-
req.uri as string, chosenNode, nodeIndex, command, req, response, null, error, sessionInfo);
811+
req.uri as string, chosenNode, nodeIndex, command, req, response, null, error, sessionInfo, shouldRetry);
808812

809813
if (!serverDownHandledSuccessfully) {
810814
this._throwFailedToContactAllNodes(command, req, error, null);
@@ -1004,7 +1008,7 @@ export class RequestExecutor implements IDisposable {
10041008
case StatusCodes.BadGateway:
10051009
case StatusCodes.ServiceUnavailable:
10061010
return this._handleServerDown(
1007-
url, chosenNode, nodeIndex, command, req, response, await readBody(), null, sessionInfo);
1011+
url, chosenNode, nodeIndex, command, req, response, await readBody(), null, sessionInfo, shouldRetry);
10081012
case StatusCodes.Conflict:
10091013
RequestExecutor._handleConflict(response, await readBody());
10101014
break;
@@ -1089,7 +1093,8 @@ export class RequestExecutor implements IDisposable {
10891093
response: HttpResponse,
10901094
body: string,
10911095
error: any,
1092-
sessionInfo: SessionInfo): Promise<boolean> {
1096+
sessionInfo: SessionInfo,
1097+
shouldRetry: boolean): Promise<boolean> {
10931098

10941099
if (!command.failedNodes) {
10951100
command.failedNodes = new Map();
@@ -1118,7 +1123,7 @@ export class RequestExecutor implements IDisposable {
11181123
await this._executeOnSpecificNode(command, sessionInfo, {
11191124
chosenNode: currentIndexAndNode.currentNode,
11201125
nodeIndex: currentIndexAndNode.currentIndex,
1121-
shouldRetry: false
1126+
shouldRetry: shouldRetry
11221127
});
11231128

11241129
return true;

test/Ported/Attachments/AttachmentsSessionTest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe("Attachments Session", function () {
6262
assert.strictEqual(attachments.length, 3);
6363

6464
const orderedNames = [...attachments];
65-
orderedNames.sort((a, b) => a.name > b.name ? -1 : -1);
65+
orderedNames.sort((a, b) => a.name > b.name ? 1 : -1);
6666

6767
for (let i = 0; i < attachmentsInfo.length; i++) {
6868
const { name, contentType } = orderedNames[i];

0 commit comments

Comments
 (0)