Skip to content

Added implementations for DataStore removal and copy methods.#1478

Merged
rfecher merged 3 commits intomasterfrom
beckerr_api_work
Jan 2, 2019
Merged

Added implementations for DataStore removal and copy methods.#1478
rfecher merged 3 commits intomasterfrom
beckerr_api_work

Conversation

@richard3d
Copy link
Copy Markdown
Contributor

@richard3d richard3d commented Dec 18, 2018

Added necessary implementations for removal of indices and types and also copyTo methods. Work should perform all required house keeping duties as well. This PR addresses issue #1440.

@richard3d richard3d requested a review from rfecher December 18, 2018 23:17
@richard3d richard3d changed the title Added implementations for DataStore removal methods. Added implementations for DataStore removal and copy methods. Dec 21, 2018
final short internalAdapterId,
String indexName ) {

adapterCache.remove(internalAdapterId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line should be removed

baseOperations.deleteAll(
index.getName(),
adapter.getTypeName(),
"",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like this line should stay the way it was

writer.write(it.next());
}
writer.close();
it.close();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try with resources is used, no need to close

indices);

// copy the data over for the given adapter type / indices
for (int k = 0; k < indices.length; k++) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this loop is unnecessary and actually seems to write the same data multiple times (querying by index is not necessary)

final String indexName = query.getIndexQueryOptions().getIndexName();
final boolean isAllIndices = query.getIndexQueryOptions().isAllIndicies();

// if typeNames are not specified, then it means 'everything' as well
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't true if there are query contraints in the query.

typeName).indexName(
indices[k].getName());
try (CloseableIterator<?> it = query(qb.build())) {
Writer writer = other.createWriter(typeName);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try with resources for the writer

// TODO Auto-generated method stub

// remove the given index for all types
CloseableIterator<InternalDataAdapter<?>> it = adapterStore.getAdapters();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try with resources

final short adapterId = markedAdapters.get(i);
baseOperations.deleteAll(
indexName,
"",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need the type name

// Remove all the data for the adapter and index
baseOperations.deleteAll(
indexName,
"",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need type name

for (int i = 0; i < indexNames.length; i++) {
baseOperations.deleteAll(
indexNames[i],
"",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need type name

@Override
public void deleteAll() {
deleteEverything();
// Clear all the data and stats, but leave adapters/indices alone
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that the desired behavior? it is nice to have a "wipe everything" op as well then

@rfecher rfecher merged commit b8eb97e into master Jan 2, 2019
@rfecher rfecher deleted the beckerr_api_work branch January 2, 2019 19:54
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

Successfully merging this pull request may close these issues.

2 participants