Skip to content

Commit

Permalink
Run all index mutation queries as adhoc (#104)
Browse files Browse the repository at this point in the history
Motivation
------------
There seems to be a bug around index resizing and prepared queries,
https://issues.couchbase.com/browse/MB-53264, this prevents that issue and
possibly other unexpected issues. It should also be slightly
more performant by avoiding an unused prepare, since every
query is different.

Modifications
---------------
- Send all index mutations with adhoc of true.
- Update to Server 7.1.1 for local testing
  • Loading branch information
brantburnett authored Aug 4, 2022
1 parent f8aea7f commit 33993a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
14 changes: 7 additions & 7 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ services:
# (Adding the "ports" property to this file will not forward from a Codespace.)

node1:
image: ${CBIMAGE:-couchbase:enterprise-7.0.0}
image: ${CBIMAGE:-couchbase:enterprise-7.1.1}
labels:
com.centeredgesoftware.cbindexmgr.image: ${CBIMAGE:-couchbase:enterprise-7.0.0}
com.centeredgesoftware.cbindexmgr.image: ${CBIMAGE:-couchbase:enterprise-7.1.1}
command: >
/bin/bash -c "
set -m;
Expand All @@ -51,9 +51,9 @@ services:
fi;
fg 1"
node2:
image: ${CBIMAGE:-couchbase:enterprise-7.0.0}
image: ${CBIMAGE:-couchbase:enterprise-7.1.1}
labels:
com.centeredgesoftware.cbindexmgr.image: ${CBIMAGE:-couchbase:enterprise-7.0.0}
com.centeredgesoftware.cbindexmgr.image: ${CBIMAGE:-couchbase:enterprise-7.1.1}
command: >
/bin/bash -c "
set -m;
Expand All @@ -69,9 +69,9 @@ services:
fi;
fg 1"
node3:
image: ${CBIMAGE:-couchbase:enterprise-7.0.0}
image: ${CBIMAGE:-couchbase:enterprise-7.1.1}
labels:
com.centeredgesoftware.cbindexmgr.image: ${CBIMAGE:-couchbase:enterprise-7.0.0}
com.centeredgesoftware.cbindexmgr.image: ${CBIMAGE:-couchbase:enterprise-7.1.1}
command: >
/bin/bash -c "
set -m;
Expand All @@ -87,7 +87,7 @@ services:
fi;
fg 1"
startup:
image: ${CBIMAGE:-couchbase:enterprise-7.0.0}
image: ${CBIMAGE:-couchbase:enterprise-7.1.1}
depends_on:
- node1
- node2
Expand Down
11 changes: 6 additions & 5 deletions packages/couchbase-index-manager/app/index-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class IndexManager {
* Creates an index based on an index definition
*/
async createIndex(statement: string): Promise<void> {
await this.cluster.query(statement);
await this.cluster.query(statement, {adhoc: true});
}

private getAlterStatement(indexName: string, scope: string, collection: string, withClause: WithClause): string {
Expand Down Expand Up @@ -283,7 +283,7 @@ export class IndexManager {

const statement = this.getAlterStatement(indexName, scope, collection, withClause);

await this.cluster.query(statement);
await this.cluster.query(statement, {adhoc: true});
}

/**
Expand All @@ -300,8 +300,8 @@ export class IndexManager {
}

const statement = this.getAlterStatement(indexName, scope, collection, withClause);

await this.cluster.query(statement);
console.log(statement);
await this.cluster.query(statement, {adhoc: true});
}

/**
Expand Down Expand Up @@ -404,7 +404,8 @@ export class IndexManager {

// Run our deferred build query
await this.cluster.query(qs, {
timeout: options?.timeout
timeout: options?.timeout,
adhoc: true
});
}
}
Expand Down

0 comments on commit 33993a4

Please sign in to comment.