Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-694

htonl missing for rb_object_id_generator_next when time == NULL

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0.0
    • Affects Version/s: None
    • Component/s: BSON, C Extensions
    • None
    • Major Change

      In native.c method: rb_object_id_generator_next, when time is NULL, we use rb_current_time_milliseconds() but this should be

      if (argc == 0 || (argc == 1 && *time == Qnil)) {
        t = htonl(rb_current_time_in_milliseconds());  /* This line needs to be changed. */
      else {
        t = htonl(NUM2UINT(rb_funcall(*time, rb_intern("to_i"), 0)));
      }
      

      When time is passed, its correctly doing a htonl(). Making this change, ensures that object_ids will be generated in ascending order.

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            gautamrege Gautam Rege
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: