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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>89239</bug_id>
          
          <creation_ts>2012-06-15 12:12:38 -0700</creation_ts>
          <short_desc>IndexedDB: Don&apos;t do full commit for empty transactions</short_desc>
          <delta_ts>2012-10-03 16:48:10 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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="Joshua Bell">jsbell</assigned_to>
          <cc>alecflett</cc>
    
    <cc>dgrogan</cc>
    
    <cc>michaeln</cc>
    
    <cc>tony</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>650390</commentid>
    <comment_count>0</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-06-15 12:12:38 -0700</bug_when>
    <thetext>For read-only IDB transactions we go through the full motions of an backing store commit, including creating/writing a (presumably empty) leveldb writebatch.

This can be short-circuited, which would eliminate unnecessary work and make the read-only transaction resilient to backing store faults (e.g. disk has gone away but data is still in memory)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>674024</commentid>
    <comment_count>1</comment_count>
      <attachid>153369</attachid>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-07-19 16:14:24 -0700</bug_when>
    <thetext>Created attachment 153369
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>674026</commentid>
    <comment_count>2</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-07-19 16:15:47 -0700</bug_when>
    <thetext>I don&apos;t know if we actually want this... the only practical upshot is that if leveldb has entered a bad state due to I/O error the read transaction won&apos;t trip it if the data is in an in-memory table.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>674941</commentid>
    <comment_count>3</comment_count>
      <attachid>153369</attachid>
    <who name="David Grogan">dgrogan</who>
    <bug_when>2012-07-20 14:01:04 -0700</bug_when>
    <thetext>Comment on attachment 153369
Patch

LGTM

Bike-shedding: Agreed that the desirability question doesn&apos;t have a clear answer. My vote would be to add this code, only because there&apos;s a conceivable scenario where a docs user wants to be able to read their docs offline even if they can&apos;t write due to some flaw in either our code or docs&apos;. I suppose the downside is that this could make such errors less discoverable.  No strong opinion.

If you do add this code, could you add a comment indicating how it could matter?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>676154</commentid>
    <comment_count>4</comment_count>
    <who name="Alec Flett">alecflett</who>
    <bug_when>2012-07-23 16:34:34 -0700</bug_when>
    <thetext>My vote is also to land this - I think this also helps in the case of a database going read-only, filling up, or overrunning quota, right? (Not all of that may kick this in today...) 

Seems like the downside is a tiny amount of code complexity, but it&apos;s pretty darn minor. Also agreed on the comment - the &quot;if (m_tree.is_empty())&quot; does not read &quot;if this is a read-only transaction&quot; to me - though maybe the naming of m_tree is the culprit there. not sure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722971</commentid>
    <comment_count>5</comment_count>
      <attachid>153369</attachid>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-09-18 12:17:36 -0700</bug_when>
    <thetext>Comment on attachment 153369
Patch

What happens when we iterate a cursor during a read-only transaction - do we clean up stale entries? Should those be committed or should that wait for a follow-up read/write transaction?

If we commit, then this doesn&apos;t address the scenario where this is defensive against I/O errors.

If we don&apos;t commit, all subsequent transactions pay that penalty.

Also note that the patch as written checks at a lower level - if index cleanup was done, it would still commit, so it&apos;s actually moot for this patch. I&apos;m tempted to land it as-is, but perhaps make the bug title less grandiose.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>734071</commentid>
    <comment_count>6</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-10-03 15:11:46 -0700</bug_when>
    <thetext>Changed title to &quot;don&apos;t do full commit for empty transactions&quot;

Read-only transactions can still be non-empty if they include index cleanup.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>734087</commentid>
    <comment_count>7</comment_count>
      <attachid>166971</attachid>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-10-03 15:26:42 -0700</bug_when>
    <thetext>Created attachment 166971
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>734088</commentid>
    <comment_count>8</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-10-03 15:28:48 -0700</bug_when>
    <thetext>michaeln@ came up with the same patch when looking into performance for read-only transactions:

https://groups.google.com/a/chromium.org/d/msg/chromium-html5/FRbwyUgspQ0/2xZkWZv1zQAJ</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>734092</commentid>
    <comment_count>9</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-10-03 15:29:09 -0700</bug_when>
    <thetext>tony@ - r?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>734145</commentid>
    <comment_count>10</comment_count>
      <attachid>166971</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-10-03 16:13:45 -0700</bug_when>
    <thetext>Comment on attachment 166971
Patch

Clearing flags on attachment: 166971

Committed r130338: &lt;http://trac.webkit.org/changeset/130338&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>734146</commentid>
    <comment_count>11</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-10-03 16:13:49 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>734204</commentid>
    <comment_count>12</comment_count>
    <who name="Michael Nordman">michaeln</who>
    <bug_when>2012-10-03 16:48:10 -0700</bug_when>
    <thetext>Woohoo... nice low hanging watermelon sized 10x improvement in small reads :)</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>153369</attachid>
            <date>2012-07-19 16:14:24 -0700</date>
            <delta_ts>2012-10-03 15:26:41 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-89239-20120719161424.patch</filename>
            <type>text/plain</type>
            <size>1555</size>
            <attacher name="Joshua Bell">jsbell</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTIzMDA3CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggYmFlNTY0YmNkOTA3YWJj
YWM4MDUxZTIzZGYwZjE4M2ZjYzBmYWJmMS4uOTIxZmJjNThmMzQ5NTVlMzE0ZmY1ZjNkNjk4ZjNi
OWE5MTlkMGVmNiAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE4IEBACisyMDEyLTA3LTE5ICBKb3No
dWEgQmVsbCAgPGpzYmVsbEBjaHJvbWl1bS5vcmc+CisKKyAgICAgICAgSW5kZXhlZERCOiBEb24n
dCBkbyBmdWxsIGNvbW1pdCBmb3IgcmVhZC1vbmx5IHRyYW5zYWN0aW9ucworICAgICAgICBodHRw
czovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9ODkyMzkKKworIC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csNiArMTI3LDExIEBA
IGJvb2wgTGV2ZWxEQlRyYW5zYWN0aW9uOjpjb21taXQoKQogICAgIEFTU0VSVCghbV9maW5pc2hl
ZCk7CiAgICAgT3duUHRyPExldmVsREJXcml0ZUJhdGNoPiB3cml0ZUJhdGNoID0gTGV2ZWxEQldy
aXRlQmF0Y2g6OmNyZWF0ZSgpOwogCisgICAgaWYgKG1fdHJlZS5pc19lbXB0eSgpKSB7CisgICAg
ICAgIG1fZmluaXNoZWQgPSB0cnVlOworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKICAg
ICBUcmVlVHlwZTo6SXRlcmF0b3IgaXRlcmF0b3I7CiAgICAgaXRlcmF0b3Iuc3RhcnRfaXRlcl9s
ZWFzdChtX3RyZWUpOwogCg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>166971</attachid>
            <date>2012-10-03 15:26:42 -0700</date>
            <delta_ts>2012-10-03 16:13:45 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-89239-20121003152554.patch</filename>
            <type>text/plain</type>
            <size>1808</size>
            <attacher name="Joshua Bell">jsbell</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTMwMjc1CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNzcxYzBhYmQ4Nzg2Mzcx
YjUyYWVhYWIzOWVmODZkYjI2NWRiYjQzMC4uY2FkOTRkNTdlNTFmMmY3Y2U2NWRjNGY0MDJjM2M0
ZGNlNGQ2YTI5MyAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDIyIEBACisyMDEyLTEwLTAzICBKb3No
dWEgQmVsbCAgPGpzYmVsbEB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