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

misc. bugfixes/features #208

Merged
merged 17 commits into from
Sep 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a73efb4
add support for working with classes that are not directly accessible…
dalehenrich Sep 12, 2015
986adf4
fix mistake in commit a73efb4
dalehenrich Sep 12, 2015
11cc35e
conditional support for Class>>removeFromClassHistory which fixes bug…
dalehenrich Sep 12, 2015
ee2041e
asUnicodeString no longer needs to be used with #performOnServer: for…
dalehenrich Sep 12, 2015
4dde735
asUnicodeString no longer needs to be used with #performOnServer: for…
dalehenrich Sep 12, 2015
df06d67
asUnicodeString no longer needs to be used with #performOnServer: for…
dalehenrich Sep 12, 2015
389d927
need to be able to compare packages in both directions in repository …
dalehenrich Sep 13, 2015
0bb48bf
fix a bug in `TDClassDefinition class>>fromClassWithHistory:` where a…
dalehenrich Sep 13, 2015
00172dc
Issue #201: add builtIns comment to welcome message
dalehenrich Sep 16, 2015
0f56700
tweak MCDiffyTextWriter>>writePatch: for conditional existence of MC…
dalehenrich Sep 16, 2015
0eb5e64
undo MCDiffyTextWriter>>writePatch: tweak ... not needed with improv…
dalehenrich Sep 16, 2015
9fcc7b3
Issue #201: fix typo in welcome message
dalehenrich Sep 16, 2015
60c8319
export session descriptions using a pretty STON string
dalehenrich Sep 16, 2015
2e6308a
Issue #202: add --uncompressed option to `bu backup` command. Default…
dalehenrich Sep 16, 2015
cbb4205
Issue #202: fix 2.4.x typo
dalehenrich Sep 16, 2015
f924254
Issue #202: clean up some tests for snapshots also man page cleanup
dalehenrich Sep 16, 2015
9cb007b
Merge pull request #203 from dalehenrich/issue_202
dalehenrich Sep 17, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
*topez-server-33x-core
*tode-gemstone-core2x
performOnServer: command logging: logging
| result |
result := (System performOnServer: command) asUnicodeString.
result := System performOnServer: command.
logging
ifTrue: [
Transcript
cr;
show: command printString;
cr;
show: result ].
^ result
^ result
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*tode-gemstone-core2x
systemIsVoting

^false
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
*tode-gemstone-core3x
performOnServer: commandLine logging: logging
| result |
result := self
performOnServer: commandLine
status: [ :performOnServerStatusArray |
"Array of 5 elements:
raw status Integer,
child process status Integer (after WEXITSTATUS macro applied),
result String (or nil if operation failed) ,
error string from script file write, fork, or result file read ,
errno value, a SmallInteger from file write, fork, or file read"
(performOnServerStatusArray at: 1) ~~ 0
ifTrue: [
| message |
message := 'performOnServer: ' , commandLine printString , ' stdout: '
, (performOnServerStatusArray at: 3) printString
, ' failed with status: '
, (performOnServerStatusArray at: 1) printString , ' errno: '
, (performOnServerStatusArray at: 5) printString , ' errStr: '
, (performOnServerStatusArray at: 4) asString.
self error: message ].
performOnServerStatusArray at: 3 ].
logging
ifTrue: [
Transcript
cr;
show: commandLine printString;
cr;
show: result ].
^ result
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*tode-gemstone-core3x
performOnServer: commandLine status: statusBlock
| performOnServerStatusArray |
performOnServerStatusArray := System _performOnServer: commandLine.
^ statusBlock value: performOnServerStatusArray
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"class" : {
},
"instance" : {
"performOnServer:logging:" : "dkh 09/16/2015 14:27",
"performOnServer:status:" : "dkh 09/16/2015 14:29" } }

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*tode-gemstone-core3x
systemIsVoting
| vs sessId |
vs := System voteState.
sessId := System sessionIdHoldingGcLock.
^ sessId ~= 0 or: [ vs > 0 and: [ vs < 4 ] ]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"class" : {
},
"instance" : {
"buBackup:safely:" : "dkh 03/22/2015 07:41" } }
"systemIsVoting" : "dkh 09/16/2015 14:56" } }
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(name 'Tode-GemStone-Core3x-dkh.2' message 'add --safely option to `bu backup` command' id 'c59dc3b6-a4e5-4e60-b5f8-1e4622b999b8' date '03/22/2015' time '08:07:11' author 'dkh' ancestors ((name 'Tode-GemStone-Core3x-dkh.1' message 'fixing `bu` command for 2.4.x' id '6fc89f19-19a6-4eac-af9b-30576a638d2e' date '11/20/2014' time '11:21:19' author 'dkh' ancestors () stepChildren ())) stepChildren ())
(name 'Tode-GemStone-Core3x-dkh.3' message 'Issue #202: add --uncompressed option to `bu backup` command. Default for `bu backup` is to create a compressed backup. Also add a `bu validate` command for validating the readability of backup files ... update tests ,, improve (hopefully) performOnServer: functionality by getting back explicit command status' id '6f045600-4da2-4552-b935-8d8e96f40ce5' date '09/16/2015' time '15:45:20' author 'dkh' ancestors ((name 'Tode-GemStone-Core3x-dkh.2' message 'add --safely option to `bu backup` command' id 'c59dc3b6-a4e5-4e60-b5f8-1e4622b999b8' date '03/22/2015' time '08:07:11' author 'dkh' ancestors ((name 'Tode-GemStone-Core3x-dkh.1' message 'fixing `bu` command for 2.4.x' id '6fc89f19-19a6-4eac-af9b-30576a638d2e' date '11/20/2014' time '11:21:19' author 'dkh' ancestors () stepChildren ())) stepChildren ())) stepChildren ())
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DESCRIPTION
remove Remove backup file from backup directory
restore Restore from a GemStone backup
snapshot Make a snapshot of the extent0.dbf file
validate Validate that backup file is readable

OPTIONS
--help
Expand All @@ -42,5 +43,6 @@ EXAMPLES
at: 'restore' put: self burestoreManPage;
at: 'remove' put: self buremoveManPage;
at: 'snapshot' put: self busnapshotManPage;
at: 'validate' put: self buvalidateManPage;
yourself.
^ manPage
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ bubackupManPage
bu backup - Make a GemStone backup

SYNOPSIS
bu [--dir=<backup-directory>] backup [--safely] <backup-file>
bu [--dir=<backup-directory>] backup [--safely] [--uncompressed] <backup-file>

DESCRIPTION
Make a GemStone backup in the specified backup file.
Make a GemStone backup in the specified backup file. By default a compressed
backup is created and a `.gz` is tacked onto the end of the <backup-file> if
not already present.

With no options specified, the backup file will be located in the directory
specified by the `bu directory` command. The default backup directory is named
Expand All @@ -19,11 +21,15 @@ DESCRIPTION
With the --dir option specified, the backup file will be stored in the named
directory.

With the --safely option specified, the snapshot will (quietly) be skipped if
the target snapshot already exists.
With the --safely option specified, the backup will (quietly) be skipped if
the target backup file already exists.

With the --uncompressed option an uncompressed backup is created in the named
<backup-file>.

EXAMPLES
bu --help backup
bu backup --uncompressed sample.dbf
bu backup sample.dbf
bu backup --safely sample.dbf
bu --dir=/opt/gemstone/backups backup sample.dbf
Expand All @@ -33,4 +39,5 @@ SEE ALSO
bu --help info
bu --help list
bu --help restore
bu --help validate
'
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ DESCRIPTION
EXAMPLES
bu --help remove
bu remove sample.dbf
bu remove --snapshot extent0.sample.dbf
bu --dir=/opt/gemstone/backups remove sample.dbf
bu remove --snapshot extent0.sample.dbf
bu --dir=--dir=$GS_HOME/gemstone/snapshots remove extent0.sample.dbf

SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ DESCRIPTION

EXAMPLES
bu restore sample.dbf
bu --dir=/opt/gemstone/backups restore sample.dbf
bu restore sample.dbf.gz
bu --dir=/opt/gemstone/backups restore sample.dbf.gz

SEE ALSO
bu --help backup
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
bu
buvalidateManPage
^ TDManPage
commandName: 'validate'
fromString:
'NAME
bu validate - Validate that backup file is readable

SYNOPSIS
bu [--dir=<backup-directory>] validate [--snapshot] <backup-file>

DESCRIPTION
Verify the readability of the specified bacup file.

With no options specified, the backup file will be read from the directory
specified by the `bu directory` command. The default backup directory is named
''backups'' and is located in the $GEMSTONE_DATADIR.

With the --dir option specified, the restore file will be read from the named
directory.

With the --snapshot option specified the <backup-file> in the snapshot directory
will be validated.

EXAMPLES
bu validate sample.dbf.gz
bu --dir=/opt/gemstone/backups validate sample.dbf.gz
bu validate --snapshot extent0.sample.dbf

SEE ALSO
bu --help backup
bu --help directory
bu --help info
bu --help list
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bu
buBackup: backupPath safely: safely
^ self buBackup: backupPath safely: safely uncompressed: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
bu
buBackup: backupPath safely: safely uncompressed: uncompressed
| theBackupPath |
self systemIsVoting
ifTrue: [ ^ 'Please wait until system is no longer voting and try again' ].
Transcript
cr;
show: '---Starting backup to ' , backupPath printString , ' (';
show: TimeStamp now asString;
show: ')'.
theBackupPath := uncompressed
ifTrue: [ backupPath ]
ifFalse: [
| postFix |
postFix := '.gz'.
(backupPath endsWith: postFix)
ifTrue: [ backupPath ]
ifFalse: [
".gz automatically added to filename during compressed backup"
backupPath , postFix ] ].
self fullBackupTo: theBackupPath safely: safely uncompressed: uncompressed.
self class lastBackup: theBackupPath.
Transcript
cr;
show: '---Finished backup to ' , LastBackup.
^ theBackupPath
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bu
buValidateReadableBackupFile: backupFilePath
^ self copydbf: '' forFilePath: backupFilePath , ' /dev/null'
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
bu
bubackup
"
bu [--dir=<backup-directory>] backup [--safely] <backup-file>
bu [--dir=<backup-directory>] backup [--safely] [--uncompressed] <backup-file>
"

| backupFilePath safely |
self getSubcommandOptsMixedLongShort: {#('safely' nil #'none')}.
| backupFilePath safely uncompressed |
self
getSubcommandOptsMixedLongShort:
{#('safely' nil #'none').
#('uncompressed' nil #'none')}.
backupFilePath := self resolveBackupFilePath.
subOptions
at: 'safely'
ifPresent: [ :ignored | safely := true ]
ifAbsent: [ safely := false ].
^ self buBackup: backupFilePath safely: safely
subOptions
at: 'uncompressed'
ifPresent: [ :ignored | uncompressed := true ]
ifAbsent: [ uncompressed := false ].
^ self buBackup: backupFilePath safely: safely uncompressed: uncompressed
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ buinfo
bu [--dir=<backup-directory>] info [--snapshot] <backup-file>
"

| backupFilePath copyDbfCommand |
| filePath copyDbfCommand |
self getSubcommandOptsMixedLongShort: {#('snapshot' nil #'none')}.
subOptions
filePath := subOptions
at: 'snapshot'
ifPresent: [ :ignored | backupFilePath := self resolveSnapshotFilePath ]
ifAbsent: [ backupFilePath := self resolveBackupFilePath ].
copyDbfCommand := (GsFile _expandEnvVariable: 'GEMSTONE' isClient: false)
, '/bin/copydbf -i ' , backupFilePath.
^ System performOnServer: copyDbfCommand
ifPresent: [ :ignored | self resolveSnapshotFilePath ]
ifAbsent: [ self resolveBackupFilePath ].
^ self copydbf: '-i' forFilePath: filePath
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ buremove
bu [--dir=<backup-directory>] remove [--snapshot] <backup-file>
"

| backupFilePath |
| filePath |
self getSubcommandOptsMixedLongShort: {#('snapshot' nil #'none')}.
subOptions
filePath := subOptions
at: 'snapshot'
ifPresent: [ :ignored | backupFilePath := self resolveSnapshotFilePath ]
ifAbsent: [ backupFilePath := self resolveBackupFilePath ].
^ self buRemove: backupFilePath
ifPresent: [ :ignored | self resolveSnapshotFilePath ]
ifAbsent: [ self resolveBackupFilePath ].
^ self buRemove: filePath
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
bu
buvalidate
"
bu [--dir=<backup-directory>] validate [--snapshot] <backup-file>
"

| filePath |
self getSubcommandOptsMixedLongShort: {#('snapshot' nil #'none')}.
filePath := subOptions
at: 'snapshot'
ifPresent: [ :ignored | self resolveSnapshotFilePath ]
ifAbsent: [ self resolveBackupFilePath ].
self buValidateReadableBackupFile: filePath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bu
copydbf: args forFilePath: filePath
| copyDbfCommand |
copyDbfCommand := (GsFile _expandEnvVariable: 'GEMSTONE' isClient: false)
, '/bin/copydbf ' , args , ' ' , filePath.
^ self performOnServer: copyDbfCommand logging: true
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
bu
fullBackupTo: backupPath safely: safely
| backupFilename backupDirName backupDir result |
ServerFileDirectory
splitName: backupPath
to: [ :dirPath :filename |
backupDirName := dirPath.
backupFilename := filename ].
backupDir := ServerFileDirectory on: backupDirName.
(backupDir fileExists: backupFilename)
ifTrue: [
safely
ifTrue: [
Transcript
cr;
show:
'Skipping backup, --safely specified and ' , backupFilename printString
, ' exists.'.
^ false ].
backupDir deleteFileNamed: backupFilename ].
System commitTransaction.
result := SystemRepository fullBackupTo: backupPath.
result == true
ifFalse: [ ^ self error: 'Could not complete the backup: ' , result ]. "we have been left outside of transaction in manual
transaction mode"
System transactionMode: #'autoBegin'.
^ true
^ self fullBackupTo: backupPath safely: safely uncompressed: false
Loading