Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting updatefields to a value higher than 1 will update all fields #52

Open
robbertkauffman opened this issue Oct 13, 2022 · 1 comment

Comments

@robbertkauffman
Copy link

robbertkauffman commented Oct 13, 2022

Running POCDriver without the --updatefields flag or with --updatefields 1 works as intended:

// running: java -jar POCDriver.jar -c "MYCLUSTERURI" -n "test.updates" -i 0 -u 100
// results in the below oplog entry
{
  op: 'u',
  ns: 'test.json',
  ui: UUID("938a8025-dfbd-4578-804f-fba27c0f7c7f"),
  o: { '$v': 2, diff: { u: { fld0: Long("984948") } } },
  o2: { _id: { w: 2, i: 6132 } },
  ts: Timestamp({ t: 1665674985, i: 1 }),
  t: Long("554"),
  v: Long("2"),
  wall: ISODate("2022-10-13T15:29:45.008Z")
}

However, when setting --updatefields 2 or any value higher than 1, it will update fields equal to the fields in the doc (-f flag, default = 10):

// running: java -jar POCDriver.jar -c "MYCLUSTERURI" -n "test.updates" -i 0 -u 100 --updatefields 2
// results in the below oplog entry
{
  op: 'u',
  ns: 'test.updates',
  ui: UUID("938a8025-dfbd-4578-804f-fba27c0f7c7f"),
  o: {
    '$v': 2,
    diff: {
      u: {
        fld0: Long("328002"),
        fld1: ISODate("2019-07-27T07:24:01.661Z"),
        fld2: 'dolor sit amet. Lorem ipsum',
        fld3: 'Lorem ipsum dolor sit amet,',
        fld4: 'justo duo dolores et ea',
        fld5: ISODate("2021-08-22T01:31:34.842Z"),
        fld6: Long("1867063"),
        fld7: 'Stet clita kasd gubergren, no',
        fld8: 'nonumy eirmod tempor invidunt',
        fld9: Long("1255035")
      }
    }
  },
  o2: { _id: { w: 0, i: 16357 } },
  ts: Timestamp({ t: 1665675029, i: 1 }),
  t: Long("554"),
  v: Long("2"),
  wall: ISODate("2022-10-13T15:30:29.000Z")
}

I'm expecting it to only update two fields with the above command. Even worse, when using the -f flag, it will update as many fields as the -f flag is set to. In my case, I was trying to generate large documents (~33kbs) so I used -f 900 to generate/insert data, and still had this flag set when doing the updates, causing it to update all 900 fields when using --updatefields 2 or any value higher than 1.

@johnlpage
Copy link
Owner

The code (and there has only been one version of this bit) simply edit 1 field or all as far as I can see. Ah no I see what it actually does is create a new record and use that as a replacement - so if -f is set it will be whatever that record size is.

I've asked the person that wrote the multi-field edit why it does it does it like this, personally I'd never have added that feature.

If you want to edit the code it should be pretty simple to do. I really don't maintain this these days others so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants