diff --git a/CliClient/.gitignore b/CliClient/.gitignore index d5d3a2e06f..9e0fdadb07 100644 --- a/CliClient/.gitignore +++ b/CliClient/.gitignore @@ -8,4 +8,5 @@ app/lib tests/fuzzing/client0 tests/fuzzing/client1 tests/fuzzing/client2 -tests/fuzzing/sync \ No newline at end of file +tests/fuzzing/sync +tests/fuzzing.* \ No newline at end of file diff --git a/CliClient/app/fuzzing.js b/CliClient/app/fuzzing.js index 4685c92018..ee603f8360 100644 --- a/CliClient/app/fuzzing.js +++ b/CliClient/app/fuzzing.js @@ -49,14 +49,14 @@ function randomElement(array) { } function randomWord() { - const words = ['future','breezy','north','untidy','welcome','tenuous','material','tour','erect','bounce','skirt','compare','needle','abstracted','flower','detect','market','boring','lively','ragged','many','safe','credit','periodic','fold','whip','lewd','perform','nonchalant','rigid','amusing','giant','slippery','dog','tranquil','ajar','fanatical','flood','learned','helpless','size','ambiguous','long','six','jealous','history','distance','automatic','soggy','statuesque','prevent','full','price','parallel','mine','garrulous','wandering','puzzled','argument','sack','boil','marked','alive','observe','earsplitting','loving','fallacious','ice','parched','gleaming','horse','frame','gorgeous','quartz','quill','found','stranger','digestion','balance','cut','savory','peace','passenger','driving','sand','offer','rightful','earthquake','ear','spark','seashore','godly','rabbits','time','flowers','womanly','sulky','penitent','detail','warm','functional','silver','bushes','veil','filthy','jar','stitch','heartbreaking','bite-sized','station','play','plastic','common','save','subsequent','miscreant','slimy','train','disgusted','new','crib','boundless','stop','zephyr','roof','boiling','humdrum','record','park','symptomatic','vegetable','interest','ring','dusty','pet','depressed','murder','humor','capricious','kiss','gold','fax','cycle','river','black','four','irritating','mature','well-groomed','guard','hand','spotty','celery','air','scent','jelly','alleged','preach','anger','daffy','wrestle','torpid','excuse','jump','paint','exotic','tasty','auspicious','shirt','exercise','planes','romantic','telephone','teaching','towering','line','grouchy','eggnog','treat','powerful','abortive','paddle','belief','smash','fowl','steam','scale','workable','overwrought','elated','rustic','cuddly','star','extra-small','wacky','marry','optimal','muddle','care','turn','wealthy','phobic','ticket','petite','order','curly','lazy','careful','unequaled','mountain','attract','guide','robin','plant','hook','sail','creature','sparkle','sugar','volcano','grate','plough','undesirable','clever','mark','sea','responsible','destroy','broken','bore','spell','gate','lean','eye','afternoon','grease','note','smiling','puzzling','annoy','disagreeable','valuable','judge','frequent','live','gentle','reward','calm','aloof','old-fashioned','rule','sweet','hat','lumber','cheer','writing','able','roasted','scream','awful','meaty','nutty','trade','protest','letter','half','spiteful','library','food','sign','side','adhesive','itch','fuzzy','force','circle','historical','door','behavior','smile','bitter','scatter','crow','risk','rebel','milky','wise','rule','confuse','motion','roll','grain','structure','ship','admire','discreet','test','ask','meddle','tacit','abundant','skin','wound','beds','saw','few','rhyme','heavenly','jaded','finger','advice','letters','satisfying','general','add','fork','impartial','remind','rate','rotten','beam','puffy','march','horn','practise','brief','coordinated','ahead','woebegone','insidious','continue','rapid','adamant','gray','bless','dinosaurs','dress','woman','stir','songs','unwieldy','jump','cows','dust','terrify','acrid','illegal','desire','share','strange','damaged','entertaining','stare','underwear','legal','oven','refuse','accidental','blot','snakes','talk','lunchroom','man','blushing','waste','aggressive','oval','tax','clam','present','important','chicken','name','town','mend','knowing','long','wrathful','kettle','difficult','account','choke','decorate','bead','fear','majestic','shame','laborer','wine','story','hissing','stingy','plant','potato','houses','leg','number','condemned','hollow','bashful','distinct','ray','evanescent','whimsical','magic','bomb','cute','omniscient','plane','immense','brake','time','marvelous','mask','conscious','explain','answer','physical','berry','guide','machine','toad','business','milk','examine','chickens','uppity','red','kind','medical','shiver','punch','lake','sleepy','axiomatic','matter','nosy','zealous','mint','embarrassed','psychedelic','imagine','collar','tame','wing','soup','efficient','rat','signal','delight','belong','ducks','wicked','nod','close','snotty','measly','front','flag','smoke','magenta','squash','bubble','downtown','thirsty','tremendous','closed','stupid','shaggy','receipt','low','famous','momentous','grateful','concerned','tart','bomb','existence','vacation','grandfather','duck','bubble','reason','glue','assorted','peaceful','questionable','type','industry','chemical','rambunctious','plant','heap','church','suggestion','tickle','income','aberrant','enormous','knock']; + const words = ['belief','scandalous','flawless','wrestle','sort','moldy','carve','incompetent','cruel','awful','fang','holistic','makeshift','synonymous','questionable','soft','drop','boot','whimsical','stir','idea','adhesive','present','hilarious','unusual','divergent','probable','depend','suck','belong','advise','straight','encouraging','wing','clam','serve','fill','nostalgic','dysfunctional','aggressive','floor','baby','grease','sisters','print','switch','control','victorious','cracker','dream','wistful','adaptable','reminiscent','inquisitive','pushy','unaccountable','receive','guttural','two','protect','skin','unbiased','plastic','loutish','zip','used','divide','communicate','dear','muddled','dinosaurs','grip','trees','well-off','calendar','chickens','irate','deranged','trip','stream','white','poison','attack','obtain','theory','laborer','omniscient','brake','maniacal','curvy','smoke','babies','punch','hammer','toothbrush','same','crown','jagged','peep','difficult','reject','merciful','useless','doctor','mix','wicked','plant','quickest','roll','suffer','curly','brother','frighten','cold','tremendous','move','knot','lame','imaginary','capricious','raspy','aunt','loving','wink','wooden','hop','free','drab','fire','instrument','border','frame','silent','glue','decorate','distance','powerful','pig','admit','fix','pour','flesh','profuse','skinny','learn','filthy','dress','bloody','produce','innocent','meaty','pray','slimy','sun','kindhearted','dime','exclusive','boast','neat','ruthless','recess','grieving','daily','hateful','ignorant','fence','spring','slim','education','overflow','plastic','gaping','chew','detect','right','lunch','gainful','argue','cloistered','horses','orange','shame','bitter','able','sail','magical','exist','force','wheel','best','suit','spurious','partner','request','dog','gusty','money','gaze','lonely','company','pale','tempt','rat','flame','wobble','superficial','stop','protective','stare','tongue','heal','railway','idiotic','roll','puffy','turn','meeting','new','frightening','sophisticated','poke','elderly','room','stimulating','increase','moor','secret','lean','occur','country','damp','evanescent','alluring','oafish','join','thundering','cars','awesome','advice','unruly','ray','wind','anxious','fly','hammer','adventurous','shop','cook','trucks','nonchalant','addition','base','abashed','excuse','giants','dramatic','piquant','coach','possess','poor','finger','wide-eyed','aquatic','welcome','instruct','expert','evasive','hug','cute','return','mice','damage','turkey','quiet','bewildered','tidy','pointless','outrageous','medical','foolish','curve','grandiose','gullible','hapless','gleaming','third','grin','pipe','egg','act','physical','eager','side','milk','tearful','fertile','average','glamorous','strange','yak','terrific','thin','near','snails','flowery','authority','fish','curious','perpetual','healthy','health','match','fade','chemical','economic','drawer','avoid','lying','minister','lick','powder','decay','desire','furry','faint','beam','sordid','fax','tail','bawdy','cherry','letter','clover','ladybug','teeth','behavior','black','amazing','pink','waste','island','forgetful','needless','lock','waves','boundary','receipt','handy','religion','hypnotic','aftermath','explain','sense','mundane','rambunctious','second','preserve','alarm','dusty','event','blow','weigh','value','glorious','jail','sigh','cemetery','serious','yummy','cattle','understood','limit','alert','fear','lucky','tested','surround','dolls','pleasant','disillusioned','discover','tray','night','seemly','liquid','worry','pen','bent','gruesome','war','teeny-tiny','common','judge','symptomatic','bed','trot','unequaled','flowers','friends','damaged','peel','skip','show','twist','worthless','brush','look','behave','imperfect','week','petite','direction','soda','lively','coal','coil','release','berserk','books','impossible','replace','cough','chunky','torpid','discreet','material','bomb','soothe','crack','hope','license','frightened','breathe','maddening','calculator','committee','paltry','green','subsequent','arrest','gigantic','tasty','metal','willing','man','stem','nonstop','route','impulse','government','comfortable','include','literate','multiply','test','vast','exercise','addicted','agreeable','lace','toes','young','water','end','wash','glossy','round','staking','sink','open','spot','trip','fierce','robust','pastoral','drown','dress','machine','calculating','holiday','crabby','disgusting','plan','sleet','sleepy','typical','borrow','possible','curtain','airplane','industry','nut','rough','wacky','rock','enormous','uninterested','sugar','rake','consist','wrist','basket','chop','wet','street','known','settle','bless','cluttered','wild','expand','angle','snake','yawn','hate','flood','rabid','spiteful','anger','market','bizarre','force','majestic','scissors','beg','rifle','foregoing','cactus','funny','eggnog','wish','high-pitched','drop','camp','scarf','car','groan','wonderful','wealthy','cup','lock','available','previous','jam','political','vacation','three','desk','fry','aspiring','productive','clear','bored','flashy','plug','precede','abhorrent','muddle','flimsy','paste','need','reward','frail','obnoxious','creature','whip','unbecoming','lake','unused','chin','tour','zephyr','experience','building','scrub','correct','hover','panicky','scorch','diligent','hulking','ubiquitous','tedious','aberrant','file','accidental','mist','blue-eyed','trite','nondescript','cows','wait','test','snotty','amuck','jump','lackadaisical','grey','tawdry','strong','land','kind','star','ludicrous','stupid','telling','use','bruise','whirl','cream','harsh','aboriginal','substantial','brawny','tease','pollution','weather','degree','dry','film','obey','closed','dependent','want','undesirable','stamp','relax','foot','obscene','successful','wriggle','drain','greasy','escape','cross','odd','boring','absorbed','houses','suppose','suit','moon','ceaseless','explode','clap','pop','courageous','miss','notebook','delirious','form','pretty','sock','grotesque','noxious','record','stop','saw','thing','dislike','cloth','six','jar','unnatural','spiffy','itchy','secretary','move','certain','unkempt','sassy','queue','shrug','crow','heavenly','desert','screw','vessel','mug','encourage','icy','enthusiastic','throat','whistle','ignore','miniature','squeak','scarecrow','fluttering','hang','icicle','lie','juicy','empty','baseball','various','promise','abortive','descriptive','high','spy','faded','talk','air','mess up','decorous','sneaky','mark','sack','ultra','chivalrous','lethal','expect','disgusted','reaction','fireman','private','ritzy','manage','actor','rely','uppity','thread','bat','space','underwear','blood','nine','maid','shelf','hanging','shop','prick','wound','sloppy','offer','increase','clear','slap','rude','poised','wretched','cause','quince','tame','remarkable','abject','sail','guide','subdued','spiky','debonair','chicken','tired','hum','land','scared','splendid','guess','cast','rub','magnificent','ants','overwrought','interfere','gorgeous','office','trade','sniff','melted','bore','point','pet','purple','brake','flavor','toe','prickly','zinc','homely','modern','kindly','whisper','bare','annoyed','glass','noisy','null','thoughtless','skirt','dock','rings','mind','neck','macho','wave','history','play','road','profit','word','opposite','dreary','governor','horse','trust','elbow','kiss','crayon','stitch','excited','needy','arrange','easy','alcoholic','safe','lumpy','monkey','smile','capable','untidy','extra-small','memory','selective','reproduce','old-fashioned','overrated','texture','knit','downtown','risk','pot','sofa','righteous','wren','pull','carry','aboard','listen','classy','thank','shocking','condition','root','attempt','swim','frog','hurt','army','title','handsomely','town','guiltless','thaw','spell','selfish','disturbed','tramp','girls','utopian','noiseless','trail','bashful','business','rhetorical','snail','sign','plausible','left','design','tall','violent','wasteful','beautiful','breezy','tap','murder','talented','needle','creator','imagine','flippant','dead','bone','coherent','relation','aromatic','mountainous','face','ask','picture','pedal','colour','obese','group','top','bubble','pinch','optimal','school','bathe','flagrant','check','deliver','pass','tan','crate','hose','debt','faulty','longing','hollow','invincible','afford','lovely','ticket','changeable','subtract','fumbling','responsible','confused','woman','touch','watch','zesty','library','jail','wrap','terrify','brick','popcorn','cooperative','peck','pocket','property','buzz','tiresome','digestion','exciting','nation','juvenile','shade','copper','wanting','deer','waste','man','join','spotty','amused','mountain','waggish','bushes','tense','river','heartbreaking','help','mine','narrow','smash','scrawny','tame','rain','playground','airport','astonishing','level','befitting','animal','heat','painful','cellar','ski','sedate','knowing','vigorous','change','eight','ship','work','strip','robin','tank','challenge','vacuous','representative','regret','tightfisted','erratic','club','imported','therapeutic','rainstorm','luxuriant','relieved','day','system','apologise','male','prepare','malicious','naive','whistle','curl','hobbies','trousers','stereotyped','dad','endurable','grass','hot','bomb','morning','guide','keen','plot','accept','disastrous','macabre','year','spicy','absorbing','sticks','efficient','drain','warm','rice','utter','fact','marked','ratty','chalk','towering','treat','nest','annoy','jealous','stamp','effect','cautious','jelly','feigned','gabby','corn','volleyball','pan','psychedelic','fairies','silent','zonked','bump','trouble','mass','queen','things','bury','sister','quiet','colossal','puncture','four','attend','love','wiry','vegetable','destruction','note','pies','resolute','load','fancy','tacky','periodic','abandoned','vivacious','blush','wrathful','miscreant','call','striped','wiggly','supreme','hand','impolite','rule','deserted','concern','cover','harbor','waiting','soggy','psychotic','ancient','sponge','domineering','elegant','impartial','unlock','abrasive','count','flight','neighborly','roof','bulb','auspicious','automatic','magic','sign','amusing','orange','branch','sulky','attack','fetch','number','jellyfish','start','alike','touch','sour','wary','minor','punish','connect','protest','pie','kaput','doubtful','friendly','simplistic','smart','vanish','applaud','jumbled','ready','yell','support','squash','raise','parallel','super','jazzy','crush','apathetic','water','food','thrill','permit','heady','last','mine','signal','smoke','preach','x-ray','name','birth','minute','steel','bedroom','female','acrid','riddle','attractive','earth','crack','muscle','alive','guarded','sweater','donkey','doubt','lettuce','magenta','live','farm','glib','bow','fascinated','friend','practise','remember','bleach','hungry','voiceless','pin','sparkling','report','arm','sad','shaggy','parcel','wail','flash','territory','functional','wise','screeching','appliance','future','appear','team','rabbit','porter','paint','flat','amusement','ocean','head','geese','wash','embarrassed','tub','boundless','freezing','mushy','surprise','temporary','marble','recondite','telephone','zipper','pine','reign','pump','tangy','reply','toys','purpose','songs','form','delicious','wood','horn','nutty','fruit','lumber','potato','cheat','cloudy','visit','reduce','destroy','deafening','full','warlike','mitten','cover','earthy','seashore','yarn','tenuous','pause','boil','dogs','tough','knife','shy','naughty','existence','fire','eminent','remove','juice','sleep','voyage','balance','unsightly','plough','ill-fated','pumped','motionless','allow','trade','warm','toad','wave','wall','pigs','circle','rejoice','ear','drink','found','taboo','object','old','temper','plant','public','picayune','blot','delight','carpenter','dispensable','tire','cow','furniture','rightful','mute','gentle','gifted','ragged','stiff','retire','compare','sable','hole','judicious','chilly','sparkle','futuristic','love','bubble','travel','name','numberless','succeed','acoustic','lowly','society','injure','agree','reason','party','wool','careful','hook','bell','ball','attach','scream','development','happy','appreciate','disagree','request','march','rampant','scrape','sack','hair','measure','owe','grubby','vein','boy','punishment','smoggy','wry','immense','shoe','pack','brash','cave','sincere','adorable','fantastic','attraction','racial','jittery','defiant','honey','paper','weight','bee','blind','birthday','toothsome','trick','guard','fog','handle','dirty','salt','rinse','nippy','observe','suggestion','weak','instinctive','frequent','detail','verse','quirky','scattered','toy','aware','distribution','repulsive','draconian','bucket','harm','radiate','bang','shrill','living','rhythm','obsequious','drum','inject','skate','beds','smash','order','stitch','ground','nosy','kick','dusty','home','rot','frame','jam','sky','soap','rescue','energetic','grape','massive','deeply','dazzling','park','pull','number','abundant','barbarous','drag','ajar','close','moan','haircut','shade','married','cats','thirsty','dirt','vagabond','fearful','squealing','squalid','zebra','murky','sheet','fat','follow','bikes','unpack','materialistic','surprise','arch','selection','acoustics','helpless','thoughtful','cry','quarrelsome','arrogant','illegal','sudden','elite','tomatoes','spoil','flower','shivering','front','caption','volcano','ugliest','ambitious','pickle','interrupt','nervous','approve','messy','dust','oceanic','brass','tremble','fine','nerve','lunchroom','hard','engine','erect','flower','cynical','irritating','tight','cobweb','gray','invention','snatch','account','sharp','spooky','squeamish','eatable','share','need','moaning','suspect','rush','rural','false','float','bite','careless','sidewalk','cowardly','stroke','educated','ugly','type','wandering','bolt','mint','fit','large','extra-large','defeated','kitty','tacit','abiding','grandfather','trains','lamp','habitual','fast','offbeat','accurate','many','fortunate','lyrical','charge','illustrious','transport','wakeful','cable','ordinary','string','question','train','fancy','kick','enchanting','jobless','ahead','comparison','loose','dance','add','wonder','stale','earn','reflective','bright','true','statuesque','amount','matter','repair','care','ruin','terrible','elastic','spiders','craven','lamentable','decision','swing','connection','gaudy','knowledge','cheap','lazy','step','dinner','rod','agreement','comb','mean','past','knotty','busy','quicksand','match','early','long','onerous','ambiguous','worried','spade','happen','crook','dapper','grate','announce','plate','haunt','friction','actually','chance','example','rapid','zealous','necessary','ink','mere','shock','huge','jaded','spill','store','fuzzy','table','bottle','halting','spark','end','remain','transport','seat','leg','long-term','clip','grumpy','shake','walk','try','action','soup','short','hurry','square','belligerent','thankful','beginner','small','bumpy','silly','badge','marvelous','wealth','open','unequal','scatter','pest','fool','step','groovy','childlike','door','bouncy','believe','incredible','box','unhealthy','swanky','abrupt','depressed','flaky','famous','detailed','regret','envious','natural','apparel','spare','mark','ten','power','glistening','arrive','animated','slip','heap','shaky','unfasten','contain','inexpensive','introduce','shallow','rule','gather','pump','humorous','acceptable','womanly','giddy','silk','yoke','straw','invite','one','red','growth','unadvised','measly','flap','puzzled','regular','painstaking','little','plain','tumble','rest','fabulous','melt','label','truculent','internal','passenger','zippy','bright','earsplitting','tooth','veil','grip','square','stuff','gate','level','stone','observation','time','workable','bird','realise','spotted','coast','quiver','rebel','entertain','rotten','loss','collect','meal','satisfy','military','bake','cagey','redundant','treatment','knock','blink','scale','board','fair','nebulous','sip','homeless','place','complain','joke','bat','winter','choke','frantic','chubby','highfalutin','troubled','whole','rose','delightful','loaf','afraid','sturdy','class','cultured','yielding','broken','kittens','absurd','discovery','next','disarm','dangerous','lively','reflect','chief','teeny','pencil','ban','grade','size','dashing','thought','breath','empty','hellish','shock','sea','weary','payment','limping','premium','grateful','somber','tax','coach','vulgar','stretch','tow','branch','insurance','yam','stormy','wish','snow','cute','milky','battle','far','roasted','slip','adamant','awake','employ','tangible','tickle','jog','hysterical','meddle','parsimonious','judge','educate','respect','sound','oven','gratis','station','train','purring','steady','carriage','humdrum','voracious','jolly','brainy','proud','elfin','cure','motion','record','quizzical','pail','bike','faithful','approval','vague','fall','store','normal','rock','bear','bounce','giant','satisfying','crooked','lopsided','vest','separate','sneeze','teaching','general','meat','festive','historical','line','north','tip','son','damaging','nimble','broad','list','confuse','first','deserve','steep','last','rich','oval','thick','glow','great','clammy','cheer','untidy','scientific','noise','stomach','undress','big','bite-sized','enter','cake','aloof','abnormal','month','grab','well-groomed','silver','art','berry','giraffe','complete','billowy','thumb','squeal','crib','discussion','even','stretch','mellow','angry','grouchy','absent','snow','middle','stingy','mourn','deep','honorable','nice','verdant','reach','lavish','sin','interest','whine','tug','vengeful','rhyme','stay','upset','hesitant','tent','wire','gold','momentous','yellow','cap','delicate','youthful','twig','burly','devilish','chess','wide','misty','useful','memorise','madly','plants','spectacular','accessible','collar','truck','harmony','uncovered','beef','low','channel','abusive','analyse','observant','snobbish','duck','excellent','intend','wreck','testy','care','shoes','charming','demonic','can','wipe','acidic','watch','decisive','brave','greet','imminent','influence','oranges','seal','eggs','knowledgeable','ashamed','shiny','inconclusive','remind','house','solid','quixotic','describe','support']; return randomElement(words); } function execCommand(client, command, options = {}) { let exePath = 'node ' + joplinAppPath; let cmd = exePath + ' --profile ' + client.profileDir + ' ' + command; - logger.info(cmd); + logger.info(client.id + ': ' + command); if (options.killAfter) { logger.info('Kill after: ' + options.killAfter); @@ -65,8 +65,12 @@ function execCommand(client, command, options = {}) { return new Promise((resolve, reject) => { let childProcess = exec(cmd, (error, stdout, stderr) => { if (error) { - logger.error(stderr); - reject(error); + if (error.signal == 'SIGTERM') { + resolve('Process was killed'); + } else { + logger.error(stderr); + reject(error); + } } else { resolve(stdout); } @@ -74,7 +78,6 @@ function execCommand(client, command, options = {}) { if (options.killAfter) { setTimeout(() => { - if (!childProcess.connected) return; logger.info('Sending kill signal...'); childProcess.kill(); }, options.killAfter); @@ -84,9 +87,9 @@ function execCommand(client, command, options = {}) { async function execRandomCommand(client) { let possibleCommands = [ - ['mkbook {word}', 30], - ['mknote {word}', 100], - [async () => { + ['mkbook {word}', 40], // CREATE FOLDER + ['mknote {word}', 100], // CREATE NOTE + [async () => { // DELETE RANDOM ITEM let items = await execCommand(client, 'dump'); items = JSON.parse(items); let item = randomElement(items); @@ -99,17 +102,25 @@ async function execRandomCommand(client) { } else { throw new Error('Unknown type: ' + item.type_); } - }, 80], - [async () => { + }, 30], + [async () => { // SYNC let avgSyncDuration = averageSyncDuration(); let options = {}; if (!isNaN(avgSyncDuration)) { - if (Math.random() >= 0.5) { - options.killAfter = avgSyncDuration * Math.random(); - } + // if (Math.random() >= 0.5) { + // options.killAfter = avgSyncDuration * Math.random(); + // } } - return execCommand(client, 'sync', options); - }, 10], + return execCommand(client, 'sync --random-failures', options); + }, 40], + [async () => { // UPDATE RANDOM ITEM + let items = await execCommand(client, 'dump'); + items = JSON.parse(items); + let item = randomElement(items); + if (!item) return; + + return execCommand(client, 'set ' + item.id + ' title "' + randomWord() + '"'); + }, 50], ]; let cmd = null; @@ -134,7 +145,7 @@ function averageSyncDuration() { } function randomNextCheckTime() { - let output = time.unixMs() + 1000 + Math.random() * 1000 * 2; + let output = time.unixMs() + 1000 + Math.random() * 1000 * 120; logger.info('Next sync check: ' + time.unixMsToIso(output) + ' (' + (Math.round((output - time.unixMs()) / 1000)) + ' sec.)'); return output; } @@ -202,12 +213,6 @@ async function compareClientItems(clientItems) { process.exit(1); } - // let r = lodash.uniq(itemCounts); - // if (r.length > 1) { - // logger.error('Item count is different'); - // process.exit(1); - // } - let differences = []; let items = clientItems[0]; for (let i = 0; i < items.length; i++) { diff --git a/CliClient/app/main.js b/CliClient/app/main.js index 995b74d01e..45a9fa6ddc 100644 --- a/CliClient/app/main.js +++ b/CliClient/app/main.js @@ -107,22 +107,27 @@ commands.push({ }); commands.push({ - usage: 'set [prop-value]', - description: 'Sets the given of the given item.', - action: function(args, end) { - let promise = null; - let title = args['item-title']; - let propName = args['prop-name']; - let propValue = args['prop-value']; - if (!propValue) propValue = ''; + usage: 'set <name> [value]', + description: 'Sets the property <name> of the given item to the given [value].', + action: async function(args, end) { + try { + let promise = null; + let title = args['title']; + let propName = args['name']; + let propValue = args['value']; + if (!propValue) propValue = ''; - if (!currentFolder) { - promise = Folder.loadByField('title', title); - } else { - promise = Note.loadFolderNoteByField(currentFolder.id, 'title', title); - } + let item = null; + if (!currentFolder) { + item = await Folder.loadByField('title', title); + } else { + item = await Note.loadFolderNoteByField(currentFolder.id, 'title', title); + } + + if (!item) { + item = await BaseItem.loadItemById(title); + } - promise.then((item) => { if (!item) { this.log(_('No item with title "%s" found.', title)); end(); @@ -135,21 +140,20 @@ commands.push({ }; newItem[propName] = propValue; let ItemClass = BaseItem.itemClass(newItem); - return ItemClass.save(newItem); - }).catch((error) => { + await ItemClass.save(newItem); + } catch(error) { this.log(error); - }).then(() => { - end(); - }); + } + end(); }, autocomplete: autocompleteItems, }); commands.push({ - usage: 'cat <item-title>', + usage: 'cat <title>', description: 'Displays the given item data.', action: function(args, end) { - let title = args['item-title']; + let title = args['title']; let promise = null; if (!currentFolder) { @@ -369,6 +373,9 @@ commands.push({ commands.push({ usage: 'sync', description: 'Synchronizes with remote storage.', + options: [ + ['--random-failures', 'For debugging purposes. Do not use.'], + ], action: function(args, end) { let redrawnCalled = false; @@ -380,13 +387,14 @@ commands.push({ if (report.remotesToDelete) line.push(_('Remote items to delete: %d/%d.', report.deleteRemote, report.remotesToDelete)); if (report.localsToUdpate) line.push(_('Items to download: %d/%d.', report.createLocal + report.updateLocal, report.localsToUdpate)); if (report.localsToDelete) line.push(_('Local items to delete: %d/%d.', report.deleteLocal, report.localsToDelete)); - redrawnCalled = true; - vorpal.ui.redraw(line.join(' ')); + //redrawnCalled = true; + //vorpal.ui.redraw(line.join(' ')); }, onMessage: (msg) => { if (redrawnCalled) vorpal.ui.redraw.done(); this.log(msg); }, + randomFailures: args.options['random-failures'] === true, }; this.log(_('Synchronization target: %s', Setting.value('sync.target'))); @@ -766,8 +774,6 @@ async function main() { o.action(c.action); } - vorpal.history(Setting.value('appId')); // Enables persistent history - let argv = process.argv; argv = await handleStartFlags(argv); @@ -802,7 +808,6 @@ async function main() { let activeFolder = null; if (activeFolderId) activeFolder = await Folder.load(activeFolderId); if (!activeFolder) activeFolder = await Folder.defaultFolder(); - //if (!activeFolder) throw new Error(_('No default notebook is defined and could not create a new one. The database might be corrupted, please delete it and try again.')); Setting.setValue('activeFolderId', activeFolder ? activeFolder.id : ''); if (activeFolder) await execCommand('cd', { 'notebook': activeFolder.title }); // Use execCommand() so that no history entry is created @@ -814,6 +819,7 @@ async function main() { await vorpal.exec('exit'); return; } else { + vorpal.history(Setting.value('appId')); // Enables persistent history vorpal.delimiter(promptString()).show(); if (!activeFolder) { vorpal.log(_('No notebook is defined. Create one with `mkbook <notebook>`.')); diff --git a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/database.sqlite b/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/database.sqlite deleted file mode 100644 index 945a90f057..0000000000 Binary files a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/database.sqlite and /dev/null differ diff --git a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/log-database.txt b/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/log-database.txt deleted file mode 100644 index c5e59fff5b..0000000000 --- a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/log-database.txt +++ /dev/null @@ -1,470 +0,0 @@ -2017-07-01 13:09:29: Database was open successfully -2017-07-01 13:09:29: Checking for database schema update... -2017-07-01 13:09:29: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:29: Database is new - creating the schema... -2017-07-01 13:09:29: BEGIN TRANSACTION -2017-07-01 13:09:29: CREATE TABLE folders ( id TEXT PRIMARY KEY, parent_id TEXT NOT NULL DEFAULT "", title TEXT NOT NULL DEFAULT "", created_time INT NOT NULL DEFAULT 0, updated_time INT NOT NULL DEFAULT 0, sync_time INT NOT NULL DEFAULT 0); -2017-07-01 13:09:29: CREATE INDEX folders_title ON folders (title); -2017-07-01 13:09:29: CREATE INDEX folders_updated_time ON folders (updated_time); -2017-07-01 13:09:29: CREATE INDEX folders_sync_time ON folders (sync_time); -2017-07-01 13:09:29: CREATE TABLE notes ( id TEXT PRIMARY KEY, parent_id TEXT NOT NULL DEFAULT "", title TEXT NOT NULL DEFAULT "", body TEXT NOT NULL DEFAULT "", created_time INT NOT NULL DEFAULT 0, updated_time INT NOT NULL DEFAULT 0, sync_time INT NOT NULL DEFAULT 0, is_conflict INT NOT NULL DEFAULT 0, latitude NUMERIC NOT NULL DEFAULT 0, longitude NUMERIC NOT NULL DEFAULT 0, altitude NUMERIC NOT NULL DEFAULT 0, author TEXT NOT NULL DEFAULT "", source_url TEXT NOT NULL DEFAULT "", is_todo INT NOT NULL DEFAULT 0, todo_due INT NOT NULL DEFAULT 0, todo_completed INT NOT NULL DEFAULT 0, source TEXT NOT NULL DEFAULT "", source_application TEXT NOT NULL DEFAULT "", application_data TEXT NOT NULL DEFAULT "", `order` INT NOT NULL DEFAULT 0); -2017-07-01 13:09:29: CREATE INDEX notes_title ON notes (title); -2017-07-01 13:09:29: CREATE INDEX notes_updated_time ON notes (updated_time); -2017-07-01 13:09:29: CREATE INDEX notes_sync_time ON notes (sync_time); -2017-07-01 13:09:29: CREATE INDEX notes_is_conflict ON notes (is_conflict); -2017-07-01 13:09:29: CREATE INDEX notes_is_todo ON notes (is_todo); -2017-07-01 13:09:29: CREATE INDEX notes_order ON notes (`order`); -2017-07-01 13:09:29: CREATE TABLE deleted_items ( id INTEGER PRIMARY KEY, item_type INT NOT NULL, item_id TEXT NOT NULL, deleted_time INT NOT NULL); -2017-07-01 13:09:29: CREATE TABLE tags ( id TEXT PRIMARY KEY, title TEXT, created_time INT, updated_time INT); -2017-07-01 13:09:29: CREATE TABLE note_tags ( id INTEGER PRIMARY KEY, note_id TEXT, tag_id TEXT); -2017-07-01 13:09:29: CREATE TABLE resources ( id TEXT PRIMARY KEY, title TEXT, mime TEXT, filename TEXT, created_time INT, updated_time INT); -2017-07-01 13:09:29: CREATE TABLE note_resources ( id INTEGER PRIMARY KEY, note_id TEXT, resource_id TEXT); -2017-07-01 13:09:29: CREATE TABLE version ( version INT); -2017-07-01 13:09:29: CREATE TABLE changes ( id INTEGER PRIMARY KEY, `type` INT, item_id TEXT, item_type INT, item_field TEXT); -2017-07-01 13:09:29: CREATE TABLE settings ( `key` TEXT PRIMARY KEY, `value` TEXT, `type` INT); -2017-07-01 13:09:29: CREATE TABLE table_fields ( id INTEGER PRIMARY KEY, table_name TEXT, field_name TEXT, field_type INT, field_default TEXT); -2017-07-01 13:09:29: CREATE TABLE item_sync_times ( id INTEGER PRIMARY KEY, item_id TEXT, `time` INT); -2017-07-01 13:09:29: INSERT INTO version (version) VALUES (1); -2017-07-01 13:09:29: INSERT INTO settings (`key`, `value`, `type`) VALUES ("clientId", "5d327ad5ac5546ad9826dd8f1d754e52", "2") -2017-07-01 13:09:29: INSERT INTO `folders` (`id`, `title`, `created_time`, `updated_time`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:29: ["68cba53569c84bfbad79eee85402160b","Notebook",1498910969401,1498910969401] -2017-07-01 13:09:29: COMMIT -2017-07-01 13:09:29: Database schema created successfully -2017-07-01 13:09:29: Initializing tables... -2017-07-01 13:09:29: SELECT name FROM sqlite_master WHERE type="table" -2017-07-01 13:09:29: PRAGMA table_info("folders") -2017-07-01 13:09:29: PRAGMA table_info("notes") -2017-07-01 13:09:29: PRAGMA table_info("deleted_items") -2017-07-01 13:09:29: PRAGMA table_info("tags") -2017-07-01 13:09:29: PRAGMA table_info("note_tags") -2017-07-01 13:09:29: PRAGMA table_info("resources") -2017-07-01 13:09:29: PRAGMA table_info("note_resources") -2017-07-01 13:09:29: PRAGMA table_info("version") -2017-07-01 13:09:29: PRAGMA table_info("changes") -2017-07-01 13:09:29: PRAGMA table_info("settings") -2017-07-01 13:09:29: PRAGMA table_info("item_sync_times") -2017-07-01 13:09:29: BEGIN TRANSACTION -2017-07-01 13:09:29: DELETE FROM table_fields -2017-07-01 13:09:29: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:29: ["folders","id",2,null] -2017-07-01 13:09:29: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:29: ["folders","parent_id",2,""] -2017-07-01 13:09:29: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:29: ["folders","title",2,""] -2017-07-01 13:09:29: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:29: ["folders","created_time",1,"0"] -2017-07-01 13:09:29: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:29: ["folders","updated_time",1,"0"] -2017-07-01 13:09:29: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["folders","sync_time",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","parent_id",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","title",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","body",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","created_time",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","updated_time",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","sync_time",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","is_conflict",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","latitude",3,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","longitude",3,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","altitude",3,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","author",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","source_url",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","is_todo",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","todo_due",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","todo_completed",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","source",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","source_application",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","application_data",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","order",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["deleted_items","id",null,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["deleted_items","item_type",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["deleted_items","item_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["deleted_items","deleted_time",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["tags","id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["tags","title",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["tags","created_time",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["tags","updated_time",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_tags","id",null,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_tags","note_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_tags","tag_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","title",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","mime",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","filename",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","created_time",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","updated_time",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_resources","id",null,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_resources","note_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_resources","resource_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["version","version",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["changes","id",null,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["changes","type",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["changes","item_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["changes","item_type",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["changes","item_field",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["settings","key",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["settings","value",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["settings","type",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["item_sync_times","id",null,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["item_sync_times","item_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["item_sync_times","time",1,null] -2017-07-01 13:09:30: COMMIT -2017-07-01 13:09:30: Checking for database schema update... -2017-07-01 13:09:30: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:30: Current database version -2017-07-01 13:09:30: SELECT * FROM table_fields -2017-07-01 13:09:30: SELECT * FROM settings -2017-07-01 13:09:30: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:09:30: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:30: ["Notebook"] -2017-07-01 13:09:30: Saving settings... -2017-07-01 13:09:30: BEGIN TRANSACTION -2017-07-01 13:09:30: DELETE FROM settings -2017-07-01 13:09:30: INSERT INTO `settings` (`key`, `value`, `type`) VALUES (?, ?, ?) -2017-07-01 13:09:30: ["clientId","5d327ad5ac5546ad9826dd8f1d754e52",2] -2017-07-01 13:09:30: INSERT INTO `settings` (`value`, `type`, `key`) VALUES (?, ?, ?) -2017-07-01 13:09:30: ["68cba53569c84bfbad79eee85402160b","string","activeFolderId"] -2017-07-01 13:09:30: INSERT INTO `settings` (`value`, `type`, `key`) VALUES (?, ?, ?) -2017-07-01 13:09:30: ["local","string","sync.target"] -2017-07-01 13:09:30: COMMIT -2017-07-01 13:09:30: Settings have been saved. -2017-07-01 13:09:31: Database was open successfully -2017-07-01 13:09:31: Checking for database schema update... -2017-07-01 13:09:32: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:32: Current database version -2017-07-01 13:09:32: SELECT * FROM table_fields -2017-07-01 13:09:32: SELECT * FROM settings -2017-07-01 13:09:32: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:32: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:32: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:32: ["Notebook"] -2017-07-01 13:09:32: Saving settings... -2017-07-01 13:09:32: BEGIN TRANSACTION -2017-07-01 13:09:32: DELETE FROM settings -2017-07-01 13:09:32: INSERT INTO `settings` (`key`, `value`, `type`) VALUES (?, ?, ?) -2017-07-01 13:09:32: ["clientId","5d327ad5ac5546ad9826dd8f1d754e52",2] -2017-07-01 13:09:32: INSERT INTO `settings` (`key`, `value`, `type`) VALUES (?, ?, ?) -2017-07-01 13:09:32: ["activeFolderId","68cba53569c84bfbad79eee85402160b","string"] -2017-07-01 13:09:32: INSERT INTO `settings` (`key`, `value`, `type`) VALUES (?, ?, ?) -2017-07-01 13:09:32: ["sync.target","local","string"] -2017-07-01 13:09:32: INSERT INTO `settings` (`value`, `type`, `key`) VALUES (?, ?, ?) -2017-07-01 13:09:32: ["/var/www/joplin/CliClient/tests/fuzzing/sync","string","sync.local.path"] -2017-07-01 13:09:32: COMMIT -2017-07-01 13:09:32: Settings have been saved. -2017-07-01 13:09:33: Database was open successfully -2017-07-01 13:09:33: Checking for database schema update... -2017-07-01 13:09:33: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:33: Current database version -2017-07-01 13:09:33: SELECT * FROM table_fields -2017-07-01 13:09:33: SELECT * FROM settings -2017-07-01 13:09:33: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:33: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:33: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:33: ["Notebook"] -2017-07-01 13:09:33: INSERT INTO `notes` (`parent_id`, `title`, `source`, `source_application`, `updated_time`, `id`, `created_time`) VALUES (?, ?, ?, ?, ?, ?, ?) -2017-07-01 13:09:33: ["68cba53569c84bfbad79eee85402160b","smash","joplin","net.cozic.joplin-cli",1498910973758,"351b927410b541e1a6d1a2a88ef7d1c0",1498910973758] -2017-07-01 13:09:34: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:34: ["351b927410b541e1a6d1a2a88ef7d1c0"] -2017-07-01 13:09:35: Database was open successfully -2017-07-01 13:09:35: Checking for database schema update... -2017-07-01 13:09:35: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:35: Current database version -2017-07-01 13:09:35: SELECT * FROM table_fields -2017-07-01 13:09:35: SELECT * FROM settings -2017-07-01 13:09:35: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:35: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:35: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:35: ["Notebook"] -2017-07-01 13:09:35: SELECT * FROM `folders` -2017-07-01 13:09:35: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:09:35: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:36: Database was open successfully -2017-07-01 13:09:36: Checking for database schema update... -2017-07-01 13:09:36: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:36: Current database version -2017-07-01 13:09:36: SELECT * FROM table_fields -2017-07-01 13:09:36: SELECT * FROM settings -2017-07-01 13:09:36: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:36: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:36: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:36: ["Notebook"] -2017-07-01 13:09:36: SELECT * FROM `notes` WHERE `title` = ? -2017-07-01 13:09:36: ["smash"] -2017-07-01 13:09:36: DELETE FROM notes WHERE id = ? -2017-07-01 13:09:36: ["351b927410b541e1a6d1a2a88ef7d1c0"] -2017-07-01 13:09:37: INSERT INTO deleted_items (item_type, item_id, deleted_time) VALUES (?, ?, ?) -2017-07-01 13:09:37: [1,"351b927410b541e1a6d1a2a88ef7d1c0",1498910977016] -2017-07-01 13:09:38: Database was open successfully -2017-07-01 13:09:38: Checking for database schema update... -2017-07-01 13:09:38: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:38: Current database version -2017-07-01 13:09:38: SELECT * FROM table_fields -2017-07-01 13:09:38: SELECT * FROM settings -2017-07-01 13:09:38: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:38: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:38: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:38: ["Notebook"] -2017-07-01 13:09:38: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:38: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:38: [null] -2017-07-01 13:09:38: UPDATE `folders` SET `sync_time`=? WHERE id=? -2017-07-01 13:09:38: [1498910978678,"68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:38: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:38: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:09:38: SELECT * FROM deleted_items -2017-07-01 13:09:38: DELETE FROM deleted_items WHERE item_id = ? -2017-07-01 13:09:38: ["351b927410b541e1a6d1a2a88ef7d1c0"] -2017-07-01 13:09:39: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:39: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:39: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:39: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:39: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:09:39: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:09:39: SELECT count(*) as total FROM `folders` -2017-07-01 13:09:39: SELECT count(*) as total FROM `notes` -2017-07-01 13:09:42: Database was open successfully -2017-07-01 13:09:42: Checking for database schema update... -2017-07-01 13:09:42: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:42: Current database version -2017-07-01 13:09:42: SELECT * FROM table_fields -2017-07-01 13:09:42: SELECT * FROM settings -2017-07-01 13:09:42: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:42: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:42: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:42: ["Notebook"] -2017-07-01 13:09:42: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:42: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:09:42: SELECT * FROM deleted_items -2017-07-01 13:09:42: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:42: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:42: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:42: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:42: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:42: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:42: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:42: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:42: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:42: ["Notebook"] -2017-07-01 13:09:42: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:42: ["Notebook-1498910969408-979"] -2017-07-01 13:09:42: INSERT INTO `folders` (`id`, `title`, `created_time`, `updated_time`, `sync_time`) VALUES (?, ?, ?, ?, ?) -2017-07-01 13:09:42: ["7711fd1e399e4219ba8f5f9e9eeefb16","Notebook-1498910969408-979","1498910969408",1498910982544,1498910982542] -2017-07-01 13:09:42: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:09:42: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:09:42: SELECT count(*) as total FROM `folders` -2017-07-01 13:09:42: SELECT count(*) as total FROM `notes` -2017-07-01 13:09:45: Database was open successfully -2017-07-01 13:09:45: Checking for database schema update... -2017-07-01 13:09:45: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:45: Current database version -2017-07-01 13:09:45: SELECT * FROM table_fields -2017-07-01 13:09:45: SELECT * FROM settings -2017-07-01 13:09:45: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:45: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:45: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:45: ["Notebook"] -2017-07-01 13:09:45: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:45: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:45: [null] -2017-07-01 13:09:45: UPDATE `folders` SET `sync_time`=? WHERE id=? -2017-07-01 13:09:45: [1498910985838,"7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:45: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:45: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:09:46: SELECT * FROM deleted_items -2017-07-01 13:09:46: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:46: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:46: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:46: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:46: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:46: ["Notebook-1498910969401-461"] -2017-07-01 13:09:46: UPDATE `folders` SET `title`=?, `created_time`=?, `updated_time`=?, `sync_time`=? WHERE id=? -2017-07-01 13:09:46: ["Notebook-1498910969401-461","1498910969401","1498910980801",1498910986033,"68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:46: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:46: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:46: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:46: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:46: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:09:46: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:09:46: SELECT count(*) as total FROM `folders` -2017-07-01 13:09:46: SELECT count(*) as total FROM `notes` -2017-07-01 13:09:47: Database was open successfully -2017-07-01 13:09:47: Checking for database schema update... -2017-07-01 13:09:47: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:47: Current database version -2017-07-01 13:09:47: SELECT * FROM table_fields -2017-07-01 13:09:47: SELECT * FROM settings -2017-07-01 13:09:47: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:47: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:47: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:47: ["Notebook-1498910969401-461"] -2017-07-01 13:09:47: SELECT * FROM `folders` -2017-07-01 13:09:47: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:09:47: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:47: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:09:47: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:52: Database was open successfully -2017-07-01 13:09:52: Checking for database schema update... -2017-07-01 13:09:52: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:52: Current database version -2017-07-01 13:09:52: SELECT * FROM table_fields -2017-07-01 13:09:52: SELECT * FROM settings -2017-07-01 13:09:52: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:52: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:52: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:52: ["Notebook-1498910969401-461"] -2017-07-01 13:09:52: SELECT * FROM `folders` -2017-07-01 13:09:52: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:09:52: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:52: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:09:52: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:53: Database was open successfully -2017-07-01 13:09:53: Checking for database schema update... -2017-07-01 13:09:53: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:53: Current database version -2017-07-01 13:09:53: SELECT * FROM table_fields -2017-07-01 13:09:53: SELECT * FROM settings -2017-07-01 13:09:53: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:53: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:53: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:53: ["Notebook-1498910969401-461"] -2017-07-01 13:09:53: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:53: ["Notebook-1498910969401-461"] -2017-07-01 13:09:53: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:53: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:53: SELECT count(*) as total FROM `folders` -2017-07-01 13:09:53: SELECT id FROM notes WHERE is_conflict = 0 AND parent_id = ? -2017-07-01 13:09:53: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:53: DELETE FROM folders WHERE id = ? -2017-07-01 13:09:53: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:53: INSERT INTO deleted_items (item_type, item_id, deleted_time) VALUES (?, ?, ?) -2017-07-01 13:09:53: [2,"68cba53569c84bfbad79eee85402160b",1498910993916] -2017-07-01 13:09:54: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:09:55: Database was open successfully -2017-07-01 13:09:55: Checking for database schema update... -2017-07-01 13:09:55: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:55: Current database version -2017-07-01 13:09:55: SELECT * FROM table_fields -2017-07-01 13:09:55: SELECT * FROM settings -2017-07-01 13:09:55: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:55: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:55: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:09:55: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:55: ["Notebook-1498910969408-979"] -2017-07-01 13:09:55: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:55: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:09:55: SELECT * FROM deleted_items -2017-07-01 13:09:55: DELETE FROM deleted_items WHERE item_id = ? -2017-07-01 13:09:55: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:55: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:55: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:55: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:55: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:55: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:09:55: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:09:55: SELECT count(*) as total FROM `folders` -2017-07-01 13:09:55: SELECT count(*) as total FROM `notes` -2017-07-01 13:09:58: Database was open successfully -2017-07-01 13:09:58: Checking for database schema update... -2017-07-01 13:09:58: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:58: Current database version -2017-07-01 13:09:58: SELECT * FROM table_fields -2017-07-01 13:09:58: SELECT * FROM settings -2017-07-01 13:09:58: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:58: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:58: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:09:58: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:58: ["Notebook-1498910969408-979"] -2017-07-01 13:09:58: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:58: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:09:58: SELECT * FROM deleted_items -2017-07-01 13:09:58: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:09:58: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:09:58: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:58: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:58: SELECT count(*) as total FROM `folders` -2017-07-01 13:10:01: Database was open successfully -2017-07-01 13:10:01: Checking for database schema update... -2017-07-01 13:10:01: SELECT * FROM version LIMIT 1 -2017-07-01 13:10:01: Current database version -2017-07-01 13:10:01: SELECT * FROM table_fields -2017-07-01 13:10:01: SELECT * FROM settings -2017-07-01 13:10:01: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:10:01: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:10:01: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:10:01: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:10:01: ["Notebook-1498910969408-979"] -2017-07-01 13:10:01: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:10:01: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:10:01: SELECT * FROM deleted_items -2017-07-01 13:10:01: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:10:01: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:10:01: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:10:01: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:10:01: SELECT count(*) as total FROM `folders` -2017-07-01 13:10:02: Database was open successfully -2017-07-01 13:10:02: Checking for database schema update... -2017-07-01 13:10:02: SELECT * FROM version LIMIT 1 -2017-07-01 13:10:02: Current database version -2017-07-01 13:10:02: SELECT * FROM table_fields -2017-07-01 13:10:02: SELECT * FROM settings -2017-07-01 13:10:02: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:10:02: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:10:02: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:10:02: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:10:02: ["Notebook-1498910969408-979"] -2017-07-01 13:10:02: SELECT * FROM `folders` -2017-07-01 13:10:02: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:10:02: ["7711fd1e399e4219ba8f5f9e9eeefb16"] diff --git a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/log-sync.txt b/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/log-sync.txt deleted file mode 100644 index 97774189be..0000000000 --- a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/log-sync.txt +++ /dev/null @@ -1,92 +0,0 @@ -2017-07-01 13:09:38: Starting synchronization... [1498910978635] -2017-07-01 13:09:38: Sync: createRemote: remote does not exist, and local is new and has never been synced: (Local 68cba53569c84bfbad79eee85402160b, "Notebook") -2017-07-01 13:09:38: Sync: deleteRemote: local has been deleted: (Remote 351b927410b541e1a6d1a2a88ef7d1c0) -2017-07-01 13:09:39: Synchronization complete [1498910978635]: -2017-07-01 13:09:39: remotesToUpdate: 1 -2017-07-01 13:09:39: remotesToDelete: 1 -2017-07-01 13:09:39: localsToUdpate: - -2017-07-01 13:09:39: localsToDelete: - -2017-07-01 13:09:39: createLocal: - -2017-07-01 13:09:39: updateLocal: - -2017-07-01 13:09:39: deleteLocal: - -2017-07-01 13:09:39: createRemote: 1 -2017-07-01 13:09:39: updateRemote: - -2017-07-01 13:09:39: deleteRemote: 1 -2017-07-01 13:09:39: folderConflict: - -2017-07-01 13:09:39: noteConflict: - -2017-07-01 13:09:39: Total folders: 1 -2017-07-01 13:09:39: Total notes: 0 -2017-07-01 13:09:42: Starting synchronization... [1498910982477] -2017-07-01 13:09:42: Sync: createLocal: remote exists but local does not: (Remote 7711fd1e399e4219ba8f5f9e9eeefb16, "Notebook") -2017-07-01 13:09:42: Synchronization complete [1498910982477]: -2017-07-01 13:09:42: remotesToUpdate: - -2017-07-01 13:09:42: remotesToDelete: - -2017-07-01 13:09:42: localsToUdpate: 1 -2017-07-01 13:09:42: localsToDelete: - -2017-07-01 13:09:42: createLocal: 1 -2017-07-01 13:09:42: updateLocal: - -2017-07-01 13:09:42: deleteLocal: - -2017-07-01 13:09:42: createRemote: - -2017-07-01 13:09:42: updateRemote: - -2017-07-01 13:09:42: deleteRemote: - -2017-07-01 13:09:42: folderConflict: - -2017-07-01 13:09:42: noteConflict: - -2017-07-01 13:09:42: Total folders: 2 -2017-07-01 13:09:42: Total notes: 0 -2017-07-01 13:09:45: Starting synchronization... [1498910985800] -2017-07-01 13:09:45: Sync: updateRemote: local has changes: (Local 7711fd1e399e4219ba8f5f9e9eeefb16, "Notebook-1498910969408-979"): (Remote ) -2017-07-01 13:09:46: Sync: updateLocal: remote is more recent than local: (Local 68cba53569c84bfbad79eee85402160b, "Notebook"): (Remote 68cba53569c84bfbad79eee85402160b, "Notebook-1498910969401-461") -2017-07-01 13:09:46: Synchronization complete [1498910985800]: -2017-07-01 13:09:46: remotesToUpdate: 1 -2017-07-01 13:09:46: remotesToDelete: - -2017-07-01 13:09:46: localsToUdpate: 1 -2017-07-01 13:09:46: localsToDelete: - -2017-07-01 13:09:46: createLocal: - -2017-07-01 13:09:46: updateLocal: 1 -2017-07-01 13:09:46: deleteLocal: - -2017-07-01 13:09:46: createRemote: - -2017-07-01 13:09:46: updateRemote: 1 -2017-07-01 13:09:46: deleteRemote: - -2017-07-01 13:09:46: folderConflict: - -2017-07-01 13:09:46: noteConflict: - -2017-07-01 13:09:46: Total folders: 2 -2017-07-01 13:09:46: Total notes: 0 -2017-07-01 13:09:55: Starting synchronization... [1498910995526] -2017-07-01 13:09:55: Sync: deleteRemote: local has been deleted: (Remote 68cba53569c84bfbad79eee85402160b) -2017-07-01 13:09:55: Synchronization complete [1498910995526]: -2017-07-01 13:09:55: remotesToUpdate: - -2017-07-01 13:09:55: remotesToDelete: 1 -2017-07-01 13:09:55: localsToUdpate: - -2017-07-01 13:09:55: localsToDelete: - -2017-07-01 13:09:55: createLocal: - -2017-07-01 13:09:55: updateLocal: - -2017-07-01 13:09:55: deleteLocal: - -2017-07-01 13:09:55: createRemote: - -2017-07-01 13:09:55: updateRemote: - -2017-07-01 13:09:55: deleteRemote: 1 -2017-07-01 13:09:55: folderConflict: - -2017-07-01 13:09:55: noteConflict: - -2017-07-01 13:09:55: Total folders: 1 -2017-07-01 13:09:55: Total notes: 0 -2017-07-01 13:09:58: Starting synchronization... [1498910998834] -2017-07-01 13:09:58: Sync: deleteLocal: remote has been deleted: (Local 7711fd1e399e4219ba8f5f9e9eeefb16) -2017-07-01 13:09:58: Error: Cannot delete the last notebook -Error: Cannot delete the last notebook - at Function._callee$ (/mnt/d/Web/www/joplin/CliClient/app/lib/models/folder.js:59:25) - at tryCatch (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:65:40) - at GeneratorFunctionPrototype.invoke [as _invoke] (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:303:22) - at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:117:21) - at step (/mnt/d/Web/www/joplin/CliClient/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30) - at /mnt/d/Web/www/joplin/CliClient/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13 - at process._tickCallback (internal/process/next_tick.js:109:7) -2017-07-01 13:10:01: Starting synchronization... [1498911001597] -2017-07-01 13:10:01: Sync: deleteLocal: remote has been deleted: (Local 7711fd1e399e4219ba8f5f9e9eeefb16) -2017-07-01 13:10:01: Error: Cannot delete the last notebook -Error: Cannot delete the last notebook - at Function._callee$ (/mnt/d/Web/www/joplin/CliClient/app/lib/models/folder.js:59:25) - at tryCatch (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:65:40) - at GeneratorFunctionPrototype.invoke [as _invoke] (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:303:22) - at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:117:21) - at step (/mnt/d/Web/www/joplin/CliClient/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30) - at /mnt/d/Web/www/joplin/CliClient/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13 - at process._tickCallback (internal/process/next_tick.js:109:7) diff --git a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/log.txt b/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/log.txt deleted file mode 100644 index ca0a75ce8c..0000000000 --- a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client0/log.txt +++ /dev/null @@ -1,54 +0,0 @@ -2017-07-01 13:09:29: Starting joplin-cli 0.8.27... -2017-07-01 13:09:29: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:31: Starting joplin-cli 0.8.27... -2017-07-01 13:09:31: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:33: Starting joplin-cli 0.8.27... -2017-07-01 13:09:33: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:35: Starting joplin-cli 0.8.27... -2017-07-01 13:09:35: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:36: Starting joplin-cli 0.8.27... -2017-07-01 13:09:36: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:38: Starting joplin-cli 0.8.27... -2017-07-01 13:09:38: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:38: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:09:38: stat /var/www/joplin/CliClient/tests/fuzzing/sync/68cba53569c84bfbad79eee85402160b.md -2017-07-01 13:09:38: put /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/68cba53569c84bfbad79eee85402160b.md_1498910978660 -2017-07-01 13:09:38: setTimestamp /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/68cba53569c84bfbad79eee85402160b.md_1498910978660 -2017-07-01 13:09:38: move /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/68cba53569c84bfbad79eee85402160b.md_1498910978660 => /var/www/joplin/CliClient/tests/fuzzing/sync/68cba53569c84bfbad79eee85402160b.md -2017-07-01 13:09:38: delete /var/www/joplin/CliClient/tests/fuzzing/sync/351b927410b541e1a6d1a2a88ef7d1c0.md -2017-07-01 13:09:39: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:09:42: Starting joplin-cli 0.8.27... -2017-07-01 13:09:42: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:42: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:09:42: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:09:42: get /var/www/joplin/CliClient/tests/fuzzing/sync/7711fd1e399e4219ba8f5f9e9eeefb16.md -2017-07-01 13:09:45: Starting joplin-cli 0.8.27... -2017-07-01 13:09:45: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:45: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:09:45: stat /var/www/joplin/CliClient/tests/fuzzing/sync/7711fd1e399e4219ba8f5f9e9eeefb16.md -2017-07-01 13:09:45: put /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/7711fd1e399e4219ba8f5f9e9eeefb16.md_1498910985820 -2017-07-01 13:09:45: setTimestamp /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/7711fd1e399e4219ba8f5f9e9eeefb16.md_1498910985820 -2017-07-01 13:09:45: move /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/7711fd1e399e4219ba8f5f9e9eeefb16.md_1498910985820 => /var/www/joplin/CliClient/tests/fuzzing/sync/7711fd1e399e4219ba8f5f9e9eeefb16.md -2017-07-01 13:09:46: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:09:46: get /var/www/joplin/CliClient/tests/fuzzing/sync/68cba53569c84bfbad79eee85402160b.md -2017-07-01 13:09:47: Starting joplin-cli 0.8.27... -2017-07-01 13:09:47: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:52: Starting joplin-cli 0.8.27... -2017-07-01 13:09:52: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:53: Starting joplin-cli 0.8.27... -2017-07-01 13:09:53: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:55: Starting joplin-cli 0.8.27... -2017-07-01 13:09:55: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:55: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:09:55: delete /var/www/joplin/CliClient/tests/fuzzing/sync/68cba53569c84bfbad79eee85402160b.md -2017-07-01 13:09:55: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:09:58: Starting joplin-cli 0.8.27... -2017-07-01 13:09:58: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:09:58: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:09:58: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:10:01: Starting joplin-cli 0.8.27... -2017-07-01 13:10:01: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 -2017-07-01 13:10:01: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:10:01: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:10:02: Starting joplin-cli 0.8.27... -2017-07-01 13:10:02: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client0 diff --git a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/database.sqlite b/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/database.sqlite deleted file mode 100644 index 65c8c17f9f..0000000000 Binary files a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/database.sqlite and /dev/null differ diff --git a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/log-database.txt b/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/log-database.txt deleted file mode 100644 index d327afe8c0..0000000000 --- a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/log-database.txt +++ /dev/null @@ -1,454 +0,0 @@ -2017-07-01 13:09:29: Database was open successfully -2017-07-01 13:09:29: Checking for database schema update... -2017-07-01 13:09:29: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:29: Database is new - creating the schema... -2017-07-01 13:09:29: BEGIN TRANSACTION -2017-07-01 13:09:29: CREATE TABLE folders ( id TEXT PRIMARY KEY, parent_id TEXT NOT NULL DEFAULT "", title TEXT NOT NULL DEFAULT "", created_time INT NOT NULL DEFAULT 0, updated_time INT NOT NULL DEFAULT 0, sync_time INT NOT NULL DEFAULT 0); -2017-07-01 13:09:29: CREATE INDEX folders_title ON folders (title); -2017-07-01 13:09:29: CREATE INDEX folders_updated_time ON folders (updated_time); -2017-07-01 13:09:29: CREATE INDEX folders_sync_time ON folders (sync_time); -2017-07-01 13:09:29: CREATE TABLE notes ( id TEXT PRIMARY KEY, parent_id TEXT NOT NULL DEFAULT "", title TEXT NOT NULL DEFAULT "", body TEXT NOT NULL DEFAULT "", created_time INT NOT NULL DEFAULT 0, updated_time INT NOT NULL DEFAULT 0, sync_time INT NOT NULL DEFAULT 0, is_conflict INT NOT NULL DEFAULT 0, latitude NUMERIC NOT NULL DEFAULT 0, longitude NUMERIC NOT NULL DEFAULT 0, altitude NUMERIC NOT NULL DEFAULT 0, author TEXT NOT NULL DEFAULT "", source_url TEXT NOT NULL DEFAULT "", is_todo INT NOT NULL DEFAULT 0, todo_due INT NOT NULL DEFAULT 0, todo_completed INT NOT NULL DEFAULT 0, source TEXT NOT NULL DEFAULT "", source_application TEXT NOT NULL DEFAULT "", application_data TEXT NOT NULL DEFAULT "", `order` INT NOT NULL DEFAULT 0); -2017-07-01 13:09:29: CREATE INDEX notes_title ON notes (title); -2017-07-01 13:09:29: CREATE INDEX notes_updated_time ON notes (updated_time); -2017-07-01 13:09:29: CREATE INDEX notes_sync_time ON notes (sync_time); -2017-07-01 13:09:29: CREATE INDEX notes_is_conflict ON notes (is_conflict); -2017-07-01 13:09:29: CREATE INDEX notes_is_todo ON notes (is_todo); -2017-07-01 13:09:29: CREATE INDEX notes_order ON notes (`order`); -2017-07-01 13:09:29: CREATE TABLE deleted_items ( id INTEGER PRIMARY KEY, item_type INT NOT NULL, item_id TEXT NOT NULL, deleted_time INT NOT NULL); -2017-07-01 13:09:29: CREATE TABLE tags ( id TEXT PRIMARY KEY, title TEXT, created_time INT, updated_time INT); -2017-07-01 13:09:29: CREATE TABLE note_tags ( id INTEGER PRIMARY KEY, note_id TEXT, tag_id TEXT); -2017-07-01 13:09:29: CREATE TABLE resources ( id TEXT PRIMARY KEY, title TEXT, mime TEXT, filename TEXT, created_time INT, updated_time INT); -2017-07-01 13:09:29: CREATE TABLE note_resources ( id INTEGER PRIMARY KEY, note_id TEXT, resource_id TEXT); -2017-07-01 13:09:29: CREATE TABLE version ( version INT); -2017-07-01 13:09:29: CREATE TABLE changes ( id INTEGER PRIMARY KEY, `type` INT, item_id TEXT, item_type INT, item_field TEXT); -2017-07-01 13:09:29: CREATE TABLE settings ( `key` TEXT PRIMARY KEY, `value` TEXT, `type` INT); -2017-07-01 13:09:29: CREATE TABLE table_fields ( id INTEGER PRIMARY KEY, table_name TEXT, field_name TEXT, field_type INT, field_default TEXT); -2017-07-01 13:09:29: CREATE TABLE item_sync_times ( id INTEGER PRIMARY KEY, item_id TEXT, `time` INT); -2017-07-01 13:09:29: INSERT INTO version (version) VALUES (1); -2017-07-01 13:09:29: INSERT INTO settings (`key`, `value`, `type`) VALUES ("clientId", "7b3e8c87485342b48080ef4c71bc3deb", "2") -2017-07-01 13:09:29: INSERT INTO `folders` (`id`, `title`, `created_time`, `updated_time`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:29: ["7711fd1e399e4219ba8f5f9e9eeefb16","Notebook",1498910969408,1498910969408] -2017-07-01 13:09:29: COMMIT -2017-07-01 13:09:29: Database schema created successfully -2017-07-01 13:09:29: Initializing tables... -2017-07-01 13:09:29: SELECT name FROM sqlite_master WHERE type="table" -2017-07-01 13:09:29: PRAGMA table_info("folders") -2017-07-01 13:09:29: PRAGMA table_info("notes") -2017-07-01 13:09:29: PRAGMA table_info("deleted_items") -2017-07-01 13:09:29: PRAGMA table_info("tags") -2017-07-01 13:09:29: PRAGMA table_info("note_tags") -2017-07-01 13:09:29: PRAGMA table_info("resources") -2017-07-01 13:09:29: PRAGMA table_info("note_resources") -2017-07-01 13:09:29: PRAGMA table_info("version") -2017-07-01 13:09:29: PRAGMA table_info("changes") -2017-07-01 13:09:29: PRAGMA table_info("settings") -2017-07-01 13:09:29: PRAGMA table_info("item_sync_times") -2017-07-01 13:09:29: BEGIN TRANSACTION -2017-07-01 13:09:29: DELETE FROM table_fields -2017-07-01 13:09:29: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:29: ["folders","id",2,null] -2017-07-01 13:09:29: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:29: ["folders","parent_id",2,""] -2017-07-01 13:09:29: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["folders","title",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["folders","created_time",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["folders","updated_time",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["folders","sync_time",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","parent_id",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","title",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","body",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","created_time",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","updated_time",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","sync_time",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","is_conflict",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","latitude",3,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","longitude",3,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","altitude",3,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","author",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","source_url",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","is_todo",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","todo_due",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","todo_completed",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","source",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","source_application",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","application_data",2,""] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["notes","order",1,"0"] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["deleted_items","id",null,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["deleted_items","item_type",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["deleted_items","item_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["deleted_items","deleted_time",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["tags","id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["tags","title",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["tags","created_time",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["tags","updated_time",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_tags","id",null,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_tags","note_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_tags","tag_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","title",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","mime",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","filename",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","created_time",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["resources","updated_time",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_resources","id",null,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_resources","note_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["note_resources","resource_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["version","version",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["changes","id",null,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["changes","type",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["changes","item_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["changes","item_type",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["changes","item_field",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["settings","key",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["settings","value",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["settings","type",1,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["item_sync_times","id",null,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["item_sync_times","item_id",2,null] -2017-07-01 13:09:30: INSERT INTO `table_fields` (`table_name`, `field_name`, `field_type`, `field_default`) VALUES (?, ?, ?, ?) -2017-07-01 13:09:30: ["item_sync_times","time",1,null] -2017-07-01 13:09:30: COMMIT -2017-07-01 13:09:30: Checking for database schema update... -2017-07-01 13:09:30: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:30: Current database version -2017-07-01 13:09:30: SELECT * FROM table_fields -2017-07-01 13:09:30: SELECT * FROM settings -2017-07-01 13:09:30: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:09:30: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:30: ["Notebook"] -2017-07-01 13:09:30: Saving settings... -2017-07-01 13:09:30: BEGIN TRANSACTION -2017-07-01 13:09:30: DELETE FROM settings -2017-07-01 13:09:30: INSERT INTO `settings` (`key`, `value`, `type`) VALUES (?, ?, ?) -2017-07-01 13:09:30: ["clientId","7b3e8c87485342b48080ef4c71bc3deb",2] -2017-07-01 13:09:30: INSERT INTO `settings` (`value`, `type`, `key`) VALUES (?, ?, ?) -2017-07-01 13:09:30: ["7711fd1e399e4219ba8f5f9e9eeefb16","string","activeFolderId"] -2017-07-01 13:09:30: INSERT INTO `settings` (`value`, `type`, `key`) VALUES (?, ?, ?) -2017-07-01 13:09:30: ["local","string","sync.target"] -2017-07-01 13:09:30: COMMIT -2017-07-01 13:09:30: Settings have been saved. -2017-07-01 13:09:32: Database was open successfully -2017-07-01 13:09:32: Checking for database schema update... -2017-07-01 13:09:32: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:32: Current database version -2017-07-01 13:09:32: SELECT * FROM table_fields -2017-07-01 13:09:32: SELECT * FROM settings -2017-07-01 13:09:32: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:32: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:32: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:32: ["Notebook"] -2017-07-01 13:09:32: Saving settings... -2017-07-01 13:09:32: BEGIN TRANSACTION -2017-07-01 13:09:32: DELETE FROM settings -2017-07-01 13:09:32: INSERT INTO `settings` (`key`, `value`, `type`) VALUES (?, ?, ?) -2017-07-01 13:09:32: ["clientId","7b3e8c87485342b48080ef4c71bc3deb",2] -2017-07-01 13:09:32: INSERT INTO `settings` (`key`, `value`, `type`) VALUES (?, ?, ?) -2017-07-01 13:09:32: ["activeFolderId","7711fd1e399e4219ba8f5f9e9eeefb16","string"] -2017-07-01 13:09:32: INSERT INTO `settings` (`key`, `value`, `type`) VALUES (?, ?, ?) -2017-07-01 13:09:32: ["sync.target","local","string"] -2017-07-01 13:09:32: INSERT INTO `settings` (`value`, `type`, `key`) VALUES (?, ?, ?) -2017-07-01 13:09:32: ["/var/www/joplin/CliClient/tests/fuzzing/sync","string","sync.local.path"] -2017-07-01 13:09:32: COMMIT -2017-07-01 13:09:32: Settings have been saved. -2017-07-01 13:09:33: Database was open successfully -2017-07-01 13:09:33: Checking for database schema update... -2017-07-01 13:09:33: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:33: Current database version -2017-07-01 13:09:33: SELECT * FROM table_fields -2017-07-01 13:09:33: SELECT * FROM settings -2017-07-01 13:09:33: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:33: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:33: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:33: ["Notebook"] -2017-07-01 13:09:33: SELECT * FROM `folders` -2017-07-01 13:09:33: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:09:33: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:35: Database was open successfully -2017-07-01 13:09:35: Checking for database schema update... -2017-07-01 13:09:35: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:35: Current database version -2017-07-01 13:09:35: SELECT * FROM table_fields -2017-07-01 13:09:35: SELECT * FROM settings -2017-07-01 13:09:35: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:35: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:35: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:35: ["Notebook"] -2017-07-01 13:09:35: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:35: ["Notebook"] -2017-07-01 13:09:35: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:35: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:35: SELECT count(*) as total FROM `folders` -2017-07-01 13:09:40: Database was open successfully -2017-07-01 13:09:40: Checking for database schema update... -2017-07-01 13:09:40: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:40: Current database version -2017-07-01 13:09:40: SELECT * FROM table_fields -2017-07-01 13:09:40: SELECT * FROM settings -2017-07-01 13:09:40: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:40: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:40: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:40: ["Notebook"] -2017-07-01 13:09:40: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:40: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:40: [null] -2017-07-01 13:09:40: UPDATE `folders` SET `sync_time`=? WHERE id=? -2017-07-01 13:09:40: [1498910980584,"7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:40: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:40: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:09:40: SELECT * FROM deleted_items -2017-07-01 13:09:40: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:40: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:40: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:40: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:40: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:40: ["Notebook"] -2017-07-01 13:09:40: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:40: ["Notebook-1498910969401-461"] -2017-07-01 13:09:40: INSERT INTO `folders` (`id`, `title`, `created_time`, `updated_time`, `sync_time`) VALUES (?, ?, ?, ?, ?) -2017-07-01 13:09:40: ["68cba53569c84bfbad79eee85402160b","Notebook-1498910969401-461","1498910969401",1498910980801,1498910980799] -2017-07-01 13:09:41: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:41: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:41: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:41: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:41: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:09:41: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:09:41: SELECT count(*) as total FROM `folders` -2017-07-01 13:09:41: SELECT count(*) as total FROM `notes` -2017-07-01 13:09:43: Database was open successfully -2017-07-01 13:09:43: Checking for database schema update... -2017-07-01 13:09:44: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:44: Current database version -2017-07-01 13:09:44: SELECT * FROM table_fields -2017-07-01 13:09:44: SELECT * FROM settings -2017-07-01 13:09:44: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:44: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:44: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:44: ["Notebook"] -2017-07-01 13:09:44: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:44: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:44: [null] -2017-07-01 13:09:44: UPDATE `folders` SET `sync_time`=? WHERE id=? -2017-07-01 13:09:44: [1498910984142,"68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:44: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:44: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:09:44: SELECT * FROM deleted_items -2017-07-01 13:09:44: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:44: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:44: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:44: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:44: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:44: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:44: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:44: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:44: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:09:44: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:09:44: SELECT count(*) as total FROM `folders` -2017-07-01 13:09:44: SELECT count(*) as total FROM `notes` -2017-07-01 13:09:48: Database was open successfully -2017-07-01 13:09:48: Checking for database schema update... -2017-07-01 13:09:48: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:48: Current database version -2017-07-01 13:09:48: SELECT * FROM table_fields -2017-07-01 13:09:48: SELECT * FROM settings -2017-07-01 13:09:48: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:48: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:48: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:48: ["Notebook"] -2017-07-01 13:09:48: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:48: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:09:48: SELECT * FROM deleted_items -2017-07-01 13:09:49: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:49: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:49: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:49: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:49: SELECT * FROM `notes` WHERE `id` = ? -2017-07-01 13:09:49: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:49: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:49: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:49: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:49: ["Notebook-1498910969408-979"] -2017-07-01 13:09:49: UPDATE `folders` SET `title`=?, `created_time`=?, `updated_time`=?, `sync_time`=? WHERE id=? -2017-07-01 13:09:49: ["Notebook-1498910969408-979","1498910969408","1498910982544",1498910989054,"7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:49: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:09:49: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:09:49: SELECT count(*) as total FROM `folders` -2017-07-01 13:09:49: SELECT count(*) as total FROM `notes` -2017-07-01 13:09:50: Database was open successfully -2017-07-01 13:09:50: Checking for database schema update... -2017-07-01 13:09:50: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:50: Current database version -2017-07-01 13:09:50: SELECT * FROM table_fields -2017-07-01 13:09:50: SELECT * FROM settings -2017-07-01 13:09:50: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:50: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:50: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:50: ["Notebook-1498910969408-979"] -2017-07-01 13:09:50: SELECT * FROM `folders` -2017-07-01 13:09:50: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:09:50: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:50: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:09:50: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:52: Database was open successfully -2017-07-01 13:09:52: Checking for database schema update... -2017-07-01 13:09:52: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:52: Current database version -2017-07-01 13:09:52: SELECT * FROM table_fields -2017-07-01 13:09:52: SELECT * FROM settings -2017-07-01 13:09:52: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:52: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:52: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:52: ["Notebook-1498910969408-979"] -2017-07-01 13:09:52: SELECT * FROM `folders` -2017-07-01 13:09:52: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:09:52: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:52: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:09:52: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:53: Database was open successfully -2017-07-01 13:09:53: Checking for database schema update... -2017-07-01 13:09:53: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:53: Current database version -2017-07-01 13:09:53: SELECT * FROM table_fields -2017-07-01 13:09:53: SELECT * FROM settings -2017-07-01 13:09:53: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:53: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:53: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:53: ["Notebook-1498910969408-979"] -2017-07-01 13:09:53: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:53: ["Notebook-1498910969408-979"] -2017-07-01 13:09:53: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:53: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:53: SELECT count(*) as total FROM `folders` -2017-07-01 13:09:53: SELECT id FROM notes WHERE is_conflict = 0 AND parent_id = ? -2017-07-01 13:09:53: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:53: DELETE FROM folders WHERE id = ? -2017-07-01 13:09:53: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:53: INSERT INTO deleted_items (item_type, item_id, deleted_time) VALUES (?, ?, ?) -2017-07-01 13:09:53: [2,"7711fd1e399e4219ba8f5f9e9eeefb16",1498910993660] -2017-07-01 13:09:53: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:09:57: Database was open successfully -2017-07-01 13:09:57: Checking for database schema update... -2017-07-01 13:09:57: SELECT * FROM version LIMIT 1 -2017-07-01 13:09:57: Current database version -2017-07-01 13:09:57: SELECT * FROM table_fields -2017-07-01 13:09:57: SELECT * FROM settings -2017-07-01 13:09:57: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:57: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:57: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:09:57: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:09:57: ["Notebook-1498910969401-461"] -2017-07-01 13:09:57: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:09:57: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:09:57: SELECT * FROM deleted_items -2017-07-01 13:09:57: DELETE FROM deleted_items WHERE item_id = ? -2017-07-01 13:09:57: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:09:57: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:09:57: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:09:57: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:09:57: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:09:57: SELECT count(*) as total FROM `folders` -2017-07-01 13:10:00: Database was open successfully -2017-07-01 13:10:00: Checking for database schema update... -2017-07-01 13:10:00: SELECT * FROM version LIMIT 1 -2017-07-01 13:10:00: Current database version -2017-07-01 13:10:00: SELECT * FROM table_fields -2017-07-01 13:10:00: SELECT * FROM settings -2017-07-01 13:10:00: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:10:00: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:10:00: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:10:00: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:10:00: ["Notebook-1498910969401-461"] -2017-07-01 13:10:00: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:10:00: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:10:00: SELECT * FROM deleted_items -2017-07-01 13:10:00: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:10:00: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:10:00: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:10:00: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:10:00: SELECT count(*) as total FROM `folders` -2017-07-01 13:10:04: Database was open successfully -2017-07-01 13:10:04: Checking for database schema update... -2017-07-01 13:10:04: SELECT * FROM version LIMIT 1 -2017-07-01 13:10:04: Current database version -2017-07-01 13:10:04: SELECT * FROM table_fields -2017-07-01 13:10:04: SELECT * FROM settings -2017-07-01 13:10:04: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:10:04: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:10:04: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:10:04: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:10:04: ["Notebook-1498910969401-461"] -2017-07-01 13:10:04: SELECT * FROM folders WHERE sync_time < updated_time LIMIT 100 -2017-07-01 13:10:04: SELECT * FROM notes WHERE sync_time < updated_time AND is_conflict = 0 LIMIT 100 -2017-07-01 13:10:04: SELECT * FROM deleted_items -2017-07-01 13:10:04: SELECT id FROM folders WHERE sync_time > 0 -2017-07-01 13:10:04: SELECT id FROM notes WHERE is_conflict = 0 AND sync_time > 0 -2017-07-01 13:10:04: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:10:04: ["68cba53569c84bfbad79eee85402160b"] -2017-07-01 13:10:04: SELECT count(*) as total FROM `folders` -2017-07-01 13:10:05: Database was open successfully -2017-07-01 13:10:05: Checking for database schema update... -2017-07-01 13:10:05: SELECT * FROM version LIMIT 1 -2017-07-01 13:10:05: Current database version -2017-07-01 13:10:05: SELECT * FROM table_fields -2017-07-01 13:10:05: SELECT * FROM settings -2017-07-01 13:10:05: SELECT * FROM `folders` WHERE `id` = ? -2017-07-01 13:10:05: ["7711fd1e399e4219ba8f5f9e9eeefb16"] -2017-07-01 13:10:05: SELECT * FROM folders ORDER BY created_time DESC LIMIT 1 -2017-07-01 13:10:05: SELECT * FROM `folders` WHERE `title` = ? -2017-07-01 13:10:05: ["Notebook-1498910969401-461"] -2017-07-01 13:10:05: SELECT * FROM `folders` -2017-07-01 13:10:05: SELECT `id`,`title`,`body`,`is_todo`,`todo_completed`,`parent_id`,`updated_time` FROM notes WHERE is_conflict = 0 AND parent_id = ? ORDER BY updated_time DESC -2017-07-01 13:10:05: ["68cba53569c84bfbad79eee85402160b"] diff --git a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/log-sync.txt b/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/log-sync.txt deleted file mode 100644 index 8accee81a6..0000000000 --- a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/log-sync.txt +++ /dev/null @@ -1,86 +0,0 @@ -2017-07-01 13:09:40: Starting synchronization... [1498910980547] -2017-07-01 13:09:40: Sync: createRemote: remote does not exist, and local is new and has never been synced: (Local 7711fd1e399e4219ba8f5f9e9eeefb16, "Notebook") -2017-07-01 13:09:40: Sync: createLocal: remote exists but local does not: (Remote 68cba53569c84bfbad79eee85402160b, "Notebook") -2017-07-01 13:09:41: Synchronization complete [1498910980547]: -2017-07-01 13:09:41: remotesToUpdate: 1 -2017-07-01 13:09:41: remotesToDelete: - -2017-07-01 13:09:41: localsToUdpate: 1 -2017-07-01 13:09:41: localsToDelete: - -2017-07-01 13:09:41: createLocal: 1 -2017-07-01 13:09:41: updateLocal: - -2017-07-01 13:09:41: deleteLocal: - -2017-07-01 13:09:41: createRemote: 1 -2017-07-01 13:09:41: updateRemote: - -2017-07-01 13:09:41: deleteRemote: - -2017-07-01 13:09:41: folderConflict: - -2017-07-01 13:09:41: noteConflict: - -2017-07-01 13:09:41: Total folders: 2 -2017-07-01 13:09:41: Total notes: 0 -2017-07-01 13:09:44: Starting synchronization... [1498910984088] -2017-07-01 13:09:44: Sync: updateRemote: local has changes: (Local 68cba53569c84bfbad79eee85402160b, "Notebook-1498910969401-461"): (Remote ) -2017-07-01 13:09:44: Synchronization complete [1498910984088]: -2017-07-01 13:09:44: remotesToUpdate: 1 -2017-07-01 13:09:44: remotesToDelete: - -2017-07-01 13:09:44: localsToUdpate: - -2017-07-01 13:09:44: localsToDelete: - -2017-07-01 13:09:44: createLocal: - -2017-07-01 13:09:44: updateLocal: - -2017-07-01 13:09:44: deleteLocal: - -2017-07-01 13:09:44: createRemote: - -2017-07-01 13:09:44: updateRemote: 1 -2017-07-01 13:09:44: deleteRemote: - -2017-07-01 13:09:44: folderConflict: - -2017-07-01 13:09:44: noteConflict: - -2017-07-01 13:09:44: Total folders: 2 -2017-07-01 13:09:44: Total notes: 0 -2017-07-01 13:09:48: Starting synchronization... [1498910988979] -2017-07-01 13:09:49: Sync: updateLocal: remote is more recent than local: (Local 7711fd1e399e4219ba8f5f9e9eeefb16, "Notebook"): (Remote 7711fd1e399e4219ba8f5f9e9eeefb16, "Notebook-1498910969408-979") -2017-07-01 13:09:49: Synchronization complete [1498910988979]: -2017-07-01 13:09:49: remotesToUpdate: - -2017-07-01 13:09:49: remotesToDelete: - -2017-07-01 13:09:49: localsToUdpate: 1 -2017-07-01 13:09:49: localsToDelete: - -2017-07-01 13:09:49: createLocal: - -2017-07-01 13:09:49: updateLocal: 1 -2017-07-01 13:09:49: deleteLocal: - -2017-07-01 13:09:49: createRemote: - -2017-07-01 13:09:49: updateRemote: - -2017-07-01 13:09:49: deleteRemote: - -2017-07-01 13:09:49: folderConflict: - -2017-07-01 13:09:49: noteConflict: - -2017-07-01 13:09:49: Total folders: 2 -2017-07-01 13:09:49: Total notes: 0 -2017-07-01 13:09:57: Starting synchronization... [1498910997207] -2017-07-01 13:09:57: Sync: deleteRemote: local has been deleted: (Remote 7711fd1e399e4219ba8f5f9e9eeefb16) -2017-07-01 13:09:57: Sync: deleteLocal: remote has been deleted: (Local 68cba53569c84bfbad79eee85402160b) -2017-07-01 13:09:57: Error: Cannot delete the last notebook -Error: Cannot delete the last notebook - at Function._callee$ (/mnt/d/Web/www/joplin/CliClient/app/lib/models/folder.js:59:25) - at tryCatch (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:65:40) - at GeneratorFunctionPrototype.invoke [as _invoke] (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:303:22) - at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:117:21) - at step (/mnt/d/Web/www/joplin/CliClient/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30) - at /mnt/d/Web/www/joplin/CliClient/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13 - at process._tickCallback (internal/process/next_tick.js:109:7) -2017-07-01 13:10:00: Starting synchronization... [1498911000231] -2017-07-01 13:10:00: Sync: deleteLocal: remote has been deleted: (Local 68cba53569c84bfbad79eee85402160b) -2017-07-01 13:10:00: Error: Cannot delete the last notebook -Error: Cannot delete the last notebook - at Function._callee$ (/mnt/d/Web/www/joplin/CliClient/app/lib/models/folder.js:59:25) - at tryCatch (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:65:40) - at GeneratorFunctionPrototype.invoke [as _invoke] (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:303:22) - at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:117:21) - at step (/mnt/d/Web/www/joplin/CliClient/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30) - at /mnt/d/Web/www/joplin/CliClient/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13 - at process._tickCallback (internal/process/next_tick.js:109:7) -2017-07-01 13:10:04: Starting synchronization... [1498911004265] -2017-07-01 13:10:04: Sync: deleteLocal: remote has been deleted: (Local 68cba53569c84bfbad79eee85402160b) -2017-07-01 13:10:04: Error: Cannot delete the last notebook -Error: Cannot delete the last notebook - at Function._callee$ (/mnt/d/Web/www/joplin/CliClient/app/lib/models/folder.js:59:25) - at tryCatch (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:65:40) - at GeneratorFunctionPrototype.invoke [as _invoke] (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:303:22) - at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/mnt/d/Web/www/joplin/CliClient/node_modules/regenerator-runtime/runtime.js:117:21) - at step (/mnt/d/Web/www/joplin/CliClient/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30) - at /mnt/d/Web/www/joplin/CliClient/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13 - at process._tickCallback (internal/process/next_tick.js:109:7) diff --git a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/log.txt b/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/log.txt deleted file mode 100644 index d0133ebf2f..0000000000 --- a/CliClient/tests/fuzzing.ITEMCOUNTDIFF/client1/log.txt +++ /dev/null @@ -1,51 +0,0 @@ -2017-07-01 13:09:29: Starting joplin-cli 0.8.27... -2017-07-01 13:09:29: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:09:32: Starting joplin-cli 0.8.27... -2017-07-01 13:09:32: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:09:33: Starting joplin-cli 0.8.27... -2017-07-01 13:09:33: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:09:35: Starting joplin-cli 0.8.27... -2017-07-01 13:09:35: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:09:40: Starting joplin-cli 0.8.27... -2017-07-01 13:09:40: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:09:40: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:09:40: stat /var/www/joplin/CliClient/tests/fuzzing/sync/7711fd1e399e4219ba8f5f9e9eeefb16.md -2017-07-01 13:09:40: put /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/7711fd1e399e4219ba8f5f9e9eeefb16.md_1498910980567 -2017-07-01 13:09:40: setTimestamp /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/7711fd1e399e4219ba8f5f9e9eeefb16.md_1498910980567 -2017-07-01 13:09:40: move /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/7711fd1e399e4219ba8f5f9e9eeefb16.md_1498910980567 => /var/www/joplin/CliClient/tests/fuzzing/sync/7711fd1e399e4219ba8f5f9e9eeefb16.md -2017-07-01 13:09:40: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:09:40: get /var/www/joplin/CliClient/tests/fuzzing/sync/68cba53569c84bfbad79eee85402160b.md -2017-07-01 13:09:43: Starting joplin-cli 0.8.27... -2017-07-01 13:09:43: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:09:44: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:09:44: stat /var/www/joplin/CliClient/tests/fuzzing/sync/68cba53569c84bfbad79eee85402160b.md -2017-07-01 13:09:44: put /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/68cba53569c84bfbad79eee85402160b.md_1498910984114 -2017-07-01 13:09:44: setTimestamp /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/68cba53569c84bfbad79eee85402160b.md_1498910984114 -2017-07-01 13:09:44: move /var/www/joplin/CliClient/tests/fuzzing/sync/.sync/68cba53569c84bfbad79eee85402160b.md_1498910984114 => /var/www/joplin/CliClient/tests/fuzzing/sync/68cba53569c84bfbad79eee85402160b.md -2017-07-01 13:09:44: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:09:48: Starting joplin-cli 0.8.27... -2017-07-01 13:09:48: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:09:48: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:09:49: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:09:49: get /var/www/joplin/CliClient/tests/fuzzing/sync/7711fd1e399e4219ba8f5f9e9eeefb16.md -2017-07-01 13:09:50: Starting joplin-cli 0.8.27... -2017-07-01 13:09:50: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:09:52: Starting joplin-cli 0.8.27... -2017-07-01 13:09:52: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:09:53: Starting joplin-cli 0.8.27... -2017-07-01 13:09:53: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:09:57: Starting joplin-cli 0.8.27... -2017-07-01 13:09:57: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:09:57: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:09:57: delete /var/www/joplin/CliClient/tests/fuzzing/sync/7711fd1e399e4219ba8f5f9e9eeefb16.md -2017-07-01 13:09:57: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:10:00: Starting joplin-cli 0.8.27... -2017-07-01 13:10:00: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:10:00: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:10:00: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:10:04: Starting joplin-cli 0.8.27... -2017-07-01 13:10:04: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 -2017-07-01 13:10:04: mkdir /var/www/joplin/CliClient/tests/fuzzing/sync/.sync -2017-07-01 13:10:04: list /var/www/joplin/CliClient/tests/fuzzing/sync -2017-07-01 13:10:05: Starting joplin-cli 0.8.27... -2017-07-01 13:10:05: Profile directory: /var/www/joplin/CliClient/tests/fuzzing/client1 diff --git a/lib/file-api-driver-local.js b/lib/file-api-driver-local.js index 9ac9db35d1..1dcaaf28a1 100644 --- a/lib/file-api-driver-local.js +++ b/lib/file-api-driver-local.js @@ -1,7 +1,7 @@ -import fs from 'fs'; -import fse from 'fs-extra'; +import fs from 'fs-extra'; import { promiseChain } from 'lib/promise-utils.js'; import moment from 'moment'; +import { time } from 'lib/time-utils.js'; class FileApiDriverLocal { @@ -53,38 +53,21 @@ class FileApiDriverLocal { }); } - list(path, options) { - return new Promise((resolve, reject) => { - fs.readdir(path, (error, items) => { - if (error) { - reject(error); - return; - } + async list(path, options) { + let items = await fs.readdir(path); + let output = []; + for (let i = 0; i < items.length; i++) { + let stat = await this.stat(path + '/' + items[i]); + if (!stat) continue; // Has been deleted between the readdir() call and now + stat.path = items[i]; + output.push(stat); + } - let chain = []; - for (let i = 0; i < items.length; i++) { - chain.push((output) => { - if (!output) output = []; - return this.stat(path + '/' + items[i]).then((stat) => { - stat.path = items[i]; - output.push(stat); - return output; - }); - }); - } - - return promiseChain(chain).then((results) => { - if (!results) results = []; - resolve({ - items: results, - hasMore: false, - context: null, - }); - }).catch((error) => { - reject(error); - }); - }); - }); + return { + items: output, + hasMore: false, + context: null, + }; } get(path) { @@ -155,8 +138,26 @@ class FileApiDriverLocal { }); } - move(oldPath, newPath) { - return fse.move(oldPath, newPath, { overwrite: true }); + async move(oldPath, newPath) { + let lastError = null; + + for (let i = 0; i < 5; i++) { + try { + let output = await fs.move(oldPath, newPath, { overwrite: true }); + return output; + } catch (error) { + lastError = error; + // Normally cannot happen with the `overwrite` flag but sometime it still does. + // In this case, retry. + if (error.code == 'EEXIST') { + await time.sleep(1); + continue; + } + throw error; + } + } + + throw lastError; } format() { diff --git a/lib/models/base-item.js b/lib/models/base-item.js index 63043b0316..f34e4be413 100644 --- a/lib/models/base-item.js +++ b/lib/models/base-item.js @@ -43,7 +43,10 @@ class BaseItem extends BaseModel { } static loadItemByPath(path) { - let id = this.pathToId(path); + return this.loadItemById(this.pathToId(path)); + } + + static loadItemById(id) { return Note.load(id).then((item) => { if (item) return item; return Folder.load(id); diff --git a/lib/synchronizer.js b/lib/synchronizer.js index 6faff68226..eb2c447b74 100644 --- a/lib/synchronizer.js +++ b/lib/synchronizer.js @@ -78,6 +78,17 @@ class Synchronizer { return this.syncDirName_; } + randomFailure(options, name) { + if (!options.randomFailures) return false; + + if (this.randomFailureChoice_ == name) { + options.onMessage('Random failure: ' + name); + return true; + } + + return false; + } + async start(options = null) { if (!options) options = {}; if (!options.onProgress) options.onProgress = function(o) {}; @@ -87,6 +98,8 @@ class Synchronizer { return; } + this.randomFailureChoice_ = Math.floor(Math.random() * 5); + // ------------------------------------------------------------------------ // First, find all the items that have been changed since the // last sync and apply the changes to remote. @@ -171,6 +184,8 @@ class Synchronizer { await this.api().put(tempPath, content); await this.api().setTimestamp(tempPath, local.updated_time); await this.api().move(tempPath, path); + + if (this.randomFailure(options, 0)) return; await ItemClass.save({ id: local.id, sync_time: time.unixMs(), type_: local.type_ }, { autoTimestamp: false }); @@ -195,6 +210,8 @@ class Synchronizer { conflictedNote.is_conflict = 1; await Note.save(conflictedNote, { autoTimestamp: false }); + if (this.randomFailure(options, 1)) return; + if (remote) { let remoteContent = await this.api().get(path); local = BaseItem.unserialize(remoteContent); @@ -227,6 +244,7 @@ class Synchronizer { let path = BaseItem.systemPath(item.item_id) this.logSyncOperation('deleteRemote', null, { id: item.item_id }, 'local has been deleted'); await this.api().delete(path); + if (this.randomFailure(options, 2)) return; await BaseModel.remoteDeletedItem(item.item_id); report['deleteRemote']++; @@ -289,6 +307,8 @@ class Synchronizer { await ItemClass.save(newContent, options); } catch (error) { + if (this.randomFailure(options, 3)) return; + if (error.code == 'duplicateTitle') { newContent.title = newContent.title + '-' + newContent.created_time + '-' + (Math.floor(Math.random() * 1000)); newContent.updated_time = newContent.sync_time + 2; @@ -317,6 +337,8 @@ class Synchronizer { // means the item has been deleted. // ------------------------------------------------------------------------ + if (this.randomFailure(options, 4)) return; + let items = await BaseItem.syncedItems(); for (let i = 0; i < items.length; i++) { let item = items[i];