Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1270

thrift: add --allow-neg-keys argument to allow

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.8
    • C++ - Library
    • None

    Description

      From 0df0b8cec89a9d7652fbbabd06e5b4d153537431 Mon Sep 17 00:00:00 2001
      From: Dave Watson <davejwatson@fb.com>
      Date: Tue, 2 Aug 2011 08:40:44 -0700
      Subject: [PATCH 02/33] thrift: add --allow-neg-keys argument to allow
      negative field keys

      Summary:
      Several of our .thrift files already deployed in production do not have
      explicitly specified key values for all fields. Thrift automatically
      chooses negative values for these keys (and also emits a warning while
      doing so). Previously, this couldn't be fixed without breaking protocol
      compatibility, since thrift refuses to accept explicitly specified
      negative key values.

      This new flag causes thrift to accept negative key values, so that these
      older .thrift files can be updated with explicitly specified values. It
      emits a warning if a negative value is specified that is different from
      what thrift would have otherwise chosen.

      Test Plan:
      Tested modifying common/fbunit/logger/if/UnitTestLogger.thrift
      and biggrep/BigGrep.thrift to pass in negative field values.

      I'll check in the changes to these .thrift files separately, since it
      also requires changes to fbconfig to support passing in the
      --allow-neg-keys argument. For fbunit, I'll probably change it to just
      use positive key values, since we don't really care about backwards
      compatibility in that case.


      compiler/cpp/src/globals.h | 15 +++++++++++++
      compiler/cpp/src/main.cc | 10 ++++++++
      compiler/cpp/src/parse/t_field.h | 9 ++++++++
      compiler/cpp/src/thrifty.yy | 43 +++++++++++++++++++++++++++++++------
      4 files changed, 70 insertions, 7 deletions

      Attachments

        Activity

          People

            davejwatson@fb Dave Watson
            davejwatson@fb Dave Watson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: