googleworkspace / android-samples

Android samples for Google Workspace APIs
Apache License 2.0
636 stars 410 forks source link

delete/trash issue #3

Closed seanpjanson closed 10 years ago

seanpjanson commented 10 years ago

Hi, I am only bringing the SO discussions #21369573 and #21370636 here, so we do not vent it there. I installed this DEMO package and ran a few simple tests to see. The issue I mentioned on SO is showing with this DEMO as well. Steps to reproduce: 1/ Android device: "Create a file" ... creates "New file" in the root 2/ WEB browser: https://drive.google.com ... REMOVE (TRASH, DELETE...) the "New file" 3/ Android device: "List files with pagination" the list is unchanged, "New file" is showing.

Since this DEMO does not display the files' status, I ran the same (simplified) scenario in my test suite showing the file's "trashed" status, but did not get conclusive results.

Drive.DriveApi.query(mGAC, query).addResultCallback(new OnChildrenRetrievedCallback() { @Override public void onChildrenRetrieved(MetadataBufferResult rslt) { if (!rslt.getStatus().isSuccess()) return; MetadataBuffer mdb = rslt.getMetadataBuffer(); for (int ii = 0; ii < mdb.getCount(); ii++) { Log.i(TAG, (mdb.get(ii).isTrashed()?"-":"+")+mdb.get(ii).getTitle()); } mdb.close(); } });

Originally, the deleted file was showing as (+) (not trashed) After I EMPTIED TRASH on the web, it changed status to (-) (trashed) But when I re-ran the same test again (delete file, empty trash), I could not reproduce the same behavior. Conclusion: The trashed status (true/false, -/+) may be just random noise. So, the behavior I would expect (after sync): delete file on the web: The file/folder isTrashed() should change false -> true recover file on the web: Change true -> false empty trash - the file should not be listed anymore

This issue isn't a showstopper for me and I assume that it is just work-in-progress and it will be corrected eventually. And the code Burcu's asking for is 0B1mQUW2aFJfdd2JTSkVIQnBoRm8.

seanpjanson commented 10 years ago

update ... six hours later. Just FYI. I started DEMO out of curiosity again, and the "New file" (created 6 hours ago, deleted, emptied from trash) is now GONE. GONE as not listed at all. So, I created another one, deleted, removed from trash and it is still showing (10 minutes later) with trashed = false (alive) status. We'll see tomorrow. BTW: In order to get the status reported, I locally changed one line of code in ResultsAdapter.java to show the status. ResultsAdapter.java, line43: titleTextView.setText(metadata.getTitle() +" "+(metadata.isTrashed()?"(trashed)":"(alive)"));

seanpjanson commented 10 years ago

... another update. The last "New file" is GONE again. Elapsed time: about 1 hour since deletion. So, it may be some caching - timing - synchronization issue after all. As a side note, it would be nice to name the files/folders using a construct like: String fName = new SimpleDateFormat("yyMMdd-HHmmss",Locale.US).format(new Date())+".ext" in order to get easily visible timestamp. Especially if Drive allows for multiple files with the same name.

rakyll commented 10 years ago

@seanpjanson, it's the sync scheduling latency problem. Maybe we should add a force synchronizer that runs immediately and doesn't wait for Android to schedule and perform the next sync.

seanpjanson commented 10 years ago

Yep, that's what I'm seeing. Do you want a narrated log of actions (last 6 hours or so). Not that it it's too useful, but if you follow the same path, it may save you some time. sean

On Wed, Jan 29, 2014 at 6:08 AM, Burcu Dogan notifications@github.comwrote:

@seanpjanson https://github.com/seanpjanson, it's the sync scheduling latency problem. Maybe we should add a force synchronizer that runs immediately and doesn't wait for Android to schedule and perform the next sync.

Reply to this email directly or view it on GitHubhttps://github.com/googledrive/android-demos/issues/3#issuecomment-33582683 .

rakyll commented 10 years ago

It'd be helpful if you share your log on a gist, I can also investigate whether there is something else going wrong.

seanpjanson commented 10 years ago

It may not be an issue now, but since the latency is unpredictable and not short (hours) it will pop-up as a problem when people start writing apps on Andy and mess with files on Drive. After all, that's what Drive is all about. sean

On Wed, Jan 29, 2014 at 6:08 AM, Burcu Dogan notifications@github.comwrote:

@seanpjanson https://github.com/seanpjanson, it's the sync scheduling latency problem. Maybe we should add a force synchronizer that runs immediately and doesn't wait for Android to schedule and perform the next sync.

Reply to this email directly or view it on GitHubhttps://github.com/googledrive/android-demos/issues/3#issuecomment-33582683 .

seanpjanson commented 10 years ago

You caught me, I have no clue how to use gist, actually how to tie gist to the issue. Can I stick it in github issue comments? It is only 20 lines (of incoherent gibberish).

On Wed, Jan 29, 2014 at 6:16 AM, Burcu Dogan notifications@github.comwrote:

It'd be helpful if you share your log on a gist https://gist.github.com/, I can also investigate whether there is something else going wrong.

Reply to this email directly or view it on GitHubhttps://github.com/googledrive/android-demos/issues/3#issuecomment-33583171 .

rakyll commented 10 years ago

Yes, please add it as a comment here.

seanpjanson commented 10 years ago

the DEMO code has 2 little modifications,

Mostly confirms what you already know, the only 'surprise' was @4:53 AM, when restoring a file from trash apparently updated the list (removing the 'deleted forever' in previous step)

2:23 AM 1/29/2014 created 140129-022003 , list shows: 140129-022003 (alive) OK 140128-195150.txt (trashed) OK (from yesterday - it is alive) restored 140128-195150.txt

2:28 AM 1/29/2014 140129-022003 (alive) OK 140128-195150.txt (alive) OK

2:28 AM 1/29/2014 create file 140129-022845.txt (alive) the new file 140129-022003 (alive) OK 140128-195150.txt (alive) OK

2:30 AM 1/29/2014 delete 140129-022003 140129-022845.txt (alive) OK 140129-022003 (alive) WRONG 140128-195150.txt (alive) OK

2:54 AM 1/29/2014 140129-022845.txt (alive) OK 140129-022003 (trashed) OK 140128-195150.txt (alive) OK deleting 140128-195150.txt 140129-022845.txt (alive) OK 140129-022003 (trashed) OK 140128-195150.txt (alive) WRONG

4:13 AM 1/29/2014 (elapsed 1:19) 140129-022845.txt (alive) OK 140129-022003 (trashed) OK 140128-195150.txt (trashed) OK in TRASH, "delete forever" 140129-022003 140129-022845.txt (alive) OK 140129-022003 (trashed) WRONG 140128-195150.txt (trashed) OK

4:53 AM 1/29/2014 140129-022845.txt (alive) OK 140129-022003 (trashed) WRONG 140128-195150.txt (trashed) OK restoring 140128-195150.txt 140129-022845.txt (alive) OK 140128-195150.txt (trashed) WRONG

6:07 AM 1/29/2014 140129-022845.txt (alive) OK 140128-195150.txt (alive) OK

As I said, probably nothing new.

On Wed, Jan 29, 2014 at 6:31 AM, Burcu Dogan notifications@github.comwrote:

Yes, please add it as a comment here.

Reply to this email directly or view it on GitHubhttps://github.com/googledrive/android-demos/issues/3#issuecomment-33584185 .

seanpjanson commented 10 years ago

One last comment and I'll let you work. I deleted my test file set yesterday (only moved it to trash, but left it there without emptying). This morning (10 hours later) I ran 'list' and could see everything ALIVE. Second run ( a minute later ) updated the status to TRASHED - correct status. No response required, just FYI.

rakyll commented 10 years ago

@seanpjanson, we're making some modifications to make the syncing more instantly. Btw, you can call Drive.requestSync(...) to enforce immediate syncs.

vitovalov commented 6 years ago

Jun 2018 and still Filters.eq(SearchableField.TRASHED, false) is failing to find trashed items. Even requestSync doesn't help. :(