multi-server support? #2


  • Enhancment
  • Replied
Open
Assigned to seirako
  • RoboMWM created this issue Aug 22, 2015

    Could iPav utilize one database for multiple servers? I'm not sure if I want to go via a bungee route at the moment (and as such a bungee plugin would be preferred), but I'd like to be able to consolidate iPav's data in one file/database amongst multiple servers. Would a symlink of iPav's config folder work? (Potential for file locking I'd assume.)

  • RoboMWM added the tags Enhancment New Aug 22, 2015
  • Seirako removed a tag New Sep 3, 2015
  • Seirako added a tag Waiting Sep 3, 2015
  • Seirako posted a comment Sep 3, 2015

    As it is now, multiple instances of iPAV cannot be made to work together. In order to get it functioning, the following must work:

    • Choose the locations of the data files (super easy to implement)
    • Manage saves between instances (relatively easy to implement)
    • Manage loads between instances (it'd be a pain, but it's doable)
    • Plugin instances must share newly obtained data (currently un-implementable)

    That last one is stopping me from even attempting to add support for sharing data files. The following is why:

    Pretend there's two iPAV instances, A and B. A player has just logged in and A begins to save the newly obtained data to the log files. While A is saving, someone else connects to B's server, so it attempts to save. We'll assume B already knows to wait for A to finish before starting its own save. Once A has finished, B starts saving. However, B did not have whatever new data A has just saved. As a result, B is overwriting whatever A just recorded.

    A work-around for this is needed in order to get multiple instances to work together properly. I am largely unfamiliar with how bungee servers work and whether or not it's possible to make a master-instance running on the main bungee server controller that other iPAV instances can send new data to for saving. If that were possible, this whole problem goes away (all 4 requirements I listed above would become irrelevant).

    For the time being, I'll keep this ticket in mind in-case I do think of a way to correctly manage data across multiple instances. If you have any ideas for a solution, feel free to share and I'll see if I can implement them.

    Note: I'd like to avoid using any SQL databases (I have no clue how to do that stuff, and I much prefer flatfiles to store data), and I'd like to avoid creating a new file for each player (which would actually require three files per player due to indexing and lookup speed).


    Edited Sep 3, 2015
  • Seirako removed a tag Waiting Sep 3, 2015
  • Seirako added a tag Replied Sep 3, 2015
  • Seirako removed a tag Replied Sep 3, 2015
  • Seirako added a tag Waiting Sep 3, 2015
  • RoboMWM posted a comment Sep 23, 2015

    I also suggest you put this on spigot, it's harder for me to follow updates here in BukkitDev (and you'd probably get more users).

    I too would like to avoid SQL databases, makes it easier for me to view (and edit) raw files when needed.

    Making a bungee version of this would probably be easiest, but I'm not sure if I'm wanting to go the bungee route (I'd only split my server into 2 servers if I do split, and would rather not deal with running offline-mode, ensuring and testing a firewall, etc.)

    As for saving and sharing new data, each instance could save to a temporary file, which then gets added to the main file. The plugin would read from the file when viewing information (unless the plugin caches this, in which it'd need to update the cache every so often). I haven't looked into how this plugin saves its data, so I'm not sure if it edits certain lines or just adds data to the files.


    Edited Sep 23, 2015
  • RoboMWM removed a tag Waiting Sep 23, 2015
  • RoboMWM added a tag Replied Sep 23, 2015
  • RoboMWM posted a comment Nov 13, 2015

    One way is to use a temporary file before saving data to the main file. Then when the other instance wants to save, it can first check if the temporary file exists, and if so, update its cache before saving and then delete the file. Then it can create a new temporary file for the first instance to update its cache next time it attempts to save.

    Another way is to have another plugin/standalone program sync the files, while the plugin simply saves new data to the file. The plugins might be slightly out-of-date, but this would accommodate for any potential collisions.

    Would you mind open-sourcing this? I'd like to take a crack at this as well.


    Edited Nov 13, 2015
  • RoboMWM posted a comment Nov 13, 2015

    I also noticed that you don't seem to automatically merge/link different names (although you do log uuids)


    Edited Nov 13, 2015
  • RoboMWM posted a comment Nov 14, 2015

    Or I might just make a program/plugin that uses your plugin's data and stuffs it in its own file/database. That might be the easiest way to do this. Will let you know how I progress with this.


    Edited Nov 14, 2015
  • RoboMWM posted a comment Nov 21, 2015

    https://github.com/RoboMWM/ipavMerger

    Doesn't merge files, decided not to but it does merge them internally (in this utility) and allows you to view relevant information (stuff I wanted to merge anyways) so yea...


    Edited Nov 21, 2015

To post a comment, please login or register a new account.