Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1169

Reduce memory footprint of ResolvingGrammarGenerator

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.0
    • 1.7.3
    • java
    • None

    Description

      We noticed an OutOfMemory error in one of our client applications (GUI) when trying to decode messages that require resolving.

      It turns out the use of Schema.toString(true) in method generate(Schema, Schema, Map<LitS,Symbol>) (and to a less extent resolveRecords(Schema, Schema, Map<LitS,Symbol>) too) in our very-large-Schema use-case is the main reason for this.

      We found that patching this class to use Schema.getFullName() instead of Schema.toString(true) resolves our issue, and we thought this might benefit other users (and shouldn't affect anybody as this message is not actually being logged/reported).

      The change involves changing this (in method generate()):

          return Symbol.error("Found " + writer.toString(true)
                              + ", expecting " + reader.toString(true));
      

      into this:

          return Symbol.error("Found " + writer.getFullName()
                              + ", expecting " + reader.getFullName());
      

      And this (in method resolveRecords()):

                  result = Symbol.error("Found " + writer.toString(true)
                                        + ", expecting " + reader.toString(true));
      

      into this:

                  result = Symbol.error("Found " + writer.getFullName()
                                        + ", expecting " + reader.getFullName());
      

      Thanks in advance,

      Hernan

      Attachments

        1. AVRO-1169.patch
          1 kB
          Doug Cutting

        Activity

          People

            hernan.otero Hernan Otero
            hernan.otero Hernan Otero
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: