<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>18558</bug_id>
          
          <creation_ts>2012-08-14 19:25:28 +0000</creation_ts>
          <short_desc>[IndexedDB] Define error seen when key generator maximum value is reached</short_desc>
          <delta_ts>2013-02-20 00:53:14 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>Indexed Database API</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joshua Bell">jsbell</reporter>
          <assigned_to name="This bug has no owner yet - up for the taking">dave.null</assigned_to>
          <cc>eliotgra</cc>
    
    <cc>jonas</cc>
    
    <cc>mike</cc>
    
    <cc>odinho</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>72168</commentid>
    <comment_count>0</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-08-14 19:25:28 +0000</bug_when>
    <thetext>The spec says:

&quot;When the current number of a key generator reaches above the value 2^53 (9007199254740992) any attempts to use the key generator to generate a new key will result in an error.&quot;

.. but the specifics of the error and how it manifests is not defined.

The logical place would be at the point where the key generator is queried, in the &quot;Object Store Storage Operation&quot;:

&quot;If store uses a key generator and key is undefined, set key to the next generated key.&quot;

In the Chrome implementation, if the key generator results in an error, the storage operation fails at this point with a DataError.

This can be exercised by:

store = db.createObjectStore(&apos;store&apos;, {autoIncrement: true});
store.put(&apos;a&apos;, 9007199254740992);
r = store.put(&apos;b&apos;);
r.onerror = function(e) { alert(e.target.error.name); };</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72169</commentid>
    <comment_count>1</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-08-14 19:45:19 +0000</bug_when>
    <thetext>&quot;DataError&quot; works for me. Firefox currently uses &quot;UnknownError&quot; which I agree is a less good option.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72598</commentid>
    <comment_count>2</comment_count>
    <who name="Odin Hørthe Omdal">odinho</who>
    <bug_when>2012-08-23 09:46:15 +0000</bug_when>
    <thetext>Hmm. We fail with ConstraintError because it&apos;s &quot;coming from the database&quot;. 

I don&apos;t really think DataError is a very good fit based on how it&apos;s used in other parts of the spec, dealing more with the data that you put in. This is really something you can&apos;t control, it&apos;s different from the others.

I&apos;d be okay and change it to DataError if you update the spec to that, no problem. I just think ConstraintError makes a bit more sense :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72603</commentid>
    <comment_count>3</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-08-23 10:04:33 +0000</bug_when>
    <thetext>Good point. In fact, DataError isn&apos;t used as an error-event anywhere right now, only as an exception thrown when invalid data is provided as input.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72611</commentid>
    <comment_count>4</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-08-23 15:53:51 +0000</bug_when>
    <thetext>I&apos;m fine with switching Chromium to ConstraintError in this case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79851</commentid>
    <comment_count>5</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-12-10 18:29:25 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; I&apos;m fine with switching Chromium to ConstraintError in this case.

... and FYI we did switch Chromium over to ConstraintError some time ago.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83362</commentid>
    <comment_count>6</comment_count>
    <who name="Eliot Graff">eliotgra</who>
    <bug_when>2013-02-20 00:53:14 +0000</bug_when>
    <thetext>Added the following:

In 3.1.13 (7th bullet)
...
When the current number of a key generator reaches above the value 2^53 (9007199254740992) any attempts to use the key generator to generate a new key will result in a ConstraintError. It&apos;s still possible to insert records into the object store by specifying an explicit key, however the only way to use a key generator again for the object store is to delete the object store and create a new one. 

In Section 5.1, Object Store Storage Operation
...
2. If store uses a key generator and key is undefined, set key to the next generated key. If store also uses in-line keys, then set the property in value pointed to by store&apos;s key path to the new value for key, as shown in the steps to assign a key to a value using a key path. If the current number of a key generator reaches above the value 2^53 (9007199254740992) any attempt to use the key generator to generate a new key fails with a ConstraintError. 

Commit #382</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>