mirror of https://gitee.com/bigwinds/arangodb
make the ArangoShell refill its collection cache (#3441)
This commit is contained in:
parent
64e9377c05
commit
abc4c09d1e
10
CHANGELOG
10
CHANGELOG
|
@ -1,6 +1,16 @@
|
|||
devel
|
||||
-----
|
||||
|
||||
* make the ArangoShell refill its collection cache when a yet-unknown collection
|
||||
is first accessed. This fixes the following problem:
|
||||
|
||||
arangosh1> db._collections(); // shell1 lists all collections
|
||||
arangosh2> db._create("test"); // shell2 now creates a new collection 'test'
|
||||
arangosh1> db.test.insert({}); // shell1 is not aware of the collection created
|
||||
// in shell2, so the insert will fail
|
||||
|
||||
* make AQL `DISTINCT` not change the order of the results it is applied on
|
||||
|
||||
* enable JEMalloc background thread for purging and returning unused memory
|
||||
back to the operating system (Linux only)
|
||||
|
||||
|
|
|
@ -302,7 +302,7 @@ ArangoDatabase.prototype._collections = function () {
|
|||
|
||||
ArangoDatabase.prototype._collection = function (id) {
|
||||
if (typeof id !== 'number' &&
|
||||
this[id] && this[id] instanceof this._collectionConstructor) {
|
||||
this.hasOwnProperty(id) && this[id] && this[id] instanceof this._collectionConstructor) {
|
||||
return this[id];
|
||||
}
|
||||
var url;
|
||||
|
|
|
@ -90,7 +90,17 @@ exports.ArangoView = require('@arangodb/arango-view').ArangoView;
|
|||
if (typeof internal.arango !== 'undefined') {
|
||||
try {
|
||||
exports.arango = internal.arango;
|
||||
exports.db = new exports.ArangoDatabase(internal.arango);
|
||||
let db = new exports.ArangoDatabase(internal.arango);
|
||||
// proxy the db object, so we can track access to non-existing collections
|
||||
exports.db = new Proxy(db, {
|
||||
get(target, name) {
|
||||
if (!target.hasOwnProperty(name) && target[name] === undefined && typeof name === 'string') {
|
||||
// unknown collection, try re-populating the cache
|
||||
db._collections();
|
||||
}
|
||||
return target[name];
|
||||
},
|
||||
});
|
||||
internal.db = exports.db; // TODO remove
|
||||
} catch (err) {
|
||||
internal.print('cannot connect to server: ' + String(err));
|
||||
|
|
Loading…
Reference in New Issue