MinecraftServerControl / mscs

Powerful command-line control for UNIX and Linux powered Minecraft servers
https://minecraftservercontrol.github.io
BSD 2-Clause "Simplified" License
485 stars 62 forks source link

mscs map updates only update after backup #263

Closed Eli-Tarrago closed 3 years ago

Eli-Tarrago commented 3 years ago

I perform a mscs map <world> command and can see that the file date and time update in the shared nginx <-> mscs map folder. The overviewer map produces no visual changes. I can run the command multiple times, I can remove all the data out of the shared nginx/mscs map folder. I confirmed there are no additional versions as per previous mscs bug reports.

I perform a mscs backup <world> followed by a mscs map <world> and the map renders the new modified blocks.

I would like to know what steps I can do to successfully update the map without performing backups.

sandain commented 3 years ago

It was a conscious choice to require a backup prior to mapping to avoid running the server in "save-off" mode for an extended period of time (PR #119, and later amended in PR #127).

I would however be happy to accept patches to make this a user configurable option via the mscs.properties or server.properties files instead.

Eli-Tarrago commented 3 years ago

I'll take a look. It's been a while since I've programmed in Perl.

sandain commented 3 years ago

Let me know if you have any questions or need pointers.

Take a look at the getServerLocation() method for an example if you need the option to have access to variables -- this would be the only Perl you would have to touch.

If you don't need access to variables, and you wouldn't if you use a boolean value (e.g., something like mscs-maps-from-backup=true), you would just need to call getDefaultsValue() and getMSCSValue(). E.g., make something like this change to the overviewer() method (completely untested):

  # Make sure that the backup of the world files are there before mapping.
  USE_BACKUP_LOCATION=$(getMSCSValue $1 'mscs-maps-from-backup' $(getDefaultsValue 'mscs-maps-from-backup' 'true'))
  if [ $USE_BACKUP_LOCATION eq 'true' ] && [ ! -e "$BACKUP_LOCATION/$1/server.properties" ]; then
    printf "\nError finding the backup for world $1.  To save server "
    printf "down time, mapping is run from the backup location.\n"
    printf "Run '$PROG backup $1' before mapping.\n"
    return
  fi

and a bit later ...

if [ $USE_BACKUP_LOCATION eq 'true' ]; then
    printf "worlds['$1'] = '$BACKUP_LOCATION/$1/$1-original' if os.path.exists('$BACKUP_LOCATION/$1/$1-original') else '$BACKUP_LOCATION/$1/$1'\n\n" >>$SETTINGS_FILE
else
    printf "worlds['$1'] = '$WORLDS_LOCATION/$1/$1'\n\n" >> $SETTINGS_FILE
fi
Eli-Tarrago commented 3 years ago

The statement "To save server down time, mapping is run from the backup location." is returned as an error if a backup doesn't exist. My question is, if I run overviewer directly on a running map, would there be downtime associated?

If yes:

If no, the server will not experience a minor or major outage.

Use case for this would be if a user wants to run the map update multiple times a day but only keep backups to a certain constant.

zanix commented 3 years ago

Generating an Overviewer map disables world updates and saves, however the server will still run so it's not actually downtime per se. You just run the risk of losing any progress in the world while the map is generated. Running Overviewer can take a long time, a backup usually takes a fraction of the time. So we determined in order to prevent world updates from being lost, backups would be made and mapping would be generated from the latest backup.