Skip to content

Rearrange the packages to put CreateBlock in tsdbutil and avoid circular import #6136

Closed

Description

@krasi-georgiev
No description provided.

Activity

  1. changed the title [-]Rearrange the packages to put `CreateBlock` in tsdbutil and avoid circular import[/-] [+]Rearrange the packages to put `CreateBlock` in `tsdbutil` and avoid circular import[/+] on Oct 14, 2019
  2. droidnoob commented on Nov 3, 2019

    @droidnoob

    Is this still open. I'd like to take this up @krasi-georgiev

  3. codesome commented on Nov 7, 2019

    @codesome
    Member

    @droidnoob I see this issue is being addressed in #5887

  4. krasi-georgiev commented on Nov 7, 2019

    @krasi-georgiev
    ContributorAuthor

    nope this is only a temporary solution in that linked PR as it moves is in the main tsdb package to avoid the circular import cycle.
    I think we should try to organize it better

  5. jpmcb commented on Feb 10, 2020

    @jpmcb
    Contributor

    I've been looking at this issue today and I see a few paths forward:

    1. Break each dependent component into it's own package. For example, where NewHead is called:
    head, err := NewHead(nil, logger, nil, chunkRange, DefaultStripeSize)
    

    instead, break out the head files into their own packages:

    h, err := head.NewHead(nil, logger, nil, chunkRange, DefaultStripeSize)
    

    It could then be imported as .../tsdb/head. I played around with this a bit and it would be quite the refactor as there are several dependent private methods within the tsdb package that would need to become public or change how their individual APIs are accessed.

    1. Create a tsdbutil-broker package that would break the circular dependency between tsdb and tsdbutil. I think this could be a good solution.

    Any other thoughts? Or do one of these approaches seem favorable?

  6. krasi-georgiev commented on Feb 11, 2020

    @krasi-georgiev
    ContributorAuthor

    @codesome mentioned that he found another way to create blocks without relying on the NewHead method so maybe he can also share his idea.

  7. gouthamve commented on May 25, 2020

    @gouthamve
    Member

    @krasi-georgiev / @codesome What is the requirement/use-case here? Where is the circular import happening?

    We went through this issue in our bug scrub and we didn't fully get the context around this.

  8. krasi-georgiev commented on May 26, 2020

    @krasi-georgiev
    ContributorAuthor

    was long time ago and can't remember either.

  9. locked as resolved and limited conversation to collaborators on Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions