@@ -253,25 +253,25 @@ function hotBackup_views (options) {
253253 let which = "hot_backup_views" ;
254254 return hotBackup_load_backend ( options , which , {
255255 // Insert documents into test_collection:
256- noiseScript : `
257- let i=0;
258- while(true) {
259- console.log('Noise starts');
260- try {
261- db._useDatabase('test_view');
262- for (; i < 10000; i++) {
263- db.test_collection.insert({"number": i, "field1": "stone"});
264- }
265- print('done');
266- break;
267- }
268- catch (ex) {
269- console.log(ex);
270- break;
271- }
272- return 0;
273- }
274- ` ,
256+ noiseScript : function ( ) {
257+ let i = 0 ;
258+ while ( true ) {
259+ console . log ( 'Noise starts' ) ;
260+ try {
261+ db . _useDatabase ( 'test_view' ) ;
262+ for ( ; i < 10000 ; i ++ ) {
263+ db . test_collection . insert ( { "number" : i , "field1" : "stone" } ) ;
264+ }
265+ print ( 'done' ) ;
266+ break ;
267+ }
268+ catch ( ex ) {
269+ console . log ( ex ) ;
270+ break ;
271+ }
272+ return 0 ;
273+ }
274+ } ,
275275 noiseVolume : 1 ,
276276 // :/ making sure that something has happened from the
277277 // inserter thread
@@ -377,25 +377,25 @@ function hotBackup_aql (options) {
377377
378378 let which = "hot_backup_aql" ;
379379 return hotBackup_load_backend ( options , which , {
380- noiseScript : `
381- const errors = require('internal').errors;
382- while (true) {
383- try {
384- db._query("FOR i IN 1..1000 INSERT {thrd: @idx, i} INTO test_collection",
385- {"idx": idx}).toArray();
386- } catch (ex) {
387- if (ex.errorNum === errors.ERROR_SHUTTING_DOWN.code ||
388- ex.errorNum === errors.ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT.code) {
389- break;
390- }
391- else {
392- console.error(ex);
393- throw ex;
394- }
395- }
396- }
397- return 0;
398- ` ,
380+ noiseScript : function ( ) {
381+ const errors = require ( 'internal' ) . errors ;
382+ while ( true ) {
383+ try {
384+ db . _query ( "FOR i IN 1..1000 INSERT {thrd: @idx, i} INTO test_collection" ,
385+ { "idx" : ` ${ idx } ` } ) . toArray ( ) ;
386+ } catch ( ex ) {
387+ if ( ex . errorNum === errors . ERROR_SHUTTING_DOWN . code ||
388+ ex . errorNum === errors . ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT . code ) {
389+ break ;
390+ }
391+ else {
392+ console . error ( ex ) ;
393+ throw ex ;
394+ }
395+ }
396+ }
397+ return 0 ;
398+ } ,
399399 noiseVolume : 20 ,
400400 noiseDuration : 15 ,
401401 preRestoreFn : function ( ) {
@@ -435,42 +435,42 @@ function hotBackup_smart_graphs (options) {
435435
436436 let which = "hot_backup_load" ;
437437 return hotBackup_load_backend ( options , which , {
438- noiseScript : `
439- db._useDatabase('test');
440- const errors = require('internal').errors;
441- function shuffleArray(array) {
442- for (let i = array.length - 1; i > 0; i--) {
443- const j = Math.floor(Math.random() * (i + 1));
444- [array[i], array[j]] = [array[j], array[i]];
445- }
446- }
447- let ids1 = [...Array(20).keys()];
448- let ids2 = [...Array(20).keys()];
449- while(true) {
450- shuffleArray(ids1);
451- shuffleArray(ids2);
452- let edge_docs = [];
453- for (let i = 0; i < 20; i++) {
454- edge_docs.push({
455- "_from": \ `foo/\ ${ids1[i]}:v\ ${ids1[i]}\ `,
456- "_to": \ `foo/\ ${ids2[i]}:v\ ${ids2[i]}\ `,
457- "idx": \`\ ${i}\ `,
458- "f": ids1[i],
459- "t": ids2[i]
460- });
461- }
462- try {
463- db.is_foo.save(edge_docs);
464- } catch (ex) {
465- if (ex.errorNum === errors.ERROR_SHUTTING_DOWN.code ||
466- ex.errorNum === errors.ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT.code) {
467- break;
468- }
469- throw ex;
470- }
471- }
472- return 0;
473- ` ,
438+ noiseScript : function ( ) {
439+ db . _useDatabase ( 'test' ) ;
440+ const errors = require ( 'internal' ) . errors ;
441+ function shuffleArray ( array ) {
442+ for ( let i = array . length - 1 ; i > 0 ; i -- ) {
443+ const j = Math . floor ( Math . random ( ) * ( i + 1 ) ) ;
444+ [ array [ i ] , array [ j ] ] = [ array [ j ] , array [ i ] ] ;
445+ }
446+ }
447+ let ids1 = [ ...Array ( 20 ) . keys ( ) ] ;
448+ let ids2 = [ ...Array ( 20 ) . keys ( ) ] ;
449+ while ( true ) {
450+ shuffleArray ( ids1 ) ;
451+ shuffleArray ( ids2 ) ;
452+ let edge_docs = [ ] ;
453+ for ( let i = 0 ; i < 20 ; i ++ ) {
454+ edge_docs . push ( {
455+ "_from" : `foo/${ ids1 [ i ] } :v${ ids1 [ i ] } ` ,
456+ "_to" : `foo/${ ids2 [ i ] } :v${ ids2 [ i ] } ` ,
457+ "idx" : ` ${ i } `,
458+ "f" : ids1 [ i ] ,
459+ "t" : ids2 [ i ]
460+ } ) ;
461+ }
462+ try {
463+ db . is_foo . save ( edge_docs ) ;
464+ } catch ( ex ) {
465+ if ( ex . errorNum === errors . ERROR_SHUTTING_DOWN . code ||
466+ ex . errorNum === errors . ERROR_SIMPLE_CLIENT_COULD_NOT_CONNECT . code ) {
467+ break ;
468+ }
469+ throw ex ;
470+ }
471+ }
472+ return 0 ;
473+ } ,
474474 noiseVolume : 10 ,
475475 noiseDuration : 5 ,
476476 preRestoreFn : function ( ) {
0 commit comments