Closed Bug 744660 Opened 8 years ago Closed 8 years ago

SQLiteConstraintException on bulkInsert history data

Categories

(Firefox for Android :: Android Sync, defect, P1)

All
Android
defect

Tracking

()

VERIFIED FIXED
mozilla14
Tracking Status
blocking-fennec1.0 --- beta+

People

(Reporter: nalexander, Assigned: nalexander)

Details

Attachments

(1 file)

Attached file adb logcat
Problem with bulkInserting history?  This was on a first sync with m-i pulled today:

changeset:   91441:e819f766c586
tag:         qparent
user:        Patrick McManus <mcmanus@ducksong.com>
date:        Wed Apr 11 13:49:32 2012 -0400
summary:     bug 743747: fix landing with 603514 r=honzab

See attached log for more details.

V GeckoBrowserProvider(21233) Flushing DB bulkinsert...
D dalvikvm(21233)             GC_CONCURRENT freed 529K, 8% free 8347K/9031K, paused 2ms+2ms
D dalvikvm(21233)             GC_FOR_ALLOC freed 507K, 8% free 8312K/9031K, paused 19ms
E SQLiteDatabase(21233)       Error inserting guid=JadQHBs80dbC visits=[{"type":1,"date":1334100347661000},{"type":1,"date":1334100347660000},{"type":1,"date":1334100347659000},{"type":1,"date":1334100347658000},{"type":2,"date":1334097673057317},{"type":2,"date":1334097564731989},{"type":2,"date":1334097498663778},{"type":2,"date":1334097492931013},{"type":2,"date":1334097490052229},{"type":2,"date":1334097260080121}]
E SQLiteDatabase(21233)       android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
E SQLiteDatabase(21233)       	at android.database.sqlite.SQLiteStatement.native_executeInsert(Native Method)
E SQLiteDatabase(21233)       	at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:113)
E SQLiteDatabase(21233)       	at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1718)
E SQLiteDatabase(21233)       	at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1591)
E SQLiteDatabase(21233)       	at org.mozilla.gecko.sync.repositories.android.AndroidBrowserHistoryDataExtender.bulkInsert(AndroidBrowserHistoryDataExtender.java:105)
E SQLiteDatabase(21233)       	at org.mozilla.gecko.sync.repositories.android.AndroidBrowserHistoryDataAccessor.bulkInsert(AndroidBrowserHistoryDataAccessor.java:151)
E SQLiteDatabase(21233)       	at org.mozilla.gecko.sync.repositories.android.AndroidBrowserHistoryRepositorySession.flushNewRecords(AndroidBrowserHistoryRepositorySession.java:201)
E SQLiteDatabase(21233)       	at org.mozilla.gecko.sync.repositories.android.AndroidBrowserHistoryRepositorySession.enqueueNewRecord(AndroidBrowserHistoryRepositorySession.java:176)
E SQLiteDatabase(21233)       	at org.mozilla.gecko.sync.repositories.android.AndroidBrowserHistoryRepositorySession.insert(AndroidBrowserHistoryRepositorySession.java:160)
E SQLiteDatabase(21233)       	at org.mozilla.gecko.sync.repositories.android.AndroidBrowserRepositorySession$1.run(AndroidBrowserRepositorySession.java:440)
E SQLiteDatabase(21233)       	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
E SQLiteDatabase(21233)       	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
E SQLiteDatabase(21233)       	at java.lang.Thread.run(Thread.java:856)
Looks like it's inserting when a record already exists for that GUID.
From conversation with tchung:

11:24 nalexander: tchung: we recently landed code to insert history items in one db access.
11:24 nalexander: Which may be causing trouble, and may be related to the recent Fennec CP changes.
11:25 nalexander: Doesn't necessarily need testing immediately but keep your eyes open.
11:25 nalexander: I'm going to investigate on my end.
blocking-fennec1.0: --- → ?
blocking-fennec1.0: ? → beta+
(In reply to Naoki Hirata :nhirata from comment #3)
> see https://bugzilla.mozilla.org/show_bug.cgi?id=731443#c3

Thanks, but totally unrelated. Same exception, different database, different cause.
Just to clarify: this is failing in the data extender. That means the Fennec version has nothing to do with this; you should be able to reproduce in integration tests.

The only constraint is that GUID is primary key -- that is, it must be unique and non-null.

If guid is JadQHBs80dbC, that implies a duplicate. Perhaps batch is being flushed twice, or the accrued batch reuses an entry and thus contains dupes, or you're inserting *and* batching, or this insert is relying on a delete that failed?
Assignee: nobody → nalexander
https://hg.mozilla.org/integration/mozilla-inbound/rev/c379fa75d510

QA: please verify that this doesn't pop up in the log!
Status: NEW → ASSIGNED
Whiteboard: [qa+]
Target Milestone: --- → mozilla14
https://hg.mozilla.org/mozilla-central/rev/c379fa75d510
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
log is fine
Status: RESOLVED → VERIFIED
Whiteboard: [qa+]
Product: Mozilla Services → Android Background Services
Product: Android Background Services → Firefox for Android
You need to log in before you can comment on or make changes to this bug.